summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
Remove Page Title from Static Frontpage
|
I'd like to remove the post title from my static frontpage. Just that page.
I've created a child theme from a free Press75 theme. So I'd like to make this change in my child theme's function.php.
I used this code but it removes the title from all pages, posts and my navigation:
add_filter( 'the_title', 'remove_page_title' );
function remove_page_title() {
if(is_page('138')) {
}
return '';
}
I thought it would just remove the title from the page with ID 138.
What am I doing wrong?
Thanks!
|
You've almost got it!
Here's your original code:
add_filter( 'the_title', 'remove_page_title' );
function remove_page_title() {
if(is_page('138')) {
}
return '';
}
What it's doing is adding a filter on the_title that doesn't accept any parameters. That's your first mistake. The the_title filter actually takes two parameters - the page/post title and the page/post id. So first, let's rewrite our hook:
add_filter( 'the_title', 'remove_page_title', 10, 2 );
function remove_page_title( $title, $id ) {
}
This assigns our filter with a priority of 10 and lets us accept both parameters sent in by the filter. Then we specify the parameters our function accepts.
Inside the function, we want to check if we're on the right page. If we are, return '', if we aren't return the title:
if( '138' == $id ) return '';
return $title;
Your original function was always returning '' when the filter ran. That's why you were getting a blank title on every page, not just the page you wanted.
Our full code
So your full filter, rewritten to accept parameters and use the proper logic:
add_filter( 'the_title', 'remove_page_title', 10, 2 );
function remove_page_title( $title, $id ) {
if( '138' == $id ) return '';
return $title;
}
| 0.888889 |
Add_filter( 'the_title', 'remove_page_title ''
|
Is there a difference between "brainstorming" and "mindstorming"?
|
Some people use brainstorming, others use mindstorming. I could not find the difference between the two words.
|
"Brainstorming" is a commonly used and commonly accepted word. "Mindstorming" is not. As far as I can tell it means the same as "brainstorming", and thus it is difficult to see why we need a new word to express an idea that we already have a word for. (IMHO it's just an effort by some people to sound like they're introducing a new idea when they're just recycling the same old ideas, but that may be getting off topic.)
| 1 |
"Brainstorming" is a commonly used and accepted word .
|
Looking up for an item in a list and different table styles in iOS
|
I have a settings view with a grouped table. One of the cells of such table is intended to show a very long list of items from where I want the user to select one. Due to the length of the list, I need to provide a way to make easier to find a certain item.
One of the options I think there are, is to show letters of alphabet as indexes at the right side of a plain table. Since my first table is a grouped one, my navigation hierarchy would be then like this:
Would it be inconsistent to navigate from a grouped table to a plain table? If so, could somebody give an existing example? I didn't find anything related to this in iOS Human Interface Guidelines, maybe it is described somewhere else and this navigation pattern breaks the guidelines.
Another option could be having a search bar. Can a search bar be used in both a plain table and a grouped table? The existing example of such bar I found is in Contacts app and it is a plain table. In a plain table, could both an alphabet index and a search bar be shown?
|
You already named the best solution: Search. Just look at the Contacts app. There is a global search for all contact groups and a search for just a group at a time.
Don't think about about the implementation while finding the best UI/problem solution. Ignore the code. UI design first. Otherwise you limit yourself finding the best solution for the user.
| 1 |
Search for the best UI/problem solution
|
Parse order and/or single/double quote issue with Calendar events and Google Map Info Window
|
I am utilizing a combination of Solspace 'Calendar', 'Playa', and 'Google Maps for ExpressionEngine'. I'm having a strange issue where the dates aren't showing up correctly in my infowindows on the Google Map, but they show up fine using the same code outside of the infowindow.
So, I have a 'Location' channel, and an 'Event' channel. The Event channel is associated with the Calendar module, and uses a Playa single relationship field to relate it to a Location.
I am adding markers to the map for every 'Location', and for each marker, I'm populating the infowindow with the Location details. this includes using the Playa:Parents method to show all of the events that are at that location.
I copied the code from the Solspace Calendar demo template for a single event to show the event date, because it had all the conditionals all worked out to deal with single day or multi-day events well.
My problem is that in the infowindow, it's only showing the 'From' date, and not the 'To' part of the date string. It shows it correctly when I output it outside of the map, though. Here is the code that is outputting the date information.
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
But this is how it outputs, in the infowindow, and outside of the map.
(crap, I don't have enough 'reputation' to post the image here, but it's here: http://paleosun.com/misc/stackexchange-map-calendar-question.jpg)
Notice, the section below the map has the "to" date. Same code is used to output it.
I have determined that something is going wrong with the quotes in the event date formatting tags. The {if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} part is never resolving to 'true' like it should. In fact, If I just try to output {event_first_date format='%Y%m%d%g%i%a'} in the infowindow part, nothing show up. However, if I use double quotes and output {event_first_date format="%Y%m%d%g%i%a"} it DOES work. The problem is, I cannot use that fix in the conditional, because double quotes are already being used around the output of that tag...
Any ideas why? Or what I can do as a work-around?
Here is all of my relevant template code:
{exp:gmap:init
id="mainmap"
class="gmap"
style="height:600px;width:100%; border: 1px solid green;"
center="United States"
zoom="4"
}
<div id="location-container">
{exp:channel:entries
channel="location"
disable="member_data|pagination|category_fields"
limit="9999"
}
{if loc_show_on_map == 'yes'}
{exp:gmap:marker
id="mainmap"
latitude="{loc_latitude}"
longitude="{loc_longitude}"
geocode="false"
clustering="true"
infobox="true"
show_one_window="true"
class="ui-infobox-dark ui-infobox"
offsetY="-45"
offsetX="15"
icon="{categories limit='1'}{category_image}{/categories}"
}
<div style="width: 400px;" class="clearfix">
<h3><a href="{path=find-music/location/{url_title}}">{title}</a></h3>
<ul>
{categories}
<li>{category_name}</li>
{/categories}
</ul>
{if loc_image}<img src="{loc_image}" alt="{title} image" width="200" class="right" />{/if}
{loc_contact_first_name} {loc_contact_last_name}<br />
{loc_street_address} {if loc_address_details}{loc_address_details}{/if}<br />
{loc_city_town}, {loc_state} {loc_zip_code}<br />
<ul>
{exp:playa:parents channel="calendar_events"}
<li>
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
<br />From:{event_first_date format='%Y%m%d%g%i%a'}
<br />To: {event_last_date format='%Y%m%d%g%i%a'}!
Yes
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
</li>
{/exp:playa:parents}
</ul>
</div>
{/exp:gmap:marker}
{!--
custom javascript to add attributes to the markers
for location type and music styles, so we can filter
based on that
--}
<script type="text/javascript">
if(typeof newMarker!='undefined'){
newMarker.entry_id = {entry_id};
newMarker.music_styles = [];
{exp:playa:children field="loc_music_styles"}
newMarker.music_styles.push({entry_id});
{/exp:playa:children}
newMarker.location_types = [];
{categories}
newMarker.location_types.push({category_id});
{/categories}
}
</script>
{/if}
<div id="location-{entry_id}" class="location-entry clearfix">
<h3><a href="{path=find-music/location/{url_title}}">{title}</a></h3>
{if loc_image}<img src="{loc_image}" alt="{title} image" width="200" class="right" />{/if}
{loc_contact_first_name} {loc_contact_last_name}<br />
{loc_street_address} {if loc_address_details}{loc_address_details}{/if}<br />
{loc_city_town}, {loc_state} {loc_zip_code}<br />
<ul>
{exp:playa:parents channel="calendar_events"}
<li>
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
</li>
{/exp:playa:parents}
</ul>
<hr />
</div>
{/exp:channel:entries}
</div> <!-- /#location-container -->
|
I never used GoogleMpas for EECMS, but let's try something.
I already had some problems to solve because of nested exp:channel:entries and exp:channel:events.
So, let's first move them to an embed, but trying to reduce the number of times the modules are parsed and improve the performance.
{embed="events/.mapmarkers" event_ids="{exp:playa:parents channel='calendar_events' backspace='1'}{entry_id}|{/exp:playa:parents}"}
The default format of the variables of exp:channel:events is already YYYYMMDD. So you don't need to format some of your conditionals.
{if "{event_first_date}" != "{event_last_date}"}
Other conditionals, can have the double and single quotation marks replaced and the '%a' can be removed if you use '%H'.
{if '{event_first_date format="%Y%m%d%H%i"}' != '{event_last_date format="%Y%m%d%H%i"}' }
Your embed will look like this:
{if embed:event_ids !== ""}
<ul>
{exp:calendar:events parse="inward" event_id="{embed:event_ids}"}
<li>
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
<br />From:{event_first_date format='%Y%m%d%g%i%a'}
<br />To: {event_last_date format='%Y%m%d%g%i%a'}!
Yes
{if event_never_ends}
(never ends)
{if:else}
{if '{event_first_date format="%Y%m%d%H%i"}' != '{event_last_date format="%Y%m%d%H%i"}' } <b>to:</b>
{if "{event_first_date}" != "{event_last_date}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
</li>
{/exp:calendar:events}
</ul>
{/if}
Because you're calling this twice on your template, I strongly suggest you to use stash to save the content of the embed.
| 0.888889 |
nested exp:channel:entries and exp
|
what's the relation between sensor size and image quality (noise, dynamic range)?
|
I'm reading this description on sensor size:
Digital compact cameras have substantially smaller sensors offering a
similar number of pixels. As a consequence, the pixels are much
smaller, which is a key reason for the image quality difference,
especially in terms of noise and dynamic range.
Could you please elaborate on the last sentence: what's the relation between sensor size and image quality? In particular, what are the advantages and disadvantages of a small sensor (of a compact camera, in contrast to a large sensor of a DSLR camera)?
|
A digital image sensor is ultimately a device that uses the photovoltaic or photoconductive properties of photodiodes to convert photons into electrons (charge), which can later be read out as a saturation value and converted to a digital pixel. This is an analog-to-analog then analog-to-digital conversion process.
The key behavior of a photodiode relevant to imaging, converting photons to electrons, improves with total surface area. The more surface area, the greater the area to detect photon strikes per photodiode, and the greater the physical material area within which electron charge (signal) can be collected. In other words, larger physical pixel area equates to higher signal ratio. The "depth" of a well is ultimately immaterial to modern Bayer-type CFA sensors, as deeper penetration only really has a filtration effect...the deeper a photon penetrates a photodiode, the more blueshifted light will be filtered out in favor of redshifted light. This is due to the response curve of the type of silicon used in photodiodes...which are more sensitive to infrared wavelengths than visible light wavelengths, and more sensitive to visible light wavelengths than ultraviolet and x-ray wavelengths.
Finally, being electronic devices, image sensors produce a variety of forms of electronic noise. In particular, they are susceptible to a low number of electrons in any given photodiode being generated from the low level of dark current that is always running through the sensor. Being devices sensitive to electromagnetic frequencies, the intrinsic field of the sensor itself can be affected by strong, nearby devices that emit electromagnetic frequencies of their own (if its not shielded properly) which can produce banding. Slight differences in the exact electrical response of each pixel can produce slight variations in how the charge accumulated in a photodiode is read out, and there can be thermally induced forms of noise. These forms of noise create a signal floor wherein it becomes difficult or impossible to determine of a digital pixel level is the product of an actual photon capture or due to electronic and thermal noise. So long as the image signal is larger than the noise floor, or in other words the signal to noise ratio (SNR) is high, a useful image can be produced.
All things being equal...and by that, I mean the same number of pixels, the same ultimate sensor design characteristics, the same amount of dark current, the same amount of read noise...a smaller sensor will be noisier than a larger sensor because the larger sensor, with the exact same number of pixels, can have larger surface area for each of those pixels, allowing more electrons to be captured for any given photon strike. A larger pixel has a higher maximum saturation point, which allows more total electron charge before the pixel is "full" or totally white. That intrinsically increases SNR, reducing the impact that electronic noise has on the final image signal, producing less noisy images at exactly the same settings as a smaller sensor.
Dynamic range is the total usable tonal range available from a sensor. It is ultimately affected by the amount of electronic noise present in a sensor and the maximum saturation point of the pixels, or the ratio between the mean of electronic noise and the maximum saturation point of each pixel in the sensor. Again, all things being equal, dynamic range will be better on a larger sensor as the SNR, even at low signal levels, is going to be slightly better than a smaller sensor, and at higher signal levels it can be significantly better. As is often the case with image sensors these days, increasing pixel size, or for that matter increasing a pixels maximum sensitivity (ISO), has the effect of also increasing the maximum amount of read noise at low ISO. This is ultimately due to poor control over electronic noise to start with, resulting in higher read noise at minimum ISO for larger sensors than for smaller sensors. While the increase in read noise is often still minor compared to the increase in maximum saturation point, and therefor does not affect maximum SNR much, it can mitigate or eliminate any gains at the sensors minimal SNR level, reducing or eliminating any improvement in dynamic range as well.
| 0.888889 |
Photovoltaic or photoconductive properties of photodiodes convert photons into electrons (charge)
|
Best way to organize models with multiple meshes and textures?
|
I have character models which have different parts, ex: upper body, head, lower body; each part is a separate mesh in the same model. Each part has several textures associated with it (diffuse, normal, etc).
I'm wondering if there is a best practice for associating the textures with the meshes, given a .obj file as the model, for example, and .tga files for the textures.
So for instance, making sure the head textures get mapped on to the head object.
One way would be having a separate file for each mesh, and using the file names to associate them with their textures, but that seems impractical.
Is there a nice, clean way to do this, which is both easy to program (importing and rendering) and easy for the artist?
|
Many typical source formats already do what you're asking for in data. The format will contain a list of N materials and a list of M meshes with a mapping for each particular mesh to the material it uses. Your converter can convert these directly to your in-engine format.
Other formats make use of external references, which is handy if you have multiple meshes that share materials. The format is again usually the same: the format has a list of N material references and M meshes and maps each mesh to its material.
In engine, you would either use a reference/pointer/handle to each material for each mesh or use an ID system. You load your optimized format which would likely use a reference system as in the previous paragraph. When you load foo.model you'd get a hierarchy of M meshes each with an identiier of the material resource to load. You load the material if not already loaded and attach the handle/id to the mesh.
For example, you might have the files:
/asset/material/stone.mat
/asset/material/steel.mat
/asset/model/gargoyle.model
/asset/model/gargoyle/face.mat
/asset/model/rock.model
/asset/model/sword.model
In such a setup, your gargoyle.mod might have 4 sub meshes using 3 materials, something like:
body => /asset/material/stone.mat
sword => /asset/material/steel.mat
armor => /asset/material/steel.mat
head => /asset/model/gargoyle/face.mat
This maps to a structure like:
materials: [0:stone, 1:steel, 2:face]
meshes: [0:(body, 0), 1:(sword, 1), 2:(armor, 1), 3:(head, 2)]
Your engine basically loads that data, loading any materials referenced that's it's missing. Assuming you've already loaded a number of materials, the in-memory format would be similar to the above but with different IDs (mapping to in-memory structures and not the on-file structure):
materials: [..., 25:stone, ..., 57:steel, ..., 93:face, ...]
models: [..., gargoyle: [0:(body, 25), 1:(sword, 57), 2:(armor, 57), 3:(face, 93)], ...]
A library like Open Asset Importer makes writing your converters much easier given all the formats it supports. You may need to modify it or branch out if your source format extensions (3d authoring plugins) get too advanced, though it does have a degree of flexibility.
| 0.888889 |
In-memory converter converts to in-engine format .
|
DIY Floating Desk in New Build Home
|
Evening all,
It's my first time posting so be gentle, I've been reading a fair few of your posts and hope you can answer my question.
I've attached a picture of where I would like to build a "floating" desk. the width is approximately 217cm, and I'd ideally like it to be 70cm to 80cm deep.
The white lines are my rough idea for the frame, and the red indicates a radiator.
The wall on the right is a stud wall, and I have no idea what the other 2 are. The back one is clearly exterior and the other is a joining wall with another house.
I'm basing it on the design used here: http://overthebigmoon.com/diy-file-cabinet-desk-blendtec-giveaway/
I could possibly use supports similar to those if absolutely necessary.
My question is really about support. Will the desk bow in any way? Is it too wide? Will the frame suggested be sufficient? Does any one have any other thoughts? How will I attach it to the walls?
Thanks,
Ashley
|
I guess nobody else is going to take a swipe at answering this, so I'll give it a shot.
Will the desk bow in any way?
Depends on load and construction details. With the items pictured, even a pretty lightly constructed one will probably not bow/bend/sag much, and there are ways to frame it so that a much heavier load could be supported. What you need to do depends on what you anticipate possibly happening to the desk - if people might sit on it, it needs a good deal more support than if it's just holding a modern lightweight computer and sundries. But if you might set a box of papaer or books on it, then it needs more again...
Is it too wide?
No, subject to adequate framing.
Will the frame suggested be sufficient?
Color me dubious on that front. While it's sufficient for the purposes it was built for (evidently) it's more fully supported than what you are proposing to do, which allows it to be not so robust - but again, this is also load dependent, though having the desk break IF someone sits on it (even if you don't intend it to be used that way) can be somewhat annoying.
Does any one have any other thoughts?
Stressed skin panel construction offers some interesting possibilities, depending what you are up for, and what you are looking for.
How will I attach it to the walls?
Multiple options. Ledger boards on each end are a good approach if you don't mind them being visible. File cabinets and no wall attachment as with the linked plans are another approach, but evidently not what you want. Huge shelf brackets as you mentioned in a comment are another option. Much of this comes down to YOUR concept of a "floating" desk or how important it is that the desk slab appears to be sitting there with "no visible means of support" and whether that means "nothing visible when standing 6 feet away" or "nothing visible when lying on the floor."
In the "can be effectively invisible" line, you attach angle iron to the side walls, build a thick-ish (you can thin the front edge) slab, cut slits in the ends that slide over the angle irons and slide it in place. That calls for some precision crafting. The slab needs to be thick-ish both so that you can have a non-contributing part below the angle iron to conceal it, and so it's stiff enough to span 2 meters while only being supported at the extreme ends.
Less drastically austere solutions allow for a cross-beam below the desk surface but beyond/above where your knees would hit it, and visible supports on the end walls that the desk slab sets on top of.
The giant shelf bracket approach is arguably "not really floating" but does have no "feet" or "legs" down to the floor.
All will hold the desk slab up. Different ones require more or less structure from the desk slab itself, due to greater or lesser spacing between support elements.
| 0.888889 |
How do I attach a desk slab to the wall?
|
can´t save new field in magento(1.9) customer registration checkout form
|
I followed the instructions to add a new field in customer registration from add new field in magento(1.9) customer registration, works perfect!
I need help to add this field to customer registration on checkout page also.
I added this to my module xml (ea_dni is the name of my module):
<checkout_onepage_index>
<reference name="checkout.onepage.billing">
<action method="setTemplate">
<template>ea_dni/billing.phtml</template>
</action>
</reference>
</checkout_onepage_index>
And I added the field in billing.phtml
<li>
<label for="eadni"><?php echo $this->__('DNI') ?></label>
<div class="input-box">
<input type="text" name="eadni" id="eadni" value="<?php echo $this->htmlEscape($this->getCustomer()->getDNI()) ?>" title="<?php echo $this->__('DNI') ?>" class="input-text" />
</div>
</li>
So, I see the new field in checkout registration form, but this field is not saving to the database!
This is my install-1.0.0.php
<?php
$this->addAttribute('customer', 'eadni', array(
'type' => 'varchar',
'label' => 'DNI',
'input' => 'text',
'position' => 120,
'required' => false,//or true
'is_system' => 0,
));
$attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'eadni');
$attribute->setData('used_in_forms', array(
'adminhtml_customer',
'checkout_register',
'customer_account_create',
'customer_account_edit',
));
$attribute->setData('is_user_defined', 0);
$attribute->save();
Can you help me? What am I missing?
Here is my app/code/local/EA/DNI/config.xml
<?xml version="1.0"?>
<config>
<modules>
<EA_DNI>
<version>1.0.0</version>
</EA_DNI>
</modules>
<global>
<helpers>
<ea_dni>
<class>EA_DNI_Helper</class>
</ea_dni>
</helpers>
<resources>
<ea_dni_setup>
<setup>
<module>EA_DNI</module>
<class>Mage_Customer_Model_Resource_Setup</class>
</setup>
</ea_dni_setup>
</resources>
</global>
<frontend>
<layout>
<updates>
<ea_dni>
<file>ea_dni.xml</file>
</ea_dni>
</updates>
</layout>
<translate>
<modules>
<EA_DNI>
<files>
<default>EA_DNI.csv</default>
</files>
</EA_DNI>
</modules>
</translate>
</frontend>
</config>
|
Seems to be a similar issue. You can see my suggested solution here: Custom Attribute Not saved in Checkout Register Form - Magento
| 1 |
Custom Attribute Not saved in Checkout Register Form
|
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.
|
I've done it twice, in 2008 and just now. Several problems: 1) old socket is riveted; 2) tight space to rewire.
I drilled the old socket out (through the rivet).
Next cut off any remaining rivet bur for a smooth flat surface.
Buy a replacement ceramic socket for a ceiling light. The one I bought had both black and white wires attached to the socket and a few inches of wire to work with. This is better than a replacement socket without the lead wires as it is very difficult to attach the black and white wire coming out of the pot to the replacement socket.
Detach the mounting bracket that allows you to screw the socket onto a threaded post. You don't want it because it will bring your socket down an inch or so and you wont get your end cap back on the fixture.
That mounting bracket was secured by a small screw. Find a larger sheet metal screw narrow enough to go throw that hole. Also make sure the head of the screw is small enough to fit in the recess area of the replacement fixture.
Drill a hole into the top of the ceiling pot, the right size to securely hold the screw. When I just recently removed my socket there was a black circular washer spacer attached to the top of the pot used as a buffer against the old socket. There was a center rivet (which I had cut out) but at 12, 3, 6, and 9 o'clock positions there remained marks (I guess from the four screw hold openings of the old socket). One of these had been drilled but it was too big for my new screw. So I drilled a smaller hole in another position.
Secure the socket with the new screw.
There is only one place for this new screw so it will make for a lopsided attachment. That is the socket wanted to lean towards the side where it was attached by the screw. To solve this I added three tiny washers to the top side of the screw. This way the socket was not leveraged to that end when tightened. Plus if I wanted to position it back a little the other way I could.
Anyway. it works.
| 1 |
Fix old socket riveted and tight space to rewire
|
Parse order and/or single/double quote issue with Calendar events and Google Map Info Window
|
I am utilizing a combination of Solspace 'Calendar', 'Playa', and 'Google Maps for ExpressionEngine'. I'm having a strange issue where the dates aren't showing up correctly in my infowindows on the Google Map, but they show up fine using the same code outside of the infowindow.
So, I have a 'Location' channel, and an 'Event' channel. The Event channel is associated with the Calendar module, and uses a Playa single relationship field to relate it to a Location.
I am adding markers to the map for every 'Location', and for each marker, I'm populating the infowindow with the Location details. this includes using the Playa:Parents method to show all of the events that are at that location.
I copied the code from the Solspace Calendar demo template for a single event to show the event date, because it had all the conditionals all worked out to deal with single day or multi-day events well.
My problem is that in the infowindow, it's only showing the 'From' date, and not the 'To' part of the date string. It shows it correctly when I output it outside of the map, though. Here is the code that is outputting the date information.
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
But this is how it outputs, in the infowindow, and outside of the map.
(crap, I don't have enough 'reputation' to post the image here, but it's here: http://paleosun.com/misc/stackexchange-map-calendar-question.jpg)
Notice, the section below the map has the "to" date. Same code is used to output it.
I have determined that something is going wrong with the quotes in the event date formatting tags. The {if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} part is never resolving to 'true' like it should. In fact, If I just try to output {event_first_date format='%Y%m%d%g%i%a'} in the infowindow part, nothing show up. However, if I use double quotes and output {event_first_date format="%Y%m%d%g%i%a"} it DOES work. The problem is, I cannot use that fix in the conditional, because double quotes are already being used around the output of that tag...
Any ideas why? Or what I can do as a work-around?
Here is all of my relevant template code:
{exp:gmap:init
id="mainmap"
class="gmap"
style="height:600px;width:100%; border: 1px solid green;"
center="United States"
zoom="4"
}
<div id="location-container">
{exp:channel:entries
channel="location"
disable="member_data|pagination|category_fields"
limit="9999"
}
{if loc_show_on_map == 'yes'}
{exp:gmap:marker
id="mainmap"
latitude="{loc_latitude}"
longitude="{loc_longitude}"
geocode="false"
clustering="true"
infobox="true"
show_one_window="true"
class="ui-infobox-dark ui-infobox"
offsetY="-45"
offsetX="15"
icon="{categories limit='1'}{category_image}{/categories}"
}
<div style="width: 400px;" class="clearfix">
<h3><a href="{path=find-music/location/{url_title}}">{title}</a></h3>
<ul>
{categories}
<li>{category_name}</li>
{/categories}
</ul>
{if loc_image}<img src="{loc_image}" alt="{title} image" width="200" class="right" />{/if}
{loc_contact_first_name} {loc_contact_last_name}<br />
{loc_street_address} {if loc_address_details}{loc_address_details}{/if}<br />
{loc_city_town}, {loc_state} {loc_zip_code}<br />
<ul>
{exp:playa:parents channel="calendar_events"}
<li>
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
<br />From:{event_first_date format='%Y%m%d%g%i%a'}
<br />To: {event_last_date format='%Y%m%d%g%i%a'}!
Yes
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
</li>
{/exp:playa:parents}
</ul>
</div>
{/exp:gmap:marker}
{!--
custom javascript to add attributes to the markers
for location type and music styles, so we can filter
based on that
--}
<script type="text/javascript">
if(typeof newMarker!='undefined'){
newMarker.entry_id = {entry_id};
newMarker.music_styles = [];
{exp:playa:children field="loc_music_styles"}
newMarker.music_styles.push({entry_id});
{/exp:playa:children}
newMarker.location_types = [];
{categories}
newMarker.location_types.push({category_id});
{/categories}
}
</script>
{/if}
<div id="location-{entry_id}" class="location-entry clearfix">
<h3><a href="{path=find-music/location/{url_title}}">{title}</a></h3>
{if loc_image}<img src="{loc_image}" alt="{title} image" width="200" class="right" />{/if}
{loc_contact_first_name} {loc_contact_last_name}<br />
{loc_street_address} {if loc_address_details}{loc_address_details}{/if}<br />
{loc_city_town}, {loc_state} {loc_zip_code}<br />
<ul>
{exp:playa:parents channel="calendar_events"}
<li>
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
</li>
{/exp:playa:parents}
</ul>
<hr />
</div>
{/exp:channel:entries}
</div> <!-- /#location-container -->
|
I am not sure of a workaround, but that is definitely a parse order issue. Given this is a very unique scenario, it would be rather difficult to duplicate without getting access to your EE install.
Email [email protected] and I can try to help you find a workaround. I am not sure who this support requests belongs to, me (Objective HTML), P&T, or Solspace but I can try to help you. :)
| 0.888889 |
Is there a parse order issue?
|
Putting Linux processes on certain CPU cores
|
Possible Duplicate:
How can I set the processor affinity of a process on Linux?
Computer CPUs have many cores insde them nowadays.
I have always wondered if there is a way to, when I start a process on the Linux command line, specify which particular core or cores that process might use?
For example, can I start a massive grep task and say "use ALL of CPU2 for yourself".
Or could I start a find task and say "never leave CPU3".
Or maybe I could start a video decoding task and say "use whatever is available on CPU1 and CPU2"
OR, is there no way to do this because it is not needed and the OS is doing this kind of stuff intelligently by itself (based on nice levels and general resource usage of the process etc)
IfyouknowwhatImean
|
What you are wondering about is CPU Affinity. I found that there was a good explanation of CPU affinity on NixCraft. But note that the Linux kernel is indeed, as you say, already making intelligent choices.
| 0.777778 |
CPU affinity on NixCraft
|
Nikon D3100 Won't Take Photo -- says light is too low
|
I've had my Nikon D3100 camera for about 3 years. I recently accidentally reset my shooting options.
Since I've done that, I'm having a hard time getting the camera to focus and take photos in lower light. I can hear it (and see it) hunting to focus, but the bottom right flashes the image suggesting I use the flash and it won't let me take a picture.
I've ensured that it's set to AF-C, but I'm still not able to force the photo to be taken. This happens with multiple lenses, including my prime which is fairly decent in low light. Often the exposure information on the screen shows me that I am close to perfect exposure (and sometimes just a bit underexposed).
What's going on? Is there something wrong with the camera? What other settings can I check?
Some other tidbits, I have it set to Manual, and I'm able to take the photos if I manually focus--but that doesn't work for me since my eyesight isn't great.
|
I had this problem in Low light with the AF Assist Light still coming on.
What I found was that using the Live View is completely different to focusing while keeping Live view off.
I just stopped using Live view and the problem was immediately solved. Of course the AF Assiste light was working in my case for both scenarios.
| 0.777778 |
AF Assist Light still coming on
|
Noise comparison for sensors the D800 vs the D600
|
If the main criteria of buying new FX camera for landscape photography is low sensor noise, what camera do you suggest to buy (Nikon): D800 ~2.5k, D600 ~1.7k. Does it make sense to pay extra money for this, if noise is almost the same, if it's true?
|
All large sensor cameras top-notch for landscape photography because no matter which, noise is extremely low around base ISO which is what you will be most likely shooting at. From a tripod I might add, which is essential to get critical sharpness.
Noise being the same at such low ISO setting, what you are left is the question of resolution which depends on how big you intend to print. If large, the D800 is certainly worth the money. If not, then getting the D600 will probably afford you a better lens which is even more important when it comes to sharpness.
The one thing you did not mention which is important for landscape is dynamic-range. The D600 has a slightly wider DR than the D800. So, if the resolution is not an issue for the print sizes you make, I would strongly consider the D600 instead.
| 1 |
Noise is extremely low around base ISO setting
|
How do I deal with a slow and undedicated colleague in the team?
|
I have been working on a new project. The project works like this: The end user can access a webapp using a link and he can add multiple systems on his network and manage that particular systems details. My part involves the front end and the webserver, which is done in python. My python actually communicates with another project which is entirely done in c & c++. The c/c++ project is the main app which does all the functionality. My python sends the user request to it and displays the response from it to the user.
I am very familiar with my work and I will finish it soon. Since that's not much work in it. And I am a person who loves to work. I spends most of the time in office and only go home when I feel sleepy.
The c/c++ app is managed by another colleague who has 5+ year experience and can do things much faster than me, but he never does it. May be he doesn't like to do it. His app crashes often when my python communicate with it or returns wrong values. It's full of bugs. Since my app depends on it, I am having a hard time building it. Instead of fixing the bugs, he asks me to slow down my work. He asks me to tell manager that my work needs a lot of time. He is asking me to fool the manager and even forcing me to work slowly like him.
During project meeting, when manager asks him about the bugs he says that he fixed everything and it works fine. Since he is my colleague, I couldn't tell anything to the manager. I obviously need to have a good relationship with my colleagues more than my manager, since most of the time we will be with our colleagues, not with the manager.
I am not able to tell the manager anything regarding this, since if manager asks him why, then he may think I complained about him to the manager. And he keeps on lying in the meeting. And since he fixes the bug slowly, it even slows down my work. Now I thought of working on the front-end part of my app and finishing it off so that in the mean time he can make his project stable. Now he is asking me to tell the manager that my front end part require a lot of work and I may need more and more time, simply so that he can drag the project down. And the sad thing is our actual manager has gone to the US, so we have a temporary manager and this guy doesn't know about the project much, so the c,c++ just fools him.
Can anyone suggest me how I deal with this?
I wanted to finish off the project soon. How can I make him work even by maintaining a good relationship with him?
Responses to comments:
If he's really deliberately misleading the company, you should report him to management.
I am new to this company and the other guy has been there for many years. And I have just started knowing my colleagues. If I directly go and complaint him, I don't think so I can make good relationship with my other colleagues. Even he has the power to mislead them. I am not telling he is a bad guy, he can do the work, but he is not doing it.
Doesn't your company have any kind of bug tracking system ?
Here actual bug tracking system isn't there. The company tries to finish off the project as soon as possible and gives it to the QA. And then fixes the bugs reported by QA.
This is why companies should give employees stock / options or some sort of ownership. That way you can literally tell the guy "You are costing me monetary growth... don't you want to make money also?".
The company has the stock options they have given me a 2500 share, mostly he too would have got some more.
Seniority does deserve some benefit of a doubt. You really need to speak to him first and try to understand the problem. He may be out of his depth, you may be able to help him, there could easily be variables you are unaware of. It may be hard now, but you could easily make the situation a lot worse by jumping the gun.
I even does it, first his app wasn't handling multiple requests at a time, he was using a queue to handle the requests I sent to him. I even suggested to him some of my ideas on it. He said he already had these ideas, and will be executing them. His explanations was: "Everything require certain time to do and this is a project which may need two years to complete and we are asked to finish it in two months". I used to have a hard time coding during first few weeks because of this bug. But now he fixed it. But he is using a single queue for a user requests and that is now slowing down the app, since it processes one request at a time.
What is QA doing this whole time? Why aren't they reporting/confirming the status of the project(s)?
The manager is the person who decides when to give to the QA. As of now it has not yet given to QA. He said we should give it by this month end.
|
Keep records. Document every error you get when communicating with his side, when you asked him to fix and when (if ever) he did it. That is the only way I know of dealing with this situation. So when your manager comes to you asking why things are not progressing you can clearly show without being seen as a whiner or a bad colleague.
| 1 |
Document every error you get when communicating with his side
|
Cron not executing PHP script
|
Cron is running but for some reason it's not executing the script. I have checked to see if the script works and it does. I am trying to make the PHP script execute every minute.
* * * * * /etc/php5 /var/www/cron/automatedScript.php
The server is Linux, Ubuntu distro.
|
I think this may solve your problem
* * * * * /usr/bin/php -q /var/www/cron/automatedScript.php
Info : PHP path may be vary in different os. So you have to know right installtion path of PHP.
| 0.888889 |
PHP path may vary in different os
|
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?
|
The tangent to the helix at $P = (a \cos t, a \sin t, ct)$ is
$T = (-a \sin t, a \cos t, c)$.
The vector
$H = (\cos t, \sin t, 0)$
is horizontal, and perpendicular to $T$. The radius vector $R$ from $P$ to the centre $C$ of the circle is perpendicular to both of these, so it is proportional to
$H \wedge T = (c \sin t, -c \cos t, a)$,
which has length $\sqrt{a^2 + c^2}$. So the centre of the circle is at $P + h H \wedge T$, with $h = r/\sqrt{a^2 + c^2}$.
| 0.777778 |
tangent to the helix at $P = (a cos t, a -sin t
|
How should hands that are EXTREMELY strong in one suit (10+ cards) be bid?
|
I'm a bit of a bridge noob, but I'm kind of puzzled about this. Say I have a hand that is ridiculously strong in one suit, say at least 10 cards with all 4 honors (I'll use spades for the example suit). how should I bid? This is so many cards that almost nobody will be leading spades but me, so if another suit is trump, I'm flush out of luck.
Obviously I would want to end up playing a spade contract with a good potential for a slam, but if I open too high, say 5 spades, won't my opponents catch on pretty quickly and bid in their own suits or No-trump, just so my spades will be next to useless? They will likely have favorable distributions for their own suits since nearly all the spades are gone, which only worsens the fact. Then again, if I bid to low, my partner may not rebid, and while taking 12 tricks at a contract of 3S is obviously good, knowing you will have that many overtricks from the start seems kind of a waste.
Even if I held 12 or 13 spades, if I bid 7S, won't my opponents just bid 7NT and I'll never get to lead? How should hands with this heavy a distribution be bid to make the most of them?
(I've already said I'm not a very experienced bridge player, so if I'm making any glaring oversights don't hesitate in the slightest to bring them up.)
NOTE: I know these hands are extremely rare, but in all reality, every single possible hand is rare enough that studying bridge hands is actually quite useless because you'll never see the same hand again in your life...but we do it anyway because that's how we learn. Couldn't you tell anyone asking about a specific hand not to worry about it because it'll never show up again? :D
|
If you have 10+ spades in your hand, you will never let a contract die out in 3S now, would you?
It really depends on the hand, but people play the following two conventions which might potentially be useful (of course, there might be others).
Namyats. This is to distinguish hands which are too strong for just preempting 4S. You show stronger hands by bidding 4D (taking spades as your suit), which you could potentially use here, though 10+ would probably be too strong. There are various followups which can be used to investigate slam.
4NT opening bid as Ace asking. Say you had AKQJxxxxxx, A,x,x. You could bid 4NT as asking for Aces, and bid the slam appropriately.
Anyway, hands with a 10+ suit are very rare and even experts have trouble with them (or rather, don't bother with them so much, because of the rarity).
As to your question about opponents taking out to their suit, why do you think that is likely to happen? It is quite risky for them to be bidding at the 5/6/7 level, without a running suit of their own. Your bidding at the 4/5/6/7 level would have taken out enough bidding space to make it unlikely they would be able to overcall easily (and find a fit). You seem to be also forgetting that you have a partner who could still hold some cards, and could easily double them and take them for a number. If they do bid, well, you can't help it, but I would say it is not as likely as you seem to think.
As to your edit.
Yes, any specific hand (down to the spots) is a low occurrence (in fact same chance for each hand!), but bidding systems are not geared towards finding the exact specific hand you have. Bidding systems are geared towards finding fits, distribution and strength with the ultimate goal of finding the right strain and level based on the scoring.
When talking about 'rarity', you should be thinking in terms of hand types rather than specific hands. So when someone says getting a 7 card spade suit is much more likely than getting a 10 card spade suit, they are not talking specific hands, but a set of hands. Take the set of all hands which have 7 card spade suit and the set of all hands which have a 10 card spade suit and compare the counts.
When people say 10+ card suits are rare, they are talking about the whole set.
You might never get the same hand dealt again, true, but the same hand type (say 15-17 balanced) might occur again frequently.
Bidding space is very limited, and trying to cater to rare hands can be inefficient use of that space.
| 1 |
Bidding at 5/6/7 level, without a running suit of their own
|
php mysql return wrong boolean result
|
I have the following query :
'SELECT Active FROM tbUsers WHERE Id=55'
The Id is unique and I need just to know the status of the user if he's active yes or no. The Column Active is set as boolean in Mysql
When I tried to return the result like the following (using another php function) :
$result = $this->selectRow($db,"tbClass","Active","Id='$Id'");
if($result) { return "ok" ; } else { return "nok" ;)
it returns 'ok' on both cases.
Any idea what's wrong with it ?
Here is the other function :
public function selectRow($db,$tableName,$field,$where) {
if($where == "") {
$query = "SELECT $field FROM $tableName";
}
else
{ $query = "SELECT $field FROM $tableName WHERE $where"; }
$result=$db->Qry($query);
if ($result) {
$no_of_rows = $db->TotRows($result);
if($no_of_rows == 1) {
return $result;
}
if($no_of_rows == 0) {
return '';
}
if($no_of_rows < 0) {
die('Invalid query: ' . $sender ."(".$query ."): ".mysql_errno().": ". mysql_error());
return '';
}
}
else {
die('Invalid query: ' . $sender .": " .$query.": ". mysql_errno().": ". mysql_error());
return '';
}
}
Qry Function is the following :
function Qry($sql) {
if($result = mysqli_query($this->con,$sql) ) {
return $result;
}
else
{
$err = "Error: ".$sql. " :: ". mysqli_error;
die("$err");
}
}
|
I think you need to change this condition .
$result=$db->Qry($query);
always return you query object
Just remove this condition and
You need to count number of affected row
<?php
public function selectRow($db, $tableName, $field, $where) {
if ($where == "") {
$query = "SELECT $field FROM $tableName";
} else {
$query = "SELECT $field FROM $tableName WHERE $where";
}
$result = $db->Qry($query);
$no_of_rows = $db->TotRows($result);
if ($no_of_rows == 1) {
return $result;
}
if ($no_of_rows == 0) {
return FALSE;
}
if ($no_of_rows < 0) {
die('Invalid query: ' . $sender . "(" . $query . "): " . mysql_errno() . ": " . mysql_error());
return FALSE;
}
}
| 0.888889 |
Change this condition
|
Different tyre width (front and back)
|
Out of necessity, I had to put an 1.26" (32mm) rear tyre on my bike where the front tyre is only 1.1" (28mm) wide (and the bike came with 1.1" tyres when I bought it). Are there any advantages or disadvantages of this, shall I try to get an 1.1" tyre for the rear wheel ASAP or is it safe this way?
|
Riding with a larger tire in the front provides certain advantages. I do this for two reasons:
Less slipping and sliding in the snow: With a bigger tire in the front you get more friction with the ground. This is important because your front tire is a lot more likley to flip you over then your rear because your rear tire has more weight on it.
Vertical cracks: The reason I keep a larger tire on now that it is warmer is to avoid falling due to vertical cracks and my tire getting stuck in them. Basically if your tire can't fit in the crack you can't get stuck in it and flip over.
| 1 |
Vertical cracks in front tire
|
Security concerns with a "fiddle" site?
|
I recently came across a cool site for testing .NET code (http://dotnetfiddle.net/). In the FAQs they mention that they have two restrictions for security purposes:
No access to File System IO
No external internet access
Is this sufficient to prevent malicious users from exploiting the site? Is there anything that a malicious user could still do even with these restrictions in place?
|
They seem to have taken fairly reasonable precautions. You can still reflect over the assemblies loaded in the AppDomain, so if you had time to poke through them, you might (or might not) find something in their custom assemblies that was interesting and exploitable, but it looks to me like the model is essentially what you'd get with a shared web host (plus the reasonable restriction of no file system or Internet access) and that model has been used to reasonably successfully isolate applications from each other and the host for many years now.
As I mentioned in my comment on Tyler's answer, they've also implemented some controls to prevent applications from mounting DoS attacks on the service, such as limiting application runtime to 5 seconds, and application memory to 200KB.
| 1 |
How do I isolate applications from each other?
|
Should I have a queue with SMS requests to picked up by a separate process or connect directly to the API?
|
I created an email queue where I put the requests for emails to be sent. If the SMTP server is unavailable, the requests are not lost.
When the SMTP server gets back online, the background service will pick up the requests to send the emails and process accordingly.
Question: I now have a requirement to deliver text messages with high certainty, but also to give feedback about a wrong phone number if that is possible. Should I have something like my mail queue to send text messages to my user phones or not?
I think it makes sense if we're talking about marketing messages, but what about text messages sent to users to verify their phone numbers?
What if their phone number is typed incorrectly? The phone API will tell me right away but if I put the request in the queue, I won't be able to let them know about it.
Rephrasing of the question: Should I care about the immediate feedback and loose the ability to deliver all SMS messages in case of temporary failure?
|
Depending on the API for sending text messages, there are two possibilities for meeting those business requirements.
If there are separate API calls to verify a phone number and to send a text message, you can use a queue for the actual sending and verify the validity of the phone number just before you put the text message in the queue.
If there is only an API call to send a text message, which informs you about success/failure after the fact and where the failure codes are descriptive enough, you could send the message initially from the context of the user request. If that fails with a temporary error, add the message to a queue for later retries.
| 1 |
Depending on the API for sending text messages, there are two options for meeting those business requirements
|
Opamp Voltage Doubler Unstable (After Extended Operation)
|
I've been working on a circuit which would drive an industry standard pneumatic regulator (E/P transducer). The transducer takes a standard 0-10V command signal with a typical input impedance of 6.5 kOhms. The DAC that I've selected (ADI 12bit 8 channel) has an internal 2.5V reference and can output 0-5V.
After researching extensively, an opamp voltage doubler seemed like a good fit. This worked and was rock solid for about two weeks, but failed after a ~2 day period of continuous operation without warning. Now the opamp output is close to a correct 2.0 gain but constantly fluctuates as if the output is barely stable and poorly damped. Has anyone ever seen an opamp fail this way?
We're using a UA7812 linear regulator to supply 12V (from 24V) to the opamp quad (LM324AN) and admittedly it may not be sufficiently heatsinked (gets wicked hot to touch). Still, the 12V supply is solid at 11.83V and voltages supplied by the DAC appear correct and stable. The actual resistors on the board are 10k with 0.1% accuracy and each measure 9.95k precisely. Any advice in solving the problem is tremendously appreciated! It's essential that this be a robust circuit.
Below is our final opamp configuration (and the part number):
|
I'm just guessing but your description makes me think that the pneumatic regulator is requiring a lot more current that you think. I base this on you saying that your 7812 regulator is running so hot.
Couple of things:
1) You don't need the regulator. The LM324 is good for a maximum supply voltage of 34 (36?) Vdc.
2) Add an emitter follower to the output of the op-amp. I'd be tempted to use a physically-large transistor just because of dissipation issues. NPN, TO-220 package, gain (Hfe) of at least 100. Collector goes to +24V, Base comes from output of op-amp, Emitter feeds both the pneumatic regulator and the right-hand end of R34. Note that the transistor is inside the feedback loop and doesn't introduce any error.
Question: is your regulator a voltage-input device or current-input? My company makes interface cards like this for a variety of different actuators and the ones that we work with are all current-input devices. We drive them with a low-frequency PWM signal where the output current is proportional to the control input. This eliminates temperature effects on the actuator's solenoid coil and the vibration that the low-frequency PWM produces reduces stiction in the actuator.
| 0.888889 |
Is your pneumatic regulator a voltage-input device?
|
Can one meet criteria, or satisfy requirements?
|
I usually see 'satisfy the criteria' and 'meet the requirements', but is it acceptable to use 'meet the criteria', or 'satisfy the requirements'?
|
The Oxford Collocations Dictionary says the following:
VERB+criterion: fit, fulfill, meet, satisfy. The Macmillan Collocations Dictionary gives one more verb, "match".
VERB+requirement: comply with, fit, fulfill, match, meet, satisfy, suit. The Macmillan Collocations Dictionary gives three more verbs, "achieve", "adhere to", "conform to".
| 0.777778 |
VERB+criterion: fit, fulfill, meet, suit
|
How to change the formating of the title of a "Listing" from roman to arabic?
|
I recently stepped out of my comfort bounds and decided to add some Code snippets to my paper. I was able to get everything working fine and looking good, except the actual title. Everything else in my Document uses arabic, i.e. Figure 2.3, Table 4.5, etc... for some reason when I insert the Code (Using lstlisting), the published version becomes "Listing III.1: code title".
I tried using the same setup in my pre-amble as the figures, tables, and equations:
\renewcommand\lstlistingname{\arabic{chapter}.\arabic{lstnumber}}
However, that removes the "Listing" portion and instead gives me "3.1 III.1: code title". Obviously I am not wise enough with the \renewcommand? or is there another setting I should be changing?
Here is the pre-amble I was trying to copy:
\newcommand{\updateCounters}{\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}%
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}%
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}%
Thanks!
|
a complete example makes it easier to help!
\documentclass[openany]{book}
\usepackage{listings}
\AtBeginDocument{%
\renewcommand\lstlistingname{My Listing}
\renewcommand\thelstlisting{\thesection.\arabic{lstlisting}}}
\begin{document}
\lstlistoflistings
\chapter{dummy}
\section{More dummy}
\begin{lstlisting}[caption=bar]
foo
\end{lstlisting}
\end{document}
Herbert
| 1 |
documentclass[openany]bookusepackagelistings
|
jQuery: missing ] after element list
|
I have that error in the code below. What's wrong ? I have no ideas left.
missing ] after element list
[object XMLHttpRequest]
$(function () {
setInterval($.post('/Sale/UpdatePrice',
{SaleId : @Model.Id},
function(data){
$('#mPrice').val(data);
}
)
,5000); //refresh every 5 seconds
});
C#
public JsonResult UpdatePrice(int SaleId)
{
...
return Json(NewPrice, JsonRequestBehavior.AllowGet); //NewPrice is a decimal
number
}
|
Doesn't it need to be in a closure,
$(function () {
setInterval(function() {
$.post('/Sale/UpdatePrice',
{SaleId : @Model.Id},
function(data){
$('#mPrice').val(data);
}
)}
,5000); //refresh every 5 seconds
});
| 1 |
Doesn't it need to be in a closure?
|
What are the musical instruments that have the sounding range that has at least all notes on this range A#1-C5?
|
What are the musical instruments that have the sounding range that has at least all notes on this range A#1-C5?
The instrument can go up to C6, or down to c0, it just need to have all the notes on A#1-C5 (including C5 and A#1).
Most pdfs I can find on internet with it a pretty basic, and dont have enought instruments. On Wolfram alpha website, its possible to find the range of instruments, many different ones, but you actually need to write down the instruments you know to check their range
|
There is this nice chart on Wikipedia that show the range of many instruments, probably more than a composer would typically use to compose music. Harps, Pianos, Bassoons, Contra-alto Clarinets, Tenor Wagner Tubas, Bass Trombones, Baritone Horns and Euphoniums are example of those that you need.
By the way, some musical notation programs like Sibelius is able to highlight which notes are out of range for the associated instrument: if I wrote a C8 on a Bass Trombone line, it would automatically highlight the note in red. Furthermore, these programs normally contain at least a thousand instruments for you to choose, and I guess that's more than you ever need
| 0.888889 |
Music notation programs like Sibelius highlight which notes are out of range for the associated instrument
|
Important non-technical course for programmers?
|
What kind of non-technical training course do you suggest for a programmer? Example could be public speaking course, presentation skill, English, business writing, or anything not related to programming or software engineering itself.
|
Foreign languages!
I had a course at college called "Computer Science and Humanity" in which we talked about being responsible as a developer (e.g. privacy concerns).
Business Administration (e.g. accounting, HR) lets you understand your bosses and clients better.
Electronics makes you understand your tools better.
| 1 |
Business Administration lets you understand your bosses and clients better
|
Error extends AccountController.php in magento
|
I'm trying to extend the core AccountController.php -> app/code/core/Mage/Customer copied it to app/code/local/Mage/ and add a log to see which extends properly.
In the file AccountController.php (app/code/local/Mage/Customer/controllers)
...
...
public function createPostAction() {
Mage::log('In app/code/local/Mage/', null, 'test.log', true);
...
...
AND CORE (only test)
In the file AccountController.php (app/code/core/Mage/Customer/controllers)
...
...
public function createPostAction() {
Mage::log('In app/code/core/Mage/', null, 'test.log', true);
...
...
And does not go through code/local/ Mage but by CORE. I need to configure something or it fails?
So I created a separate module following this tutorial: http:// aqpredict.com/blog/overriding-account-contoller-magento/ does not work.
anyone has an example of this, thanks.
|
In your module etc/config.xml
<frontend>
<routers>
<customer>
<args>
<modules>
<your_module before="Mage_Customer">Your_Module_Customer</your_module>
</modules>
</args>
</customer>
</routers>
</frontend>
Now create your custom AccountController in Your/Module/controllers/Customer/AccountController.php
<?php
require_once 'Mage'.DS.'Customer'.DS.'controllers'.DS.'AccountController.php';
class Your_Module_Customer_AccountController extends Mage_Customer_AccountController {
// Here you can override your methods
}
| 0.666667 |
Create custom AccountController in your module etc/config.xml
|
lion: assign buttons on a Microsoft mouse
|
I have an old 5 button Microsoft mouse (Laser Mouse 6000) and forever I've assigned the thumb button to "back" in the browser and the middle mouse button to "next app" on the desktop. Since I've installed Lion, this doesn't seem to work. The settings in the "Microsoft Mouse" panel in System Preferences don't seem have any effect.
Is there another way to map mouse buttons? I've noticed that Mission Control seems to detect my 5 buttons and let me assign them, but only to Mission Control functions. I don't see anywhere else where I can do this. Do I just need to wait for new MS drivers? Thanks.
|
BetterTouchTool's "Normal Mouse" area allows you to assign functions to all kinds of mouse buttons and should work for you. It's free, too, so it won't hurt to try.
The author has issued a couple of recent updates to make it more compatible with Lion. There are still a couple of small things but I'm using it every day (previously with my mouse, now with my trackpad) and it's tremendously useful.
| 1 |
BetterTouchTool's "Normal Mouse" area allows you to assign functions to all kinds of mouse buttons
|
What do I do wrong to get hip aches after biking?
|
I ride about 17 miles each session. After the ride, the outside of my hips sore: only the parts near the outermost joints, most likely the tendon (although this is only a guess). My knees are fine, my ankles are fine, etc.
The only thing that might not fit perfectly for me is the seat height. I'd rather have a longer post so I can lift the seat up an inch or two. Do you think this might create the soreness in the area of the outer hips?
|
I might be inclined to try out a different saddle, look for a smoother route, or invest in wider tires (if your bike will accommodate them). If heltonbiker is correct (above), your bursae may be absorbing more shocks than they can handle, causing the pain you're feeling. If you're a woman riding on a man's saddle, consider looking for a women's saddle, as women's sit-bones are usually further apart than men's.
If you're able to consult the medical establishment, it may be worth trying for a referral to a physical therapist. Lacking that, a good massage therapist can be a wonder-worker.
Good luck! I hope you can get back to biking pain-free.
| 0.777778 |
If heltonbiker is correct, your bursae may absorb more shocks than they can handle, causing the pain you
|
Is there a way to put a copy rotation constraint with an influence higher than 1?
|
I'm making a little animation with some gears. I want that if I rotate the first gear, all the gears rotate with the gain given by the gears.
For doing that I've choose the copy rotation constraint. But in my case, sometime a gear turn one time and the second turn tiwce. With the copy roation I can only put an influence between 0 and 1.
So my question is : Is there a way to put a copy rotation constraint with an influence higher than 1? Or is there an other solution to do what I want?
|
1.0 is the maximum influence for any given constraint, so setting it beyond 1.0 is impossible.
Using the Transformation constraint, you could easily map any kind of simple transformation from one object to the other. In the following example, the object being constrained will rotate twice the amount of Cube_target's rotation in the Y axis.
Checking Extrapolation will extend the transformation beyond stated range of values.
| 0.888889 |
Using the Transformation constraint, you can map any kind of transformation from one object to the other
|
Internal links to end with a trailing slash
|
The links in the main navigation end without a trailing slash, which do not match the canonical tags which end without.
Is there an easy way to make all links throughout the site end with a trailing slash? Please note. I'm not looking for a redirect to force a trailing slash, I'm looking to get the internal inking to include a trailing slash.
Bit of a Magento beginner, looking for an easyish fix if there is one.
|
For both categories and products you should be able to do this by setting the 'URL suffix'.
Go to the backend System > Configuration Catalog section > Catalog then scroll down to Search Engine Optimisations and give the Product URL Suffix and Category URL Suffix the value /
Don't forget to reindex your Catalog URL Rewrites
| 0.777778 |
'URL suffix' for both categories and products
|
Is using PHP NuSOAP a bad idea?
|
I read somewhere here on stackoverflow that using NuSoap is not a good idea and its dead. If it is, what is the best possible solution to create WSDL files. I was just nusoap just for creating wsdl files and I never got the webservice to work
|
If you're working with PHP4, it might be your only alternative.
With PHP5, you can use Zend Soap. http://framework.zend.com/manual/en/
| 0.888889 |
Zend Soap can be used with PHP5
|
Finding columns that do not match existing primary key
|
I'm trying to add a Foreign Key to a table, but database, Sql Server 2005, does not like it.
It says that columns do not match an existing primary key or unique constraint.
How can I find the columns in question so I can delete/change them and add the foreign key?
|
So you have TableA with a column X, and TableB with column Y. And you want to make Y a foreign key, such that all values of TableB.Y are values in TableA.X, correct?
To do so, TableA.X needs to have either a primary key or a unique constraint on it. It sounds like that is not the case. Make TableA.X unique first, then define your FK from TableB.Y referencing TableA.X
| 0.777778 |
Make TableA.X unique first, then define your FK from TableB.Y
|
Can Spoils be trashed by Counterfeit?
|
I'm looking for an authoritative answer here. Where does the Spoils card end up after being played twice by Counterfeit?
In fact, can Spoils be trashed at all? My understanding is that yes it can when it isn't played, e.g. in order to increase the value of Forager.
|
Spoils is played twice, but is returned to the Spoils pile and not trashed.
Spoils is a treasure providing three coins that reads:
When you play this, return it to the Spoils pile.
Counterfeit reads:
When you play this, you may play a Treasure from your hand twice. If you do, trash that Treasure.
According to the Dark Ages rulebook (PDF), page 11:
If you use Counterfeit to play Spoils twice, you will get [six coins], (in addition to the [one coin] from Counterfeit) and return Spoils to the Spoils pile; you will be unable to trash it.
To answer your second question, Spoils can be trashed, but not when it is played, exactly as you expect.
| 0.333333 |
Spoils is played twice, but returned to Spoils pile and not trashed
|
wpa_supplicant: connect to WLAN in the background (during boot)
|
I am using manual configuration to connect to my WLAN. In my wpa_supplicant.conf, I have something like this:
network={
ssid="mywifi"
key_management=WPA-EAP
...
}
and then, in my /etc/network/interfaces I have
auto wlan0
iface wlan0 inet dhcp
When I start my laptop, the connection to my WLAN is established automatically. The problem is, it takes sometimes 10 - 15 seconds until the connection is established and the whole boot process is blocked and waiting.
I was wondering whether it is possible to configure, so that the connection is established in the background, so that the boot process can go on booting, without waiting for the WLAN to be ready.
I am using Debian Wheezy
|
This is probably your dhcp client blocking until it the interface has an address. The exact answer will depend on what init system you use and what dhcp client you use. For dhcpcd, for example, you want to make sure the init script that launches it is called with the -b flag (background immediately), and if it has the -w flag (wait), to erase it.
One caveat is that if you have services starting after this interface is launched that depend on it having an IP address, this could cause problems if they start in the few seconds before an IP is secured. Keep that in mind if you encounter any oddities.
| 0.666667 |
dhcp client blocking until it has an IP address
|
Mazda Air Mass Meter - where can I buy one?
|
I have a 1993 Mazda 323 estate (GLXI 1.6l petrol).
It's not been terribly reliable and has suffered from inconsistent idle - sometimes idling fast (~1500 rpm) and sometimes erratically and sometimes cutting out when stopped at lights.
The last mechanic I took it to said it was probably a problem with the air mass meter - he did some 'bodges' on it to try and get it working but the car has still failed to start on one occasion. It seems to start and drive ok at the moment, but I'm not sure how much longer it will continue to do so!
Is this likely a problem with the air mass meter or is it likely to be something else?
Also, does anyone know where I could get hold of a new one? (I'm based in the UK)
|
Like this one? Not sure if your models match up to American ones, but this site might help. Hopefully they ship internationally.
| 0.888889 |
Whether your models match up to American ones?
|
Which of the items below are worth mentioning in my admission documents?
|
I really worried about what should I write in my admission documents, such as resume/CV, statement of purpose, informal email communications with professors. From the list below, please tell me what items have enough academic value to be mentioned in such documents?
Note that its a application in PhD program in computer science for US universities
Stack Overflow (generally Stack Exchange) reputation and badges
Coursera accomplished courses
Small-scaled programming projects (absolutely with no academic value)
Github programming repositories
|
This list does reflect your technical abilities and not your research-based activities.
Therefore, all things listed here should be packaged and be presented under a section
(e.g., such as 'Related Technical Activities'); to represent your technical abilities to program and contribute (e.g., Github).
| 1 |
This list does reflect your technical abilities and not research-based activities
|
The Probability of Catching Criminals
|
I have been struggling with the following question and would greatly appreciate any help :)
Suppose we have information about the supermarket purchases of 100 million people. Each person goes to the supermarket 100 times in a year and buys 10 of the 1000 items that the supermarket sells. We believe that a pair of criminals will buy exactly the same set of 10 items at some time during the year. If we search for pairs of people who have bought the same set of items, would we expect that any such people found were truly criminals? Assume our hypothesis to be that a pair of criminals will surely buy a set of 10 items in common at some time during the year.
This is meant to be an illustration of Bonferroni's principle. Suppose there are no criminals and that everyone behaves at random. Would we find any pairs of people who appear to be criminals?
We must initially find the expected number of pairs who buy the same 10 items per year. I'm not sure whether I do this correctly...
Here is how I've been going about solving it:
Number of possible pairs of people: $\binom{10^6}{2} = \frac{10^{12}}{2} = 5 \times 10^{11}$, using the fact that $\binom{n}{2} \approx \frac{n^2}{2}$, when $n$ is large.
Number of possible 10-item selections: $\binom{10^3}{10} \approx 2.6 \times 10^{23}$
Probability of a customer buying 10 particular items at a point in time:
$\frac{1}{2.6 \times 10^{23}}$
Probability of a customer buying 10 particular items at least once over the course of 100 periods in time: $\frac{100}{2.6 \times 10^{23}}$
Probability of a pair buying exactly the same 10 items (both at least once) over the course of 100 periods in time: $(\frac{100}{2.6 \times 10^{23}})^2 = (\frac{1}{2.6 \times 10^{21}})^2 = \frac{1}{6.76 \times 10^{42}}$
The expected number of pairs who buy the same 10 items per year is thus:
$ 5 \times 10^{11} \times \frac{1}{6.76 \times 10^{42}} = \frac{5}{6.75 \times 10^{31}}$
Because the above number is so low if we do find a pair buying the same 10 items then, under our hypothesis, they are likely to be criminals and not a false positive case.
I am just wondering whether my solution to the above is correct?
|
If a person $A$ buys some (any) $10$ of the $1000$ items, then the probability that some other person $B$ buys the same set of $10$ items is
$$\frac{1}{\binom{1000}{10}}.$$
For $N = 10^6$ people, and over $T = 100$ time units, the number of pairs of people is $T \binom{N}{2} = 100 \binom{10^6}{2}$.
So the expected number of occurrences of a pair of people buying the same set of items at the same time is
$$\frac{100 \binom{10^6}{2}}{\binom{1000}{10}} \approx \frac{100 \times 10^{12}/2}{2.6 \times 10^{23}} \approx \frac{2 \times 10^{13}}{10^{23}} \approx \frac{1}{5 \times 10^{9}},$$
which is small, but not as small as you calculated.
| 0.666667 |
If a person $A$ buys some (any) $10$ of the $1000$ items, then the probability that some other person
|
Can SG teams travel to different galaxies without extra power or an 8th chevron?
|
In the tie-in of SG-1 and Atlantis, they had to use a ZPM to power the gate, and use an eighth chevron to travel to the Pegasus Galaxy. It was (so I thought) common knowledge that they could only travel to gates within our own galaxy unless they had met those requirements.
Now, I recently rewatched the movie, in which the probe traveled to the Kaliam Galaxy, or as Catherine put it, "the other side of the known universe." So, why the limitation on the TV show? And why were they able to travel back to that planet in the first episodes?
|
This seems to be an example of retcon. Whilst in the film the planet Abydos was in the Kaliam Galaxy, in the TV series this was changed, and Abydos was said to be the closest planet to Earth (with a stargate), and therefore in the Milky Way.
I imagine that the reason they changed it for the TV series was so that they could have storylines with the Asgard, the Ori and Atlantis, without the teams being able to travel back and forth at will. This is only speculation though so I'll look into it further.
See Differences from the series.
| 1 |
Differences from the TV series
|
Concise vector adding in Python?
|
I often do vector addition of Python lists.
Example: I have two lists like these:
a = [0.0, 1.0, 2.0]
b = [3.0, 4.0, 5.0]
I now want to add b to a to get the result a = [3.0, 5.0, 7.0].
Usually I end up doing like this:
a[0] += b[0]
a[1] += b[1]
a[2] += b[2]
Is there some efficient, standard way to do this with less typing?
UPDATE: It can be assumed that the lists are of length 3 and contain floats.
|
You could create a function that gets the size of the array, loops through it and creating a return array which it returns.
| 0.833333 |
Create a function that gets the size of the array, loops through it and returns a return array
|
Uninstalling eclipse plugin error
|
When I try to uninstall my eclipse plugin the following error occurs:
An error occurred while uninstalling
enter code heresession context was:(profile=profile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Uninstall, operand=[R]de.test.package.one 0.1.0.201008170949 --> null, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.UninstallBundleAction).
Error while loading manipulator.
Caused by: Application failed,
Most topics refer to the eclipse.ini file, which I modified but that didn't solve the problem. The eclipse.ini looks like this:
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
Any ideas how I can solve this problem?
|
I would like you to know that I solved the: "An error occurred while uninstalling" problem. by:
1.) rename the eclipse.ini file to a non ini name (eclipse.xxx)
2.) start eclipse
3.) Install the software/plugin
4.) restore the ini file.
I wonder why Eclipse can start in the first place but it works.
The renaming of the executable did NOT work for me.
| 1 |
rename eclipse.ini file to non ini name
|
How to find out if my hosting's speed is good enough?
|
There are lots of different online performance tests:
Google PageSpeed Insights
iWebTool Speed Test
AlertFox Page Load Time
WebPageTest
Also there are several desktop/client software such as:
ping tool
YSlow
Firebug's Net console
Fiddler
Http Watch
I just want to decide if my hosting provider has a good enough performance or if I need to switch my hosting to another provider.
So, which tool should I use to compare my hosting provider with other hosting providers?
|
It depends what are you looking for: loading speed it's just an effect of network speed (which often is what you are looking for) and server side processing performance (hardware performance).
One factor to keep in mind is where the host is located: if your audience it's mostly in Europe, would be useful to get an host close to the main European backbone. Similarly for other Geographical locations.
After you have decided this, you could use stress-test tools like siege (on UNIX) to create lots of requests to a webpage and see how the host behaves under stress (using the tools you mentioned).
In the case of shared hosting and virtual server you can never be 100% sure that an host is going to be consistently fast (or slow), as your test might be influenced on other site's activity on the same host. It would be good to test during different times and for a relatively long period of time (for example one test every few hours for a week), in order to have a good "rough idea" of the host's speed.
To be fair, you should test the exact same site(s) and page(s) on every host (with the same frequency).
| 1 |
Stress-test tools like siege to create lots of requests to a webpage
|
Syntax highlighting language hints
|
Do you think it would be worthwhile to provide hints as to what language to use for the syntax highlighting?
Sometimes I find the highlighting on SQL or VB.NET answers is more distracting than helpful; for example:
Converting MySQL select to PostgreSQL
Retrieving data from a VB.NET arraylist of objects
to pick the two I've been looking at recently.
|
I think I know why this issue is now being ignored for at least eight months (and counting).
First note that the languages worst affected seem to be Lisp and Perl, since they get their code partially greyed out by false-positive comment character matching (# and //). The next most disturbing group of mistakes is false string interpretation, affecting Lisp and VB (and others). Then, SQL also seems to be affected by false-negative comment matching.
Look at the popular tag counts: http://stackoverflow.com/tags
As you see, C#, Java, PHP, Javascript, C++, and Python are dominating the programming language occurrences, before SQL, which is the first affected. The highest VB dialect is VB.NET, on the bottom of the second column. Perl is far behind, in the middle of the fourth column. The Lisp dialects do not even show up until page 7.
So, the affected languages do not show up very often. That in itself doesn't mean that no one in charge could notice. However, let's look at the tags of the people making StackOverflow (scroll down to the "Tags" section on their user pages):
Joel Spolsky seems to be mainly into VB, C++, C#, and SQL.
Jeff Atwood is a C# guy. None of the affected languages appear in his tags.
Jarrod Dixon does ASP.NET and C#. There is one occurrence of VB.NET.
Geoff Dalgas does C# and ASP.NET.
Brent Ozar seems to be mostly interested in databases with SQL.
So, not only do the most badly affected languages not turn up very often, the developers of StackOverflow also are not interested in them at all. They most likely see this as a non-issue. A bag of rice has fallen over in China, yawn. They are also perhaps not familiar with the syntax of those languages, so that they do not see the problem even if you show them examples.
In the end, the most we will get from them seems to be "the readme says it should mostly work". Perhaps StackOverflow is not a general programming oriented site after all.
Now, I don't want to sound so negative. There seems to be a simple solution: put <code class="prettyprint lang-whatever"> on the HTML whitelist.
| 0.777778 |
StackOverflow is not a general programming oriented site .
|
I can't get MySQL56 service to start after i stopped it
|
I am having an issue on my server. I am running MySQL on Windows Server 2008 R2. I have done some changes to my.ini file so I had to restart the MySQL for the changes to take effect. and when I went to services and tried to start MySQL56 windows gives me this error:
Windows could not start the MySQL56 service on Local Computer. Error
1067: The process terminated Unexpectedly.
I tried rebooting my server and that did not work. I restored the changes that I made to my.ini and that did not work.
What can I do to bring MySQL back up?
|
Found the problem. The Log file was full. I had open the my.ini file and increase the
innodb_log_file_size variable.
Thanks
| 0.888889 |
Log file was full.
|
Resume and Pause Mechanism
|
I am working on this application for Android it is called Button Chaser. I have to crate a pause and resume mechanism . I created the pause mechanism and it works just fine, but I am having trouble creating the Resume one. how can I make the resume mechanism? This is my code:
package com.example.buttonchaser;
import java.util.Random;
import java.util.Timer;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.*;
import android.widget.*;
import android.graphics.Point;
import android.view.View.OnClickListener;
public class ButtonChaserActivity extends ActionBarActivity implements OnClickListener{
private Button btn;
private TextView lblScore;
private Timer timer;
private int x, y, w, h, score;
ButtonChaserTimerTask task;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_button_chaser);
//Inflate UI
btn = (Button)findViewById(R.id.btn);
lblScore = (TextView)findViewById(R.id.lblScore);
btn.setOnClickListener(this);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
w = size.x - btn.getWidth() - 48;
h = size.y - btn.getHeight() - 48;
timer = new Timer();
task = new ButtonChaserTimerTask(this);
timer.schedule(task, 0, 1500);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.button_chaser, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch(item.getItemId()){
case R.id.mnuEasy:
newGame();
return true;
case R.id.mnuMed:
medGame();
return true;
case R.id.mnuHard:
hardGame();
return true;
case R.id.mnuNew:
newGame();
return true;
case R.id.mnuQuit:
quit();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
public void newGame(){
score = 0;
lblScore.setText("Score: " + score);
timer = new Timer();
task = new ButtonChaserTimerTask(this);
timer.schedule(task, 0, 1500);
}
public void medGame(){
score = 0;
lblScore.setText("Score: " + score);
timer = new Timer();
task = new ButtonChaserTimerTask(this);
timer.schedule(task, 0, 500);
}
public void hardGame(){
score = 0;
lblScore.setText("Score: " + score);
timer = new Timer();
task = new ButtonChaserTimerTask(this);
timer.schedule(task, 0, 250);
}
public void quit(){
timer.cancel();
finish();
}
public void moveButton(){
Random generator = new Random();
generator.setSeed(System.currentTimeMillis());
float f = generator.nextFloat();
x = (int)(f*w)%w;
f = generator.nextFloat();
y = (int)(f*h)%h;
btn.setX(x);
btn.setY(y);
}
public void pauseOnClick(View view) {
Button pause = (Button) view;
((Button)view).setText("Resume");
timer.cancel();}
//((Button)view).setText("Pause");
//moveButton();
@Override
public void onClick(View v) {
score +=1;
lblScore.setText("Score: " + score);
}
}
|
You can add onPause and onResume methods:
@Override
public void onPause() {
}
and
@Override
public void onResume() {
}
Then put your pausing code and your resuming code in the proper section.
| 1 |
Add onPause and onResume methods
|
Esoteric Programming Languages - Acceptable or Discouraged?
|
In A Nutshell: This is a question regarding the acceptance of asking instances related to esoteric programming languages, such as:
Brain@%#!
Ook!
LOLCODE
Omgrofl
Whitespace
Historical Significance
Proof of (real-world) usage of esoteric languages lies inside the following quote:
The game Lost Kingdom won the First Annual Classic 2k Text Adventure Competition in 2004, and has been (re)written and enhanced by the original author in brain@%#!
Source: The Lost Kingdom Brain@%# Edition
This shows that esoteric programming languages can actually be used to develop real-world applications.
Actual Questions Relating To Esoteric Programming Languages
Practical COW example program?
What good is the NERFIN loop operation in LOLCODE?
brain%!@# greater sign
The Big Cookie
Now for the moment we've all been waiting for...
Are esoteric programming languages acceptable programming questions or discouraged?
|
The Big Cookie
Now for the moment we've all been waiting for...
Yes! Obscure programming languages are still programming languages, and therefore questions about them are still on topic for Stack Overflow.
The notion that we might encourage or discourage questions about a particular language or technology strikes me as an utterly nonsensical one. If the questions meet our guidelines, then they are on topic. The only encouragement we do and need to provide is to ask questions that are constructive and on topic. If yours meet those requirements, proceed as desired.
| 0.888889 |
Obscure programming languages are still programming languages for Stack Overflow
|
Making sure that you have comprehended a concept
|
Hi,
I have a question that I've been thinking about for a long time.
How can you assure yourself that you've fully comprehended a concept or the true meaning of a theorem in mathematics?
I mean how can you realize that you totally get the concept and it's time to move on to the next pages of the book you're reading?
Thanks in advance for your responses.
|
I think I understand a theorem if I can reconstruct the hypotheses remembering only the conclusion. Likewise, I think I understand a theory if the axioms all seem reasonable and obvious.
However, you can't really get this on a first reading. I usually allow myself to proceed if the proof of the theorem catches my interest enough to read the details, or seems too trivial to bother with. If I don't think I could do it but don't care to learn, then I obviously don't appreciate enough of what I have been reading to seriously try reading more.
Perhaps the ultimate test is if you can use said theorem for something.
| 1 |
I understand a theorem if I reconstruct the hypotheses remembering only the conclusion
|
Force garbage collection/compaction with malloc()
|
I have a C++ program that benchmarks various algorithms on input arrays of different length. It looks more or less like this:
# (1)
for k in range(4..20):
# (2)
input = generate 2**k random points
for variant in variants:
benchmark the following call
run variant on input array
# (3)
Is it possible to reset the whole heap management at (2) to the state it had at (1)? All memory allocated on the heap that was allocated during the program is guaranteed to be freed at (3).
I am using g++ 4.3 on Linux.
Edit: I understand that there is no real garbage collection in C/C++. I want to force the memory allocation to join adjacent empty chunks of memory it has in its free list at (2).
|
What do you mean? There is no garbage collection in C, and certainly no compaction.
To "reset the state of the heap", you have to call free() for every malloc() call. And as I understand your code, you do that already.
Compaction is pretty much impossible. Unlike higher-level languages like Java or C#, you can not change the address of an object, because any pointers to it would be invalidated.
| 1 |
Compaction in C is impossible.
|
Syntax highlighting language hints
|
Do you think it would be worthwhile to provide hints as to what language to use for the syntax highlighting?
Sometimes I find the highlighting on SQL or VB.NET answers is more distracting than helpful; for example:
Converting MySQL select to PostgreSQL
Retrieving data from a VB.NET arraylist of objects
to pick the two I've been looking at recently.
|
Scavenger's answer is a good idea, but # might be something that is valid in the code like a pre-processor command in C++ that can be part of the actual code sample.
I suggest to have something that is specified before the code block in a special way. The code block is indented with 4 spaces, so the language specifier could be indented 3 spaces (and only mean something when appearing immediately before a code block). This follows the simplicity in the markup rules that already exists.
VB.NET
Dim myVariable As String 'Here is the first code line
myVariable = "Hello world"
| 1 |
Scavenger's answer is a good idea, but # might be something that is valid in the code .
|
Twisted Fate: Do Wildcards (Q) apply the effects of Pick A Card (W)?
|
Wildcards (Q):
Twisted Fate throws 3 cards forward in an arc, dealing magic damage 60 / 110 / 160 / 210 / 260 (+ 65% AP) to enemies they pass through.
Pick a Card (W):
When first activated, cards flash over Twisted Fate's head in the following order: blue, then red, then gold (this cycle repeats itself). When he uses the ability again, he picks the current card over his head; the card picked converts his next basic attack within 6 seconds to deal magic damage and add a special effect. Twisted Fate has 6 seconds to select a card.
Do the Wildcard cards apply the same effect as the cards in Pick a Card?
|
His Q ability is simply an AoE spell that deals damage. Although the cards do occasionally change their color, there is no additional effect to it. It's just cosmetic.
| 0.666667 |
AoE spell that deals damage
|
Where is my power going?
|
We just got an overly large (several hundred dollars over normal) electric bill from the city.
Being a bit of a diy I picked up an ammeter to to track down the reason. None of my circuits are clocking in over 2 amps in normal usage. I tried powering up everything in the house including all of the major appliances.
I only came up with a total of 22 amps, absolute max draw. US standard 110V.
I did the math but I wasn't able to crack our normal $150 / month (calculated out using the local kilowatt hour pricing).
What the heck is going on? Anything more for me to do before calling the electrician?
Edit:
The meter box is mounted to the side of the house, under a overhang.
When I used the ammeter I was working off the main hot line from the meter when I powered everything up.
I did see the other diy post.
We do have central air, howeverit was a lot cooler last month vs the same time last year. The usage shouldnt have spiked, at least that much.
The price per killowatt hour is comperable to last year as well.
We generally clock in at around 1200 to 1800 kilowatt hours. Last month was a bit over 2800.
We already tried (unsuccessfully) to lodge a complaint with the electric company.
The odd thing is the variance -$150 one month and near $1000 the next, with no noticible change in utilization patterns.
|
First off, you are not billed by the city, you are billed by the electric utility. Unless you're in Canada and then I'm not sure.
In cases like this you do not call an electrician, you call the utility that billed you. They take high bill complaints very seriously, at least around here they do (NY State).
They will do what is necessary to find out what the problem is. If it does happen to be on your end they'll tell you so.
| 0.888889 |
If you are not in Canada, you are billed by the electric utility.
|
Find out my user's group name without a terminal
|
I have managed to break my X server, and am trying to attempt the solution offered in this page. I only have one user on the system, but I have no idea what its group name is, which means I can't execute the solution offered on the page.
Pressing Ctrl+Alt+F(x) just brings up a flashing white cursor, but I can't type anything. I only have Ctrl+Alt+F7 at my disposal, but unable to login and bring up a prompt with Ctrl+Alt+T.
The only access I have to a shell of any description seems to be by booting into recovery mode and dropping to the shell. However, I then don't get any response from the shell when I type users (as suggested by this page as a way to find out my groupname).
A valid answer to this question would either:
a) Allow me to find out the groupname so that I can execute the sudo chown username:groupname .Xauthority command, or
b) Provide an alternative way to fix the XServer issue, which sounds very similar to the one here.
|
In the event that you can't get a working shell from your system, you may need to boot into the installation media (CD, USB) & get a terminal from there.
If you mount your /home drive - you can do this from the desktop - then you can open a terminal, and get typing:
sudo -i
mount # This will show your drive as /dev/sda1 or similar
cd /media/ubuntu/sda1/home/you/ # or whatever it was, to get to your home directory..
chown you:you .Xauthority
In fact taking ownership of the whole directory might be useful, as chown -R you:you *
reboot
remove CD etc, & we're done. Unless I'm right & there's more :) - if you can't get a shell on your system there may well be.
| 0.888889 |
If you can't get a working shell from your system, you may need to boot into the installation media (CD, USB)
|
AntiForgeryToken versus Captcha
|
I am having some question regarding captcha and AntiForgeryToken
Do I need to use captcha if I am using AntiForgeryToken in an MVC application.
Does AntiForgeryToken prevents automated form submission?
Can I use AntiForgeryToken as an alternative to captcha?
|
To answer a bit more explicitly:
Do I need to use captcha if I am using AntiForgeryToken in an MVC
application.
If automated submissions are a problem then yes.
Does AntiForgeryToken prevents automated form submission?
No. A CSRF token basically ensures that a user visits a page (eg. the one which contains the form) before another action takes place (eg. that form was submitted). A bot could easily obtain a valid token to submit a form.
Can I use AntiForgeryToken as an alternative to captcha?
No. Arguably a CAPTCHA might be able to replace a CSRF token but a CAPTCHA probably isn't practical on every form which needs CSRF protection (eg. one in an admin panel).
| 0.888889 |
Can I use captcha as an alternative to a CSRF token?
|
How do you deal with amends from a client?
|
I'm a web designer currently working with a very demanding client.
I presented them with designs back in May and I'm still working through amends with them. They are making changes to everything and although I know amends are to be expected, it's really getting to be frustrating. I'm currently working every evening on the list of new amends they have. Tiny things like "make this blue" or "change the width of this" or "make this gap smaller".
I know amends need to be made and that's fine, but how do you handle when there are just too many? I've counted the comments on inVision and there have been 185 amends on 6 pages of a website design.
Some of them change, and then change again, and then change again and again. For example they wanted to add a strapline, so I added it, adjusted all the menus to accomodate is across the 6 pages. Then they wanted to change the text, so I changed it and updated it across all 6 documents. Now that it's changed, they want to make the menu smaller so now I have to go back and change the menu again.
I quoted based on time I thought it would take to complete the designs with some time for amends but I've more than tripled the time. I haven't explained to them early enough in the process that amends beyond the normal would cost them more so I'm going to have to swallow the cost this time, but should I lay this out better with future clients?
How do you handle amends? Do you put an estimated time on them at the beginning, and then charge more if they go over this? Or do you do something different?
|
Maybe this can help:
http://freelancing.stackexchange.com/questions/3226/project-based-freelance-project-requiring-multiple-unexpected-redos-from-clien/3337#3337.
I like to ask a lot of questions before getting started, prepare quick sketches, and split my projects in "steps"; and then each step gets approved. Once a client goes back, it's a revision that is charged.
I also explain to clients they have to provide their final texts and the images they want to use to avoid revisions.
Always be specific and yes, explain clearly the process before you get started.
But since you're already stuck with this...
When clients are back to using the html site as a "sketch zone" as your client does, stop changing the CSS and the html, and go back to using a plan or showing them a JPG of ONE page (or sections of it). Explain them that when you start doing CSS and html, it's not the time to play around and modify things (at least not menus and big changes.) You can be nice and tell them it's for their own good since the coding requires some planning and it avoids mistakes. Don't tell stuff like "it's easy", they might end up believing it's truly easy for you.
So take a screenshot of a main page, do the changes in Photoshop or Illustrator or Indesign, and show them a JPG "proof" that they will approve. Have the main layout approved first, not all 6 pages!
On your proof, add a mention about "any changes after this is approved will be charged at XX/hour". And instead of sending that proof by email, host it somewhere and send them an url; this way it will appear at 100% in their browser and they'll have a better idea of what to expect.
Personally, I like to present them 2-4 options; this way they can say they like the menu of A, the body font of B and the footer of C for example. Then I present them another set of proofs with the elements they preferred, and other options if necessary. Usually it ends up limiting the possible requests they might have because you showed them pretty much everything possible at this point! Your proofs don't need to be perfect, they're like a sketch; just do some copy/paste and move things around.
Once it's approved, you can go back to coding. If you have to come back again to "sketching" or modify your code, start charging at hourly rate.
You need to do something like this otherwise they'll keep going until december 2016 if they get all that free work from you and if you don't require them to fully approve some of your work. Right now, they're not taking any decision.
PS: I don't like using design software to do sketches of the websites, and I'm sure you don't either. It's way simpler sometimes to do it straight in CSS but... the reason why you're doing this is not so much to make it faster to do the website but to make your client feel like you're also making them go back to step 1! All they want in the end is to have their website done; when you go back to showing them JPGs, they get a bit less excited and you get back some control on the situation.
They will approve your JPGs proofs faster than the real website you're showing them because they will want to see the result "live" as soon as possible.
| 0.888889 |
How to make a client go back to a "sketch zone"?
|
Why does George Mcfly employ Biff to wax his car after he had previously tried to rape his wife?
|
In Back to the Future, Marty goes back to 1955 and devises a plan for his father George McFly to win over Lorraine in order to ensure Marty's survival.
The plan involved Marty pretending to sexually assault Lorraine then George would step in and stop him. Biff meddles with Marty's plan, by kicking Marty out of the car and then he tries to rape Lorraine. George expecting to find Marty in the car, instead finds Biff and musters the courage to stop Biff and protect Lorraine.
Near the end of the movie when Marty travels back to 1985 we see that Biff is outside of Marty's house waxing George's car. Why would George employ Biff to do this job? I can't imagine Lorraine would be too happy with the idea.
|
We're talking about a movie filmed in 1985 set in the year 1955. People's attitudes towards consent were different back then. For example, no one, at least not at the time, would say John Travolta was trying to rape Olivia Newton-John in Grease.
| 1 |
People's attitudes towards consent were different back then
|
Making integrals look prettier with negative spacing for publication
|
How should I write definite integrals for publication?
Examples:
or
or
I am not sure about how to write the limits correctly.
How should I write definite integrals for publication?
|
Let's look at some examples:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\diff}{\mathop{}\!d}
\begin{document}
\begin{gather*}
\int_{-\infty}^{+\infty} e^{-i2\pi xt}f(x)\diff x \\
\int_{-\infty}^{+\infty} \! e^{-i2\pi xt}f(x)\diff x \\
\int_{-\infty}^{+\infty} \! \! e^{-i2\pi xt}f(x)\diff x \\
\int_{-\infty}^{+\infty} \! \! \! e^{-i2\pi xt}f(x)\diff x \\
\int_{-\infty}^{+\infty} \! \! \! \! e^{-i2\pi xt}f(x)\diff x
\end{gather*}
\end{document}
The first and the second lines seem right; perhaps, due to the low ‘e’ a negative shift is good, so the second line could be preferred.
In no case should the integrand go below the integration bounds. So, starting from the third line the result are on the worse side.
| 0.777778 |
documentclassarticle newcommanddiffmathop!d
|
What's the first physics textbook for undergraduate self-learner?
|
I am kind of studying physics on my own now.
I choose University Physics (13th Edition) for myself,is it fine?
I am also studying Calculus using Thomas' textbook.
http://www.amazon.com/University-Physics-13th-Edition-Young/dp/0321696891/ref=sr_1_1?ie=UTF8&qid=1352260382&sr=8-1&keywords=university+physics+13th+edition
|
Resnick/Halliday/Walker is a great book for undergraduates for self learning
| 1 |
Resnick/Halliday/Walker is a great book for undergraduates for self learning
|
Where is Diagnostics & Usage Data stored on iOS?
|
Since I've installed a few jailbreak tweaks, my iPhone has been crashing fairly regularly and I would like to know exactly what's causing it.
Does anyone know the direct path to where the crash logs/reports are stored on the device (/var/mobile/, for example)? This way I can clear all current logs, to start afresh, and I can extract them for viewing on a bigger screen, etc. Or does anyone know of a more advanced way to interact with and analyse the iPhone's Diagnostics & Usage data, in general?
Thanks
|
The official logs and crash logs in on the path
/var/mobile/Library/Logs.
You can also download syslog. And get his logs from /var/syslog
| 0.888889 |
Logs from /var/mobile/Library/Logs
|
Computing best subset of predictors for linear regression
|
For the selection of predictors in multivariate linear regression with $p$ suitable predictors, what methods are available to find an 'optimal' subset of the predictors without explicitly testing all $2^p$ subsets? In 'Applied Survival Analysis,' Hosmer & Lemeshow make reference to Kuk's method, but I cannot find the original paper. Can anyone describe this method, or, even better, a more modern technique? One may assume normally distributed errors.
|
What I learned it that firstly use Best Subsets Approach as a screening tool, then the stepwise selection procedures can help you finally decide which models might be best subset models (at this time the number of those models is pretty small to handle). If one of the models meets the model conditions, does a good job of summarizing the trend in the data, and most importantly allows you to answer your research question, then congrats your job is done.
| 0.777778 |
Best Subsets Approach is a screening tool .
|
Linux: limits.conf values are not honored
|
I set some values in /etc/security/limits.conf as below:
* hard stack 204800
* hard nofile 8192
Then rebooted the server. Also I have removed the file /etc/security/limits.d/90-nproc.conf
However, the ulimit command still lists some old/default values:
# ulimit -s
10240
# ulimit -n
1024
I running RHEL 6.2 64-bit
What is wrong here? Is my syntax in limits.conf wrong? Why after server reboot it does not honor limits.conf values?
BTW, I had posted this question earlier on superuser but failed to get the hits, so trying my luck on serverfault.
|
You are changing hard limit values and querying soft limit values. Everything is working fine. Use ulimit -H to view hard limits.
| 1 |
ulimit -H to view hard limit values
|
Does Raspberry Pi 2 support RTOS?
|
did somone have the knowdlege is new Raspberry Pi 2 is compatibile with Xenomai RTOS?
In old version (Raspberry 1) that was a path which make berry to work with Xenomai.
I was started reading about second version about possibility to port old application written for Raspberry 1 with Xenomai to v.2.
|
Looks to me like Xenomai is meant to be source built. So you should be able to do this.
Someone evidently has precompiled binaries for the regular pi. The only issue with this will be the kernel: the old armv6 userland will work on the pi 2, but you still need a different kernel for it.
But while armv6 code will run on the pi 2, as noted here (see "How much faster is it?"), if you want to realize the full potential of the new cores, you need stuff that was compiled for armv7 (which will not run on the old pi).
You probably want to cross-compile, since the pi 2 is still really slow compared to a normal desktop. Fortunately, ready made x86 -> armv7 tool chains are much easier to find than armv6 ones.
If the instructions on the Xenomai site aren't enough, here's a decent looking guide to building a Xenomai system with a raspbian userspace. Note again though that this means using slower armv6 user land binaries (there is no armv7 raspbian currently, just the armv6 one with an armv7 kernel) -- however it might provide a simple starting point for you to get a kernel running, and then you can tackle building the userland properly as a second stage.
| 0.777778 |
Build a Xenomai system with a raspbian userspace
|
Extract text between two slashes and add it at the end of the line after a tab character
|
I have a text file looking like this:
data/CON/001/raw_series_ST_MC_REG_SM.nii
data/PAT/001/raw_series_ST_MC_REG_SM.nii
I would like to achieve something like this:
data/CON/001/raw_series_ST_MC_REG_SM.nii TAB CON
data/PAT/001/raw_series_ST_MC_REG_SM.nii TAB PAT
Of course tab in the means of space.
Thx for the help!
|
Here are a few choices:
awk '{split($0, a, /\//); print $0 "\t" a[2]}' file
awk -F/ -v OFS="\t" '{print $0, $2}' file
sed -r 's#^([^/]*/([^/]*)/.*)#\1\t\2#' file
sed 's#^\([^/]*/\([^/]*\)/.*\)#\1\t\2#' file
sed 'p; s#[^/]*/##; s#/.*##' file | paste - -
perl -F/ -lane 'print "$_\t$F[1]"' file
| 0.777778 |
awk 'split($0, a, ////); print $0 "
|
Correct use of arguments pattern in pgfkeys/append after command in tikz?
|
I could not find many examples for the correct use of arguments patterns in pgfkes, but I was able to come up with the following:
\documentclass{standalone}
\usepackage{tikz}
\tikzset{dimen/.style={<->,>=latex,thin,
every rectangle node/.style={fill=white,midway}
}}
\tikzset{measuring south/.style args={from #1 to #2 is #3}{
append after command={
draw (#1.south west) -- ++(0,-1.0)
coordinate (A1) -- ++(0,-10pt)
(#2.south east) -- ++(0,-1.0) coordinate (A2) -- ++(0,-10pt)
[dimen] (A1) -- (A2) node {#3}
}
}
}
\begin{document}
\begin{tikzpicture}
\node(a) [draw,rectangle,text=teal] at (0,0) {here};
\node(b) [draw,rectangle,text=olive] at (3,0) {there};
\path[measuring south=from here to there is far,fill=red];
\node(x) [draw,rectangle,text=blue] at (0,-2) {Heaven};
\node(y) [draw,rectangle,text=red] at (3,-2) {Hell};
\draw (x.south west) -- ++(0,-1.0)
coordinate (A1) -- ++(0,-10pt)
(y.south east) -- ++(0,-1.0) coordinate (A2) -- ++(0,-10pt)
[dimen] (A1) -- (A2) node {sin};
\end{tikzpicture}
\end{document}
In my output, I would have liked to see the dimension lines from "here" to "there", but these are not visible.
|
From the TikZ/PGF manual (emphasis added):
Some of the path commands described in the following sections take optional arguments. For these
commands, when you use this key inside these options, the path will be inserted after the path
command is done.
The key here is the "some". The append after command needs a command to be appended after. Things that work are node, edge, to, and likewise. Your \path has no commands and so there is no chance of the append after command being executed. What you want here is the insert path key which sticks in the path at that point. Once you change that, then you get some output but you also find a few other (small) errors: you didn't name the nodes here and there, the fill=red command is a little odd, and the draw needs to be in brackets to be interpreted as a style.
\documentclass{article}
%\url{http://tex.stackexchange.com/q/154155/86}
\usepackage{tikz}
\tikzset{dimen/.style={<->,>=latex,thin,
every rectangle node/.style={fill=white,midway}
}}
\tikzset{measuring south/.style args={from #1 to #2 is #3}{
insert path={
[draw] (#1.south west) -- ++(0,-1.0)
coordinate (A1) -- ++(0,-10pt)
(#2.south east) -- ++(0,-1.0) coordinate (A2) -- ++(0,-10pt)
[dimen] (A1) -- (A2) node {#3}
}
}
}
\begin{document}
\begin{tikzpicture}
\node(a) [draw,rectangle,text=teal] at (0,0) (here) {here};
\node(b) [draw,rectangle,text=olive] at (3,0) (there) {there};
\path[measuring south=from here to there is far];
\node(x) [draw,rectangle,text=blue] at (0,-2) {Heaven};
\node(y) [draw,rectangle,text=red] at (3,-2) {Hell};
\draw (x.south west) -- ++(0,-1.0)
coordinate (A1) -- ++(0,-10pt)
(y.south east) -- ++(0,-1.0) coordinate (A2) -- ++(0,-10pt)
[dimen] (A1) -- (A2) node {sin};
\end{tikzpicture}
\end{document}
| 0.777778 |
Insert path key which sticks in path after command
|
Does the Canon *.CR2/CRW format contain "truly RAW" data?
|
In my work I am dealing with *.CR2 raw images taken by a Canon DSLR in raw mode.
When I read about the format here, I was surprised to find that it has 4 TIFF IFDs which contain a) Original Size JPEG Image b) Thumbnail JPEG image c) Uncompressed RGB data d) Lossless JPEG image.
My impression until now was any camera captured RAW image file would have Raw Bayer Data i.e. R,Gr,B,Gb kind of bayer data, and some EXIF data about camera capture settings etc.
But after reading this CR2 specification I am slightly confused as to how can it have a RGB data or even surprisingly JPEG data. This seems to be the data after demosaicing(obtaining the missing R/G/B pixel data for the original sensor Bayer pattern). If thats the case I would not consider *.CR2 as "truly raw" data. It has done demosaicing before dumping the socalled raw file.
Am I missing something?
Does any other Camera Raw formats(e.g. Nikon - *.NEF, Kodac - *.kdc, Pentax - *.ptx/pef,...) have real raw bayer data without any processing done?
|
The DNG contains Lossless grayscale JPG with resolution 4 times higher than "normal" color jpg file. Is it more clear now?
What is the problem in placing 3 types of black balls in a basked that is meant to hold 3 colored balls?
In the JPG file there are no colors, there are just numbers, as in any other file format. And they use JPG because it is easier to encode it in this way, because the camera processor is already made to create such files.
They would probably write the matrix data into zip, rar, flac, or any other lossless format pretty much the same way. But that would require a bunch of algorithms added into the software of the camera, that are not needed.
| 0.888889 |
What is the problem in placing 3 types of black balls in a basked that is meant to hold 3 colored balls?
|
Meteor renderList intercept? client side
|
I have chat messages displayed like this:
{{#each msg}}
{{> chatMsg}}
{{/each}}
When users enter the chat I add a document to the collection with user joins the chat. When a user rapidly reenters and leaves the chat I don't want to duplicate user joins the chat over and over again. I want to display something like user joins the chat x3.
Is there a way to do this on the client side by hooking into renderList? I know I can change the doc on the server side but it seems unnecessarily intensive.
|
The easiest way to get there from here is to write a custom publisher. Instead of just returning a cursor from your publish function, call observe() on your cursor within the publish function, and do the appropriate set(), unset(), and flush() calls within that, that do the appropriate multiplying a previous message instead of adding a new one. You can find the relevant documentation at the meteor documentation for Meteor.publish
To get a basis from comparison, you can look at the current code to publish a Cursor, which is in packages/mongo-livedata/mongo_driver.js, in Cursor.prototype._publishCursor.
Note: My answer here is for Meteor 0.5.2. The API for custom publishers is going to be changing in a future release of Meteor, and there will be different functions you have to call than set() unset() and flush()
| 1 |
How to write a custom publisher in Meteor?
|
Postgres multiple columns to json
|
I am running postgresql 9.3.4. I have a table with 3 fields:
id name addr
--- ---- ----
1 n1 ad1
2 n2 ad2
...
I need to move the data to a new table with fields like:
id data
--- ----
1 {'name': 'n1', 'addr': 'ad1'}
2 {'name': 'n2', 'addr': 'ad2'}
...
row_to_json is not the solution for me as SELECT t.id, row_to_json(t) as data FROM (select id, name, addr from myt) t adds id to the result as well. Is there a way to choose the fields I need (name & addr) in my data field?
|
I found the answer from this link:
select * from (
select id,
(
select row_to_json(d)
from (
select name, addr
from myt d
where d.id=s.id
) d
) as data
from myt s
)
| 0.888889 |
Select * from ( select id, ( select row_to_json(d) ) as data from myt s
|
Tomcat uses BASIC auth instead of FORM auth
|
I've run into a very weird problem with Tomcat: My Webapp running on Tomcat 6 works just fine with BASIC auth. However I would like to switch to FORM based auth. But when I change my web.xml from:
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>my realm</realm-name>
</login-config>
to this here
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/loginfail.html</form-error-page>
</form-login-config>
<realm-name>my realm</realm-name>
</login-config>
Tomcat still uses BASIC auth.
Both login files exist.
There are no errors in catalina.err/out.
Leaving out the realm element makes the browser show "Authentication
required" instead of the realm name (still uses BASIC)
Are there any conditions under which FORM based auth is not being used?
|
It seems that reloading the webapp was not enough in my case.
After restarting tomcat by FORM Authentication is being used.
ADD: FORM authentication is using a different digest algorithm than BASIC/DIGEST. Hence my old user auth database is not reusable. But this is a different topic. :)
| 0.888889 |
FORM authentication is using a different digest algorithm than BASIC/DIGEST
|
How can I export only text with a distinctive character style from InDesign to a new document?
|
I had a catalog layout with 200 captions. They all have the same distinctive character style. I am searching for a solution to export only these caption texts with the distinct character style out of InDesign in a new document as for example, an RTF text. The format doesn't matter. It's more important to have only the captions out of the whole catalog.
|
Edit: Even though you seem to mention it multiple times, it just dawned on me that you were talking about character styles and not paragraph styles... :(
I'm just going to leave this here anyways.
You could do this with table of contents.
You can make table contents by using paragraph styles as the "hook".
Layout > Table of contents...
Here I pretty much touched only those options that I've explained in the image.
Click here for a bigger image
...and when you click OK, it will create me a nice list of all the text with the specified "yay" paragraph style in it:
The rest should be simple.
If you make text changes to your document, you can update the TOC by first selecting the table of contents text block and then selecting Layout > Update table of contents...
| 1 |
Layout > Table of contents
|
Can't ping host in OpenVPN Site-to-Site VPN
|
My logs say that a connection has been established but I cant ping the host.
Here are my logs.
Firewall 1 Logs:
May 24 10:42:57 openvpn[9163]: /etc/rc.filter_configure tun0 1500 1544 10.0.8.1 10.0.8.2 init
May 24 10:42:57 openvpn[9163]: SIGTERM[hard,] received, process exiting
May 24 10:42:59 openvpn[9742]: OpenVPN 2.0.6 i386-portbld-freebsd7.2 [SSL] [LZO] built on Dec 4 2009
May 24 10:42:59 openvpn[9742]: WARNING: file '/var/etc/openvpn_server0.key' is group or others accessible
May 24 10:42:59 openvpn[9742]: gw 112.202.0.1
May 24 10:42:59 openvpn[9742]: TUN/TAP device /dev/tun0 opened
May 24 10:42:59 openvpn[9742]: /sbin/ifconfig tun0 10.0.8.1 10.0.8.2 mtu 1500 netmask 255.255.255.255 up
May 24 10:42:59 openvpn[9742]: /etc/rc.filter_configure tun0 1500 1544 10.0.8.1 10.0.8.2 init
May 24 10:43:00 openvpn[9757]: Listening for incoming TCP connection on [undef]:1194
May 24 10:43:00 openvpn[9757]: TCPv4_SERVER link local (bound): [undef]:1194
May 24 10:43:00 openvpn[9757]: TCPv4_SERVER link remote: [undef]
May 24 10:43:00 openvpn[9757]: Initialization Sequence Completed
May 24 10:43:02 openvpn[9757]: Re-using SSL/TLS context
May 24 10:43:02 openvpn[9757]: LZO compression initialized
May 24 10:43:02 openvpn[9757]: TCP connection established with 119.93.150.4:47750
May 24 10:43:02 openvpn[9757]: TCPv4_SERVER link local: [undef]
May 24 10:43:02 openvpn[9757]: TCPv4_SERVER link remote: 119.93.150.4:47750
May 24 10:43:06 openvpn[9757]: 119.93.150.4:47750 [client] Peer Connection Initiated with 119.93.150.4:47750
Firewall 2 Logs:
May 24 10:42:57 openvpn[7489]: Connection reset, restarting [0]
May 24 10:42:57 openvpn[7489]: SIGUSR1[soft,connection-reset] received, process restarting
May 24 10:43:02 openvpn[7489]: WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
May 24 10:43:02 openvpn[7489]: Re-using SSL/TLS context
May 24 10:43:02 openvpn[7489]: LZO compression initialized
May 24 10:43:02 openvpn[7489]: Attempting to establish TCP connection with 112.202.103.45:1194
May 24 10:43:02 openvpn[7489]: TCP connection established with 112.202.103.45:1194
May 24 10:43:02 openvpn[7489]: TCPv4_CLIENT link local: [undef]
May 24 10:43:02 openvpn[7489]: TCPv4_CLIENT link remote: 112.202.103.45:1194
May 24 10:43:06 openvpn[7489]: [server] Peer Connection Initiated with 112.202.103.45:1194
May 24 10:43:08 openvpn[7489]: Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:1: 112.202.103.45 (2.0.6)
May 24 10:43:08 openvpn[7489]: Preserving previous TUN/TAP instance: tun0
May 24 10:43:08 openvpn[7489]: Initialization Sequence Completed
What could the problem be?
|
It appears that even though you seem to have a "push" option in the config file for firewall2, there is a syntactical problem with it:
May 24 10:43:08 openvpn[7489]: Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:1: 112.202.103.45 (2.0.6)
Once this is fixed, you should have routing through the tunnel, which will give firewall2 access to machines on the other end of the tunnel.
| 0.333333 |
"push" option in firewall2 config file
|
Place a figure at the beginning/end of a specific page
|
So I'm putting together a paper using LaTeX and I know that I want to place a specific figure at the bottom of page 1, another figure at the top of page 2, etc, and let the text just wrap around the figures.
However, I find that if I try something like \begin{figure}[b], it places the image not at the end of the current page, but rather at the end of the entire document. Is there no way to just say, "this figure goes at the bottom of the first page"?
|
[!b] probably works if the figure fits The ! tells latex to ignore numeric constraints. As you didn't supply an example I'm having to guess but maybe your class is inhibiting floats on the first page (the standard classes only inhibit top floats) ! would over-rule this. Also of course make sure that the figure appears early enough in the source.
| 0.888889 |
The ! tells latex to ignore numeric constraints
|
Change visa card type without changing number
|
Is it generally possible to change a credit card from one "specialty" to another, without changing the credit card number or expiry date?
For example, is it possible to switch from a TD Drivers Rewards Visa card to a TD Platinum Travel Visa card? Or, if TD Bank doesn't allow this, would you generally expect banks to allow this sort of change?
Obviously, you cannot change from a visa card to a mastercard; this necessarily would involve changing the credit card number. Also, for the sake of this academic exercise, assume the person switching would qualify for the new card.
|
Every Card type comes with its set of reward and other features.
Today the systems that are in Bank are not geared up to change the type and keep the card number same. The reason being that for newer transactions they can still do it, however the historical transactions will become a mess, for example the rewards points calculated using older card type etc.
Hence its easier for Banks to issue a new card number, close out the old number and transfer whatever is the balance. This is more clearner and easier for existing card Systems in Banks.
Across Banks its just not possible for lot more reasons
| 0.888889 |
Card types are not geared up to change the type and keep the card number same .
|
On the singularity $r=0$ of the Schwarzschild metric
|
I faced following sentences:
Unlike the co-ordinate singularity at $r = 2M$, the origin of the Schwarzschild metric $r = 0$ has a true curvature singularity. It was first believed that this singularity was an artifact of spherical symmetry and that a generic collapse would evade the singularity. However, work by Hawking and Penrose showed that this was not so and that singularities were generic rather than special. The ubiquity of singularities is guaranteed by the singularity theorems by Hawking and Penrose.
Question1: What is the meaning of "generic collapse"?
Question2: When is a singularity an artifact of spherical symmetry?
|
In addition to Danu's answer, it is worth mentioning that there is another class of solutions in GR which arise as the artifacts of special symmetry: naked sigularities (that is, singularities without event horizons).
The cosmic censorship hypothesis states that for a 'reasonable' matter, dynamical evolution from generic initial conditions can never produce a naked singularity.
Nevertheless, there exist solutions in which the collapse of matter results in the formation of naked singularities. It's just the initial conditions for such solutions are 'special', often possessing high degree of symmetry (such as spherical symmetry), and thus would likely could not be realized in reality.
Interestingly, the existence of such naked singularities was the subject of a bet between S. Hawking and J. Preskill/K. Thorne. Hawking conceded the original version of the bet "on technicalities" accepting that naked singularities can form under very special "nongeneric" conditions, and proposed a new version, which is still open.
| 0.888889 |
S. Hawking and J. Preskill/K. Thorne bet naked singularities
|
Change of basis in non-linear Schrodinger equation
|
At the mean-field level, the dynamics of a polariton condensate can be described by a type of nonlinear Schrodinger equation (Gross-Pitaevskii-type), for a classical (complex-number) wavefunction $\psi_{LP}$. Its form in momentum space reads:
\begin{multline}
i \frac{d}{dt}\psi_{LP}(k) =\left[\epsilon(k)
-i\frac{\gamma(k)}{2}\right] \psi_{LP}(k)
+F_{p}(k)\,\, e^{-i\omega_{p}t} \\
+ \sum_{q_1,q_2} g_{k,q_1,q_2}\, \psi^{\star}_{LP}(q_1+q_2-k)
\, \psi_{LP}(q_1)\, \psi_{LP}(q_2).
\end{multline}
The function $\epsilon(k)$ is the dispersion of the particles (polaritons). The polaritons are a non-equilibrium system, due to their finite lifetime (damping rate $\gamma$). Therefore, they need continuous pumping with amplitude $F_p$ at energy $\omega_p$.
Finally, there exists a momentum-dependent nonlinear interaction $g_{k,q_1,q_2}$ that depends of the so-called Hopfield coefficients $X$ (simple functions of momentum) as:
\begin{equation}
g_{k,q_1,q_2}=g\, X^{\star}(k)\, X^{\star}(q_1+q_2-k)\, X(q_1)\, X(q_2)
\end{equation}
How can one transform the equation for $\psi$ to real-space?
|
Here is my attempt at an answer, following the suggestion of @Lagerbaer. We first subtitute the Fourier Transform for $\psi_{LP}(k)$,
\begin{equation}
\psi_{LP}(k)=\int dxe^{-ikx}\psi_{LP}(x),
\end{equation}
and get
\begin{multline}
\int dxe^{-ikx}i\frac{d}{dt}\psi_{LP}(x)=\int dx\left[\epsilon(k)-i\frac{\gamma(k)}{2}\right]e^{-ikx}\psi_{LP}(x)\\+F_{p}(k)\,\, e^{-i\omega_{p}t}
+\int dx_{3}dx_{1}dx_{2}\\ \times \sum_{q_{1},q_{2}}g_{k,q_{1},q_{2}}\, e^{i(q_{1}+q_{2}-k)x_{3}}\psi_{LP}^{\star}(x_{3})\, e^{-iq_{1}x_{1}}\psi_{LP}(x_{1})\, e^{-iq_{2}x_{2}}\psi_{LP}(x_{2}).
\end{multline}
In order to simplify this expression, we need to apply the inverse transform to both sides (multiply by $\int dke^{ikx}$), obtaining
\begin{multline}
i\frac{d}{dt}\psi_{LP}(x)=\int dx^{\prime}\psi_{LP}(x^{\prime})\int dk\left[\epsilon(k)-i\frac{\gamma(k)}{2}\right]e^{ik(x-x^{\prime})}+F_{p}e^{i(k_{p}x-\omega_{p}t)}\\
+\int dke^{ikx}\int dx_{3}dx_{1}dx_{2}\\
\times\sum_{q_{1},q_{2}}g_{k,q_{1},q_{2}}\, e^{i(q_{1}+q_{2}-k)x_{3}}\psi_{LP}^{\star}(x_{3})\, e^{-iq_{1}x_{1}}\psi_{LP}(x_{1})\, e^{-iq_{2}x_{2}}\psi_{LP}(x_{2}).
\end{multline}
Now we look at an integral of the form $\int dx^{\prime}\psi_{LP}(x^{\prime})\int dkf(k)e^{ik(x-x^{\prime})}$, for a generic function $f(k)$. We expand our generic function in a Taylor Series around $k=0$, and get:
\begin{equation}
\sum_{n=0}^{\infty}\frac{f^{(n)}(0)}{n!}\int dx^{\prime}\psi_{LP}(x^{\prime})\int dkk^{n}e^{ik(x-x^{\prime})}=\sum_{n=0}^{\infty}\frac{f^{(n)}(0)}{n!}\left(-i\right)^{n}\int dx^{\prime}\psi_{LP}(x^{\prime})\partial_{x}^{n}\delta(x-x^{\prime})
\end{equation}
where we have used the well-known relation $\int dkk{}^{n}e^{ik(x-x^{\prime})}=\left(-i\right)^{n}\partial_{x}^{n}\delta(x-x^{\prime})$.
Moving the derivative operator to act on $\psi$ (integration by parts), we finally obtain
\begin{equation}
\int dx^{\prime}\psi_{LP}(x^{\prime})\int dkf(k)e^{ik(x-x^{\prime})}=\sum_{n=0}^{\infty}\frac{f^{(n)}(0)}{n!}(i\partial_{x})^{n}\psi_{LP}(x)=f(i\partial_{x})\psi_{LP}(x)
\end{equation}
Therefore, the first term on the RHS of our equation simplifies to $\left[\epsilon(i\partial_{x})-i\frac{\gamma(i\partial_{x})}{2}\right]\psi_{LP}(x)$ and we are left dealing with the interaction term.
\begin{equation}
\int dx_{3}\psi_{LP}^{\star}(x_{3})\int dx_{1}\psi_{LP}(x_{1})\int dq_{1}e^{iq_{1}(x_{3}-x_{1})}\int dx_{2}\psi_{LP}(x_{2})\int dq_{2}e^{iq_{2}(x_{3}-x_{2})}\int dkg(k,q_{1},q_{2})e^{ik(x-x_{3})}
\end{equation}
Substituting the form of $g(k,q_{1},q_{2})$, we get
\begin{equation}
g\int dx_{3}\psi_{LP}^{\star}(x_{3})\int dx_{1}\psi_{LP}(x_{1})\int dq_{1}X(q_{1})e^{iq_{1}(x_{3}-x_{1})}\int dx_{2}\psi_{LP}(x_{2})\int dq_{2}X(q_{2})e^{iq_{2}(x_{3}-x_{2})}\int dk\, X^{\star}(k)\, X^{\star}(q_{1}+q_{2}-k)\, e^{ik(x-x_{3})}
\end{equation}
And here is where I got stuck..
| 0.833333 |
beginequation int dxprimepsi_LP(
|
Adjustable sample size in clinical trial
|
Most clinical trials I see have a fixed sample size. In some cases they have prior data that allows estimating the effect size and the variance or distribution of values, and calculate the sample size from that for a certain power. In other cases it is just a guess.
Why wouldn't people run a clinical trial in which the sample size was determined during the trial? (for example, by increasing it until the confidence interval narrowed to a certain size specified in advance) Is there any reason this would not be a valid design? Are there any examples of trials like that, and any references for designing a trial like that?
|
I think AdamO's answer is great, but I think it's also worth emphasizing out that this adaptive sample size design is how many (maybe even most? I've done theoretical work during internships at pharm companies, but can't say I've ever planned a real study...) clinical trials are run.
That is to say, if a sequential design is used, initial patients are recruited and treated. Part way through the study, the currently collected data gets analyzed. Three possible actions can occur at this point: the data may show a statistically significant result and the study will be stopped because efficacy has been demonstrated, the data many statistically significantly show that there is no strong effect (for example, the upper end of the confidence interval is below some clinically significant threshold) and the study is stopped due to futility or the data is not yet conclusive (i.e. both a clinically significant effect and a clinically insignificant effect are contained in the confidence interval) in which more data will be collected. So you can see that in this case, the sample size is not fixed.
An important note about this: you can't just run a standard test each time you "check" your data, otherwise you are doing multiple comparisons! Because the test statistics at different times should be positively correlated, it's not as big an issue as standard multiple comparison issues, but it still should be addressed for proper inference. Clinical trials, being regulated by the FDA, must state a plan for how they will address this (as @AdamO points out, SeqTrial provides software for this). However, often times academic researchers, not being regulated by the FDA, will continue to collect data until they find significance without adjusting for the fact that they are doing several comparisons. It's not the biggest abuse of statistical practice in research, but it still is an abuse.
| 0.777778 |
How many patients are recruited and treated in a clinical trial?
|
pfSense with two WANs, routing Skype traffic over a specific WAN
|
I have a pfSense setup with two WANs (WAN1 and WAN2) and one LAN network. The two WANs are setup for failover.
However, QoS has recently been an issue for Skype calls in our office (about 30 people) so we want to dedicate WAN2 for Skype traffic (we use Skype for all VOIP calls, etc.)
As Skype is notoriously difficult to deal with, does anyone have any suggestions on how I should deal with this? A simple rule based on ports will not work, and using layer 7 inspection with a Skype profile on all incoming LAN packets doesn't seem like the way to go either. Here is a related pfSense forum post: Multi-WAN, single LAN; Route VOIP/Skype traffic over one WAN
|
From what I understand, the only traffic shaping library that successfully classifies Skype traffic is nDPI which is included with nTop. http://www.ntop.org/products/ndpi/
How can this interface with pfSense? I'm not sure, but they're both open-source projects, so perhaps you can convince one to work with the other through a bounty!
| 0.777778 |
How to classify Skype traffic with nDPI?
|
Manually adding 's' to 'http'
|
I did a Wireshark capture of my login into a drupal-based website. The website does not use https. And so, quite obviously, I was able to capture my username and password in plain text by simply using the http.request.method==POST filter in Wireshark.
Then, I tried to access the same web page by manually adding a s to http in the url. Quite naturally, my browser showed this:
Then I went ahead and did my login again, and did the Wireshark capture again.
To my surprise, I do not have the any captures corresponding to the http.request.method==POST filter.
So, my questions:
When I am not really using https, why wasn't I able to capture login id and password in plain text?
What effect did manually adding s to http have?
|
That your browser crosses out the https and turns it red, is because the server could not be verified. You might be talking to an attacker's server as well as your own because you don't have a trusted certificate.
However, that the server is not verified does not mean it doesn't encrypt the connection. All traffic is still encrypted, only the browser can't make sure the "password" sent to him by the server (a.k.a. the "public key") was really from your server. When you try to use https and the browser can't setup an encrypted channel, it would simply have rejected connecting, giving you one of the errors @ewanm89 mentioned.
So Wireshark has no idea what's going on over this https connection. Because it's port 443, Wireshark can do a guess that it's encrypted HTTP traffic, but it can't actually tell.
To learn more about SSL (the technique behind https), see this question: How does SSL work?
| 0.888889 |
How does SSL work?
|
HDMI -> VGA idle power?
|
I have a HDMI -> VGA cable for my Pi that works well when I want to use it.
The cable stays slightly warm even when not in use, but connected - I would like to know if it's possible to "shut down" power to the HDMI port if/when there is no activity - like a computer going to sleep (does the Pi sleep? - I usually just turn off the monitor) - or does the cable draw power from the VGA side via the turned-off (but not unplugged) monitor?
I am running raspbian in CLI mode, no GUI, so some of the screen-saver settings/graphics may not apply or be available to me.
|
Unfortunately not, 5v is connected directly to the HDMI port and there is no way to toggle that power supply.
If you were desperate to this you could cut the 5V PCB trace and make your own switch, using a transistor and GPIO pin. But that will void any warranties.
| 0.777778 |
5v is connected directly to the HDMI port
|
Why are the ringwraiths fearful of coming in contact with water?
|
At least twice in LoTR:FotR, ringwraiths cower away from bodies of water. The second time (the ford of Bruinen) can be explained away by their fear of some Elvish magical trap through the enchantment of the water; but what about the first time, at the ferry? One of the Nazgul could have easily made the jump onto the barge and quickly dispatched those pesky Hobitsses.
|
It is common in folklore for evil or "unnatural" creatures to be unable to cross running water. For example, this is a traditional attribute of vampires: http://en.wikipedia.org/wiki/Vampire
Tolkien himself noted that this idea was difficult to sustain for the Ringwraiths. In particular, they would have had to cross the river Greyflood (which had no bridge or ferry) in order to travel from Mordor to the Shire. (I don't have the citation to hand, it may have been in Unfinished Tales.) He seems to have gone ahead with it anyway, in order to emphasise that the Ringwraiths were inhuman, undead creatures.
| 1 |
It is common for evil or "unnatural" creatures to be unable to cross running water
|
execute a batch file on remote machine
|
I'm trying to execute a batch file(shutdown.bat and startup.bat of tomcat 7) on a remote machine(Windows server 2008) using PSTools but didn't got any luck till now.
Below are the steps I used
c:\>psexec \\129.12.3.1 -u Admin -p admin90 C:\>Hyp\tom7_50080\bin\shutdown.bat
and on my cmd i got
PsExec v2.0 - Execute processes remotely
Copyright (C) 2001-2013 Mark Russinovich
Sysinternals - www.sysinternals.com
PsExec could not start cmd on 129.12.3.1:
There are currently no logon servers available to service the logon request.
Can anyone help with the above output and with the batch file for executing the shutdown and startup batch file on remote machine.
Is PS Tools only option to execute any service/batch file on remote machine or we could use any other utility provided by MS.
|
In you example, @David Candy pointed out even you had the connection go thru, it would not work as you have 'c:>hyp\' instead of C:\hyp\tom7_*
You seem to be using IP, but the message you got seems to be name resolution related, so not sure what's happening there. Maybe you should upgrade to the latest PsExec version.
If you want to use PowerShell you would use Invoke-Command -ComputerName {NameOfPC} -ScriptBlock {C:\Hyp\tom7_50080\bin\shutdown.bat}
| 0.888889 |
PowerShell -ComputerName NameOfPC -ScriptBlockC:Hyp
|
jQuery - Adding a hyphen inside string
|
I am pulling the text from a select box's options. Now I pass this string value to an append() function, but I want to add a hyphen to the string, for calling an image name:
HTML:
<select>
<option>Demo Cars</option>
<option>New Cars</option>
<option>Used Cars</option>
<option>Other</option>
</select>
var p = 'http://myurl.com/images/';
$('select').eq(0).on('change',function(){
$('#productQuote').empty();
var j = $(this).children(':selected').val();
$('#productQuote').append('<img src="'+ p + j + '.jpg' '" />');
});
For example:
If I choose the first select option, the string will be: "Demo Cars", and thus, j == "Demo Cars".
But now I want to call its image, and my image names are not allowed to have spaces inside them.
So, this begs the question, how do I add a hyphen between Demo and Cars?
|
Please refer
http://jsfiddle.net/2dJAN/6/
<div class="btn-post">button text</div>
<div id='test'> </div>
$(document).ready(function(){
$('#test').html($('.btn-post').text().replace(" ", "-"));
});
I hope this will helpful to you to achieve your request.
| 1 |
<div class="btn-post">button text
|
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");
}
|
You say:
FYI -(void)startServer is in another class called "Server" and I have made "server" a pointer to that said class.
If I read that right, your server variable is actually pointing to a class, like so:
Class server = [Server class];
...
NSLog(@"begin");
[server startServer];
NSLog(@"end");
If that is the case, then your startServer method would have to be a class method:
+ (void)startServer {
NSLog(@"hello!");
}
If that is not the case, can you please post a little bit more code? Specifically, the part where you assign to that server variable would be helpful.
| 0.888889 |
"server" is in another class called "Server"
|
What does “yo-ho-ho” mean?
|
The pirate song “Fifteen Men on a Dead Man’s Chest” from Treasure Island contains the expression yo-ho-ho.
Fifteen men on the dead man’s chest—
Yo-ho-ho, and a bottle of rum!
Drink and the devil had done for the rest—
Yo-ho-ho, and a bottle of rum!
Does this signify laughter, a piratical variation of ho-ho-ho? It doesn’t seem like an amusing little ditty but then pirates probably would have a dark sense of humour. Or is it simply a more piratey song filler than na-na-na?
|
Accordin’ to yon pirate page, yo-ho-ho indeed be pirate laughter.
But there be also another source claimin’ that ’tis merely a scallywag’s variant of yo-heave-ho, the chant that all good sea-farin’ folk use to keep their rhythm when haulin’ cannon to the scuppers.
Seems ’tis likely yo-ho-ho be used to maintain the rhythm in yer fine sea chantey as well. When ye shipmates sing out yo, yer all be givin’ yon rope a hearty pull.
| 1 |
'tis merely a scallywag's variant of yo-heave-ho, the
|
Why does my 24VDC fan draw much less current than labeled?
|
I have three Delta PFB0824UHE, which were provided to me by a customer for a project. They are labeled 0.93A.
When actually hooked up to 24V, the fan draws .45A, regardless of head pressure. This current varies linearly with input voltage, going as low as .2A and as high as .5A across the fan's spec'd input voltage range. I have three units, which all behave the same.
The datasheets I find for this part indicate a current draw of 0.77A.
I’m confused as to how much current I should actually expect this fan to draw. Do fan manufacturers typically allow that much overhead in their specs? Are they subject to manufacturing variations to that degree? Do I perhaps have some special variant of the fan, and not know it? Are they perhaps mislabeled? Should I expect the fan's current draw to increase over time, or with temperature or some other variable?
|
Is the Speed of the fan 7500 RPM or something different? The manufacturer often specify the worst case situation and the typical values are 50% of that. In addtion to the mentioned load, at low temperature and at start-up the current might peak as well.
| 0.888889 |
Is the Speed of the fan 7500 RPM or something different?
|
How do animal perceive distances with their eyes and ears
|
I am studying how animals (including the human beings) can perceive distances thanks to their eyes and their ears. I am focusing on the fact that they always go in pairs: two eyes, two ears, etc.
About the sight, I think our eyes use the parallax. But is this enough? Is this the only way we can perceive distances with them?
About the sounds, I think it is merely by interferometry, but I am not convinced, because the distances between our ears and the wavelength are not always comparable to one another.
What do you think about it?
Thanks in advance,
Isaac
|
With vision depth is determined by parallax. This largely works for objects out to 100m or less. Depth beyond that distance is assessed by familiarity with these objects, say large mountains or vistas, and experience with them.
Depth with hearing is determined by two means. A tone which is perceived louder in one ear than the other is usually perceived as having a direction based on that. For lower frequency sounds phase differences between left and right auditory perception can be used by the brain to detect angular direction relative to the facial direction.
Some species of whales are thought to generate a mental map of the ocean, where a blue whale in the Atlantic maps the outlay of the ocean bottom and coasts through echo location. Clearly this indicates a huge amount of neural processing which uses these acoustical data. Dogs generate maps of their immediate world through olfactory means. Life forms generate maps of their world by a variety of means.
| 1 |
Depth with hearing is determined by parallax
|
content to display by month in archive always shows current month rather then the month selected?
|
on this http://ee2.acer.edu.au/rd/archive/2013/April
I have this code
{exp:channel:entries channel="research-developments" status="Featured|Open" orderby="entry_date" sort="desc" dynamic="off" display_by="month" limit="1"}
but it always shows latest month so at the moment I have may for all archives when I need it to display each for each section , any ideas ?
|
If dynamic is "off", the channel:entries isn't influenced by URL parameters.
| 0.888889 |
If dynamic is "off", the channel:entries isn't influenced by URL parameters
|
What is the real reason for the Joker's scars?
|
In The Dark Knight, The Joker told different reasons for the scars on his cheeks. Initially he said that his father gave him the cuts on his cheek as a child after his father performed the same act on his mother, which includes the famous line "Why so serious?".
The Joker also tells Rachel Dawes that his wife had scars due to an accident and that he cut his own cheeks with a razor blade to prove that scars did not matter.
He starts to tell Batman a third story about how he might have been disfigured.
Anybody knows what is the real reason?
Was the real reason mentioned in any comics or other books?
|
The pure nature of the Joker, especially in the movie sense, is to be completely chaotic wanting "to watch the world burn". In other words, the Joker is the very definition of the alignment: Chaotic Evil
In the movie, the conflicting stories about his past are there on purpose to continue this nature of just being an agent of chaos.
Notice how we're never given a flashback of events during his story-telling, something very prominent in the movies in order to remind the audience of events past. Even Ra's' origins were given flashbacks, although brief and nondescript.
The only facts to his backgrounds are that he started in Gotham, pitting low-level criminals against each other in elaborate robbery schemes where he comes out on top, with money.
As a point of reference, the opening scene of The Dark Knight shows his most recent attempt, with a lack of surprise from Gordon on the situation of criminals killing each other during a heist.
But this is only the past year (time between the end of Batman Begins and the beginning of The Dark Knight) and the rest of his timeline is what we see in the movie.
For clarification and emphasis of the answer:
There is no true origin of the Joker in any media.
As far as the comics, the same is true:
There are a multitude of origins of the Joker told from being a washed up comedian that went nuts, to just being that way from the start.
Though many have been related, a definitive history of the Joker has never been established in the comics, and his true name has never been confirmed.
No recounting of the Joker's origin has been definitive, however, as he has been portrayed as lying so often about his former life that he himself is confused as to what actually happened. As he says in The Killing Joke: "Sometimes I remember it one way, sometimes another... if I'm going to have a past, I prefer it to be multiple choice!"
source
The one true constant of any depiction of the Joker is that he wants to assert to Batman that all it takes is One bad day to send anyone into the insanity that he lives everyday.
The most prominent of this is during the short story The Killing Joke where he tortures Gordon almost to this point.
And this is also what makes the Joker such the notorious villain that he is. No one can ever be certain of anything of him or what he will do. Whether it be something as simplistic as his background to any of his plans, constantly fooling even the pinnacle of detectives like Batman on multiple occasions.
As a final side note about Joker origin, the story that is most accepted as the "true" origin is The Killing Joke Where he quits his job to be a comedian and goes completely nuts after being knocked into a vat of acid that bleaches his body the traditional Joker colours (all caused by Batman during a heist gone wrong).
But as there is no confirmation of this origin to the Joker, even this can be taken with a grain of salt.
The Dark Knight's interpretation of the Joker is based primarily on the character's first two appearances in the Batman comics, as well as Alan Moore's one-shot comic book Batman: The Killing Joke, which was given to Heath Ledger in order to prepare for his role.
Source
| 1 |
The Joker's origin is based on the character's first two appearances in the Batman comics
|
Default header image does not display
|
Clarification: My default header image will not RE-display (by clicking suggested image) after it has been removed using theme customizer "Hide Image" option.
I added theme support for Custom Header Image
// Add Theme Support for Custom Header Image
add_theme_support( 'custom-header',
array(
'default-image' => get_template_directory_uri() . '/assets/img/hdr_earth.jpg',
'default-text-color' => '#e2f0d6',
'header-text' => true,
'uploads' => true,
'width' => 1140,
'height' => 200,
'wp-head-callback' => 'wpfw_style_header',
)
);
Inside the Theme Customizer I see the (default) image displayed as:
The "Current Header" box, and
In the "Suggested" box
I deleted the current header image by clicking the "Hide Image" button.
And this is where the problem started
When I attempt to re-add the default image by clicking on the "Suggested" (i.e. default) image...
The image is displayed in the customizer window.
But the image will not save, so the image does not display on the web page.
A var_dump( get_header_image() ); returned false, so after reading the function in the core, I see this if ( 'remove-header' == $url ) return false;.
So a var_dump( get_theme_mods() ) does indeed show 'header_image' => string 'remove-header' (length=13).
???
... now this is after I added the default image back and saved.
What am I missing?
The entire script (custom-header.php)
if ( ! function_exists( 'wpfw_custom_header' ) ) {
function wpfw_custom_header() {
// Add theme Support for Custom Backgrounds
add_theme_support( 'custom-background',
array(
'default-color' => '#e2f0d6',
'default-image' => get_template_directory_uri() . '/assets/img/bgp-128x180.jpg',
)
);
// Add Theme Support for Custom Header Image
add_theme_support( 'custom-header',
array(
'default-image' => get_template_directory_uri() . '/assets/img/hdr_earth.jpg',
'default-text-color' => '#e2f0d6',
'header-text' => true,
'uploads' => true,
'width' => 1140,
'height' => 200,
'wp-head-callback' => 'wpfw_style_header',
)
);
} // end wpfw_custom_header()
} // end if
// Hook into the 'after_setup_theme' action
add_action( 'after_setup_theme', 'wpfw_custom_header', 11 );
/**
* ----------------------------------------------
* Callback function for updating header styles
* ----------------------------------------------
*/
if ( ! function_exists( 'wpfw_style_header' ) ) {
function wpfw_style_header() {
$text_color = get_header_textcolor();
?>
<style type="text/css" id="wpfw-custom-header-styles">
.site-title a.site-title-link {
color: #<?php echo esc_attr( $text_color ); ?>;
}
<?php if ( display_header_text() != true ) : ?>
.site-title {
display: none;
}
<?php endif; ?>
</style>
<?php
} // end wpfw_style_header()
} // end if...
|
Try this where you need to get the url of the header image and you have set the default:
$url = has_header_image() ? get_header_image() : get_theme_support( 'custom-header', 'default-image' );
| 0.888889 |
$url = has_header_image
|
Looking for a word with a more positive connotation than "infectious"
|
I recently was attempting to describe someone's smile. I wanted to describe it as being very 'infectious', or that it spreads very quickly and is contagious. However, as hard as I could try, I could only come up with words that have to do with infections or words that have a negative connotation.
How could I describe a person's smile if it has the ability to 'spread' to other people, as denoted above?
Thanks!
|
"Contagious smile" and "infectious smiles" are very strong collocations which have a positive connotation. I don't think we really have much choice but to use these expressions when describing an amazing smile that makes others smile, too.
| 1 |
"Contagious smile" and "infectious smiles" are very strong expressions .
|
Removing blanks from a column in Excel
|
Could you sort the data in its existing location?
| 1 |
Could you sort the data in its existing location?
|
|
Windows 2008 service creation permission
|
What do I need to grant permission for creating a service in Windows server 2008 R2?
I have added the user to the local "Administrators" group.
This is the error message:
C:\temp>sc create test binpath=c:\temp\test.exe
[SC] OpenSCManager FAILED 5:
Access is denied.
|
You need to run the cmd prompt as an administrator. By default you will not have the correct rights to do this.
| 0.666667 |
You need to run cmd prompt
|
Is potential energy and "work done" the same thing?
|
Is potential energy and "work done" the same thing?
If they are not one and the same thing then why is potential energy always associated with "work done"?
Could you explain me with some examples?
|
You will have to spent some energy to do work. This is called the work done.This energy that you spent is stored inside the body on which you do work as the potential energy. That is why you always see work done equated to potential energy.
| 1 |
The energy that you spent is stored inside the body on which you do work
|
Making a C++ app scriptable
|
I have several functions in my program that look like this:
void foo(int x, int y)
Now I want my program to take a string that looks like:
foo(3, 5)
And execute the corresponding function. What's the most straightforward way to implement this?
When I say straightforward, I mean reasonably extensible and elegant, but it shouldn't take too long to code up.
Edit:
While using a real scripting language would of course solve my problem, I'd still like to know if there is a quick way to implement this in pure C++.
|
As Daniel said:
Script languages like Lua and Python would be the most used script languages for binding together c++ libraries.
You will have to add a script interface to your c++ application. The buildup of this interface obviously depends on what script language you chose.
| 0.666667 |
Script languages like Lua and Python would be the most used script languages for binding together c++ libraries
|
How can I tell if a downloaded ISO is complete?
|
I just ran into a nasty problem with an ISO download from Microsoft. I successfully burnt it to a rewritable DVD, and copied the contents to the local hard drive on another machine, but when I went to run them they were corrupt. It turns out the download had been truncated.
Now, OK, sometimes that happens - but it surprised me that the truncated file (which was only slightly more than 60% of the actual ISO) burnt successfully and seemed to be presenting me with a sensible file system, to the extent that I could (apparently) successfully copy the files.
So, is there some way I could have tested the file to see if it was complete or not? The MS web site did not provide any information about the expected size, so I'm looking for a generic solution: given an ISO file which may or may not be truncated, is there some way to tell? Do commonly used CD/DVD (data) formats include any embedded information about how much data is supposed to be on the disk, or even better, some kind of CRC?
A solution that detects most truncated images will be accepted, it doesn't need to be perfect. (I'd prefer something that doesn't give false positives, though.)
[Addendum: a comparison of the disk burnt with the truncated image with the files extracted from the full image suggests that chunks of the data from many of the files were replaced with random information, perhaps from the contents of a previous burn to the same rewritable disk.]
|
A quick-n-dirty method: if you install 7-Zip, you can right-click an ISO and open it as an archive - something I usually do anyway to unpack it (as an alternative to burning to DVD). From there, you can test the archive using the 'Test' command in the toolbar.
| 1 |
Install 7-Zip as an archive
|
how to get specific value from json file in java
|
I have a json file like this:
{
"list": [
{
"ID" : "1",
"value" : "value is one"
}
{
"ID" : "2",
"value" : "value is two"
}
{
"ID" : "3",
"value" : "value is three"
}
{
"ID" : "4",
"value" : "value is four"
}
]
}
what I want to do is read the josn file and returns the message based on the ID i specify. So for example
if (this.list.containsKey("1"))
{
return this.list.get(messageTitle);
}
That's what I tried but it returns all the values and ID.
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(new FileReader("jsonFile.json"));
JSONObject jsonObject = (JSONObject) obj;
// loop array
JSONArray msg = (JSONArray) jsonObject.get("list");
Iterator<String> iterator = msg.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
}
|
You can try with TypeReference using ObjectMapper to convert it into appropriate Map object.
sample code:
BufferedReader reader = new BufferedReader(new FileReader(new File("jsonFile.json")));
TypeReference<Map<String, ArrayList<Map<String, String>>>> typeRef = new TypeReference<Map<String, ArrayList<Map<String, String>>>>() {};
ObjectMapper mapper = new ObjectMapper();
try {
Map<String, ArrayList<Map<String, String>>> data = mapper.readValue(reader, typeRef);
ArrayList<Map<String, String>> list = data.get("list");
for (Map<String, String> map : list) {
if (map.get("ID").equals("1")) {
System.out.println(map.get("value"));
}
}
} catch (Exception e) {
System.out.println("There might be some issue with the JSON string");
}
output:
value is one
| 1 |
TypeReference ObjectMapper
|
Does this C++ static analysis rule make sense as is?
|
I'm implementing some C++ static analysis rules, and one of them prohibits a function from returning a reference or pointer to a reference parameter of the function, i.e. the following are all non-compliant:
int *f(int& x) { return &x; } // #1
const int *g(const int& x) { return &x; } // #2
int& h(int& x) { return x; } // #3
const int& m(const int& x) { return x; } // #4
The justification given for this is that "It is implementation-defined behaviour whether the reference parameter is a temporary object or a reference to the parameter."
I'm puzzled by this, however, because stream operators in C++ are written in this way, e.g.
std::ostream& operator<<(std::ostream& os, const X& x) {
//...
return os;
}
I think I'm pretty confident that stream operators in C++ do not in general exhibit implementation-defined behaviour, so what's going on?
According to my understanding as it is at present, I would expect #1 and #3 to be well-defined, on the basis that temporaries cannot be bound to non-const references, so int& x refers to a real object that has lifetime beyond the scope of the function, hence returning a pointer or reference to that object is fine. I would expect #2 to be dodgy, because a temporary could have been bound to const int& x, in which case trying to take its address would seem a bad plan. I'm not sure about #4 - my gut feeling is that that's also potentially dodgy, but I'm not sure. In particular, I'm not clear on what would happen in the following case:
const int& m(const int& x) { return x; }
//...
const int& r = m(23);
|
As you say, #1 and #3 are fine (though #1 is arguably bad style).
#4 is dodgy for the same reason #2 is; it allows propagating a const reference to a temporary past its lifetime.
Let's check:
#include <iostream>
struct C {
C() { std::cout << "C()\n"; }
~C() { std::cout << "~C()\n"; }
C(const C &) { std::cout << "C(const C &)\n"; }
};
const C &foo(const C &c) { return c; }
int main() {
const C &c = foo(C());
std::cout << "c in scope\n";
}
This outputs:
C()
~C()
c in scope
| 0.666667 |
#include <iostream> struct
|
How do the sensors in Star Trek receive information faster than light speed?
|
I was just watching an old Star Trek Voyager episode and Harry Kim said roughly "Captain, another super nova exploded just 0.36 lightyears away!". My question here is how something can happen 0.36 lightyears away and still be considered just.
I can accept that they travel faster than light, by using subspace; something I imagine as a fourth dimension in space. So they still are slower than light in four dimensional space, but appear to to travel faster than light in three dimensional space.
So, is there any reasonable explanation for this statement or is it simply bogus in the script?
|
From Wikipedia:
In the Star Trek fictional universe, subspace is a feature of space-time which facilitates faster-than-light transit, in the form of interstellar travel or the transmission of information.
| 0.888889 |
Subspace is a feature of space-time which facilitates faster-than-light transit .
|
How to get a store email addres in php
|
I made a custom module wich sends a email now i want to edit the module so that it automatically uses one of the store email adresses i saw something like Mage::app()->getStore()-> but i dont know how to use this to get store mailadress
I use zend
$mail = new Zend_Mail();
$mail->setBodyText($bericht);
$mail->setFrom($email, $name);
$mail->addTo("[email protected]", "sales manager");
$mail->setSubject("Snel offerte");
$tmpFilePath = $_FILES['foto']['tmp_name'];
if ($tmpFilePath != ""){
$file_size = $_FILES['foto']['size'];
if (($file_size > 22020096)){
Mage::getSingleton('core/session')->addError($this->__('Bestand mag niet groter zijn dan 21 MB'));
}
else{
$fname = $_FILES['foto']['name'];
$ftempname = $_FILES['foto']['tmp_name'];
$at = new Zend_Mime_Part(file_get_contents($tmpFilePath));
$at->disposition = Zend_Mime::DISPOSITION_INLINE;
$at->encoding = Zend_Mime::ENCODING_BASE64;
$at->filename = $fname;
$mail->addAttachment($at);
}
}
try {
$mail->send();
}
|
Genral Email
<?php $storeemail=Mage::getStoreConfig('trans_email/ident_general/email'); ?>
sale email
<?php $saleemail=Mage::getStoreConfig('trans_email/ident_sales/email'); ?>
Support email
<?php $supportemail=Mage::getStoreConfig('trans_email/ident_support/email'); ?>
| 1 |
Genral Email <?
|
Lorentz Invariance of Maxwell Equations
|
I am curious to see a simple demonstration of how special relativity leads to Lorentz Invariance of the Maxwell Equations. Differential form will suffice.
|
Another way to see it is when deriving the EM wave equation from Maxwell equations. The Lorentz Invariance means that the amplitude should be symmetric under translations of space and time and rotations. In the wave eq. you have only 2nd derivatives (time and space), hence symmetry under Lorentz is preserved.
| 0.333333 |
Lorentz Invariance means that the amplitude should be symmetric under translations of space and time and rotation
|
What are lightbox / modal window UI best practices for viewing full-sized images in a gallery?
|
I'm an artist and amateur web designer.
On my portfolio website, I've grouped my work into projects. Most of my projects contain few (20 or less) images, so I just display them in full size and let the visitor scroll (example) because this is how I prefer to browse other artist's work as well.
For projects containing more images, I use thumbnails which link to the full-sized images, because, again, when I browse other artist's portfolios, if there are lots of images on a page it's kinda cumbersome to load.
Recently I wrote some jQuery to implement a lightbox effect (modal window overlay) so when you click on a thumbnail, the full-sized image appears (example).
My main reasons for implementing this:
it's much more presentable than having a direct link to the image,
which is what I used to do
if the visitor shares the image on something like tumblr or
Pinterest, the link back will be to the project page instead of a
direct link to the image
if the visitor wants to right-click on the thumbnails to load several
images in several new browser tabs/windows, they can still do so (the
lightbox is triggered on left click)
I did not include a close button because it seems like more work for the visitor to have to look for a close button, than to simply click anywhere to close the lightbox (which is what I did).
What are your thoughts regarding lightbox interface for this particular use?
The goal would be the best way to showcase visual art/design work, and the target audience would be, well, anyone who wants to view the work. The display method, in this case a lightbox interface, should be efficient, useable, and presentable (it should highlight, not detract from, the work).
|
One important point is keyboard accessibility: Let the user browse with the ← and → buttons, and make esc work as close button. You may offer further details when the user presses ↑ … but that requires probably some hints.
Mouse users need clickable buttons to navigate images and to close the active one. These buttons can be hidden when the cursor is not over the image, but they should be available.
| 1 |
Mouse users need clickable buttons to navigate images and to close the active one
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.