Search Results

Search found 9988 results on 400 pages for 'tv less in jersey'.

Page 24/400 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • [Python] Tips for making a fraction calculator code more optimized (faster and using less memory)

    - by Logic Named Joe
    Hello Everyone, Basicly, what I need for the program to do is to act a as simple fraction calculator (for addition, subtraction, multiplication and division) for the a single line of input, for example: -input: 1/7 + 3/5 -output: 26/35 My initial code: import sys def euclid(numA, numB): while numB != 0: numRem = numA % numB numA = numB numB = numRem return numA for wejscie in sys.stdin: wyjscie = wejscie.split(' ') a, b = [int(x) for x in wyjscie[0].split("/")] c, d = [int(x) for x in wyjscie[2].split("/")] if wyjscie[1] == '+': licz = a * d + b * c mian= b * d nwd = euclid(licz, mian) konA = licz/nwd konB = mian/nwd wynik = str(konA) + '/' + str(konB) print(wynik) elif wyjscie[1] == '-': licz= a * d - b * c mian= b * d nwd = euclid(licz, mian) konA = licz/nwd konB = mian/nwd wynik = str(konA) + '/' + str(konB) print(wynik) elif wyjscie[1] == '*': licz= a * c mian= b * d nwd = euclid(licz, mian) konA = licz/nwd konB = mian/nwd wynik = str(konA) + '/' + str(konB) print(wynik) else: licz= a * d mian= b * c nwd = euclid(licz, mian) konA = licz/nwd konB = mian/nwd wynik = str(konA) + '/' + str(konB) print(wynik) Which I reduced to: import sys def euclid(numA, numB): while numB != 0: numRem = numA % numB numA = numB numB = numRem return numA for wejscie in sys.stdin: wyjscie = wejscie.split(' ') a, b = [int(x) for x in wyjscie[0].split("/")] c, d = [int(x) for x in wyjscie[2].split("/")] if wyjscie[1] == '+': print("/".join([str((a * d + b * c)/euclid(a * d + b * c, b * d)),str((b * d)/euclid(a * d + b * c, b * d))])) elif wyjscie[1] == '-': print("/".join([str((a * d - b * c)/euclid(a * d - b * c, b * d)),str((b * d)/euclid(a * d - b * c, b * d))])) elif wyjscie[1] == '*': print("/".join([str((a * c)/euclid(a * c, b * d)),str((b * d)/euclid(a * c, b * d))])) else: print("/".join([str((a * d)/euclid(a * d, b * c)),str((b * c)/euclid(a * d, b * c))])) Any advice on how to improve this futher is welcome. Edit: one more thing that I forgot to mention - the code can not make use of any libraries apart from sys.

    Read the article

  • Bash script to (more or less) reliably check if the internet is up

    - by João Portela
    I need a bash script to put in a cron job that every minute checks if the internet is up. This is how I did it: #! /bin/sh host1=google.com host2=wikipedia.org curr_date=`date +"%Y%m%d%H%M"` echo -n "${curr_date};" ((ping -w5 -c3 $host1 || ping -w5 -c3 $host2) > /dev/null 2>&1) && echo "up" || (echo "down" && exit 1) How would you do it? Which hosts would you ping? Thanks in advance.

    Read the article

  • Stretching DIV to 100% height and width of window but not less than 800x600px

    - by El Eme
    I have a page that needs to stretch and resize with with window and I've managed to do that but I need that the "inner div" (#pgContent) stretch if the window is resized to higher dimensions but that it doesn't shrink more than, let's say for example 800 x 600 px. As I have it now it stretches well but it also shrinks more than I want! It's working as I want in width but not in height!? Here's a visual example: My CSS: * { margin: 0; padding: 0; outline: 0; } /*| PAGE LAYOUT |*/ html, body { height: 100%; width: 100%; /*text-align: center;*/ /*IE doesn't ~like this*/ cursor: default; } #pgWrapper { z-index: 1; min-height: 100%; height: auto !important; /*min-height: 600px;*/ /* THIS SHOULD WORK BUT IT DOESN'T */ height: 100%; min-width: 1000px; width: 100%; position: absolute; overflow: hidden; text-align: center; background: #000; } #pgContent { position: absolute; top: 30px; left: 30px; right: 30px; bottom: 50px; overflow: hidden; background: #CCC; } #footWrapper { z-index: 2; height: 50px; min-width: 940px; position: absolute; left: 30px; right: 30px; bottom: 0px; background: #C00; } /*| END PAGE LAYOUT |*/ And the HTML: <body> <div id="pgWrapper"> <div id="pgContent"> This DIV should stretch with window but never lower than for example 800px x 600px!<br /> If window size is lower then scrollbars should appear. </div> </div> <div id="footWrapper"> <div id="footLft"></div> <div id="footRgt"></div> </div> </body> If someone could give me a help on this I would appreciate. Thanks in advance.

    Read the article

  • Execute a method less times possible - PHP

    - by serhio
    I have a site in multiple languages. I have a method that returns me the today currencies in a array. I display that currencies in a table then. // --- en/index.php <?php include_once "../exchangeRates.php"; $currencies = ReadExchangeRates(); // --- fr/index.php <?php include_once "../exchangeRates.php"; $currencies = ReadExchangeRates(); ... // somewhere in the page <td><?php echo $currencies["eur"]["today"]; ?></td> So, every time I load, en/ or fr/ or other language, I request the exchange rates from a external site. Can I optimize this behavior (reading once per day or session)? maybe to store a global variable and check the update date?

    Read the article

  • Function template accepting nothing less than a bidirectional iterator or a pointer

    - by san
    I need a function template that accepts two iterators that could be pointers. If the two arguments are random_access iterators I want the return type to be an object of std::iterator<random_access_iterator_tag, ...> type else a std::iterator<bidirectional_iterator_tag, ...> type. I also want the code to refuse compilation if the arguments are neither a bidirectional iterator, nor a pointer. I cannot have dependency on third party libraries e.g. Boost Could you help me with the signature of this function so that it accepts bidirectional iterators as well as pointers, but not say input_iterator, output_iterator, forward_iterators. One partial solution I can think of is the following template<class T> T foo( T iter1, T iter2) { const T tmp1 = reverse_iterator<T>(iter1); const T tmp2 = reverse_iterator<T>(iter2); // do something } The idea is that if it is not bidirectional the compiler will not let me construct a reverse_iterator from it.

    Read the article

  • Less Mathematical Approaches to Machine Learning?

    - by Ed
    Out of curiosity, I've been reading up a bit on the field of Machine Learning, and I'm surprised at the amount of computation and mathematics involved. One book I'm reading through uses advanced concepts such as Ring Theory and PDEs (note: the only thing I know about PDEs is that they use that funny looking character). This strikes me as odd considering that mathematics itself is a hard thing to "learn." Are there any branches of Machine Learning that use different approaches? I would think that a approaches relying more on logic, memory, construction of unfounded assumptions, and over-generalizations would be a better way to go, since that seems more like the way animals think. Animals don't (explicitly) calculate probabilities and statistics; at least as far as I know.

    Read the article

  • LESS THAN OR EQUAL TO IN Oracle SQL

    - by Jasim
    updated_date = 08-Jun-2010; I have a query like this select * from asd whre updated_date <= todate('08-Jun-2010', 'dd-MM-yy'); but i am not getting any result. it is wotking only if todate is 09-Jun-2010... ie my equalto operator is not working properly. y is it like that ny help?

    Read the article

  • Hashing 11 byte unique ID to 32 bits or less

    - by MoJo
    I am looking for a way to reduce a 11 byte unique ID to 32 bits or fewer. I am using an Atmel AVR microcontroller that has the ID number burned in at the factory, but because it has to be transmitted very often in a very low power system I want to reduce the length down to 4 bytes or fewer. The ID is guaranteed unique for every microcontroller. It is made up of data from the manufacturing process, basically the coordinates of the silicone on the wafer and the production line that was used. They look like this: 304A34393334-16-11001000 314832383431-0F-09000C00 Obviously the main danger is that by reducing these IDs they become non-unique. Unfortunately I don't have a large enough sample size to test how unique these numbers are. Having said that because there will only be tens of thousands of devices in use and there is secondary information that can be used to help identify them (such as their approximate location, known at the time of communication) collisions might not be too much of an issue if they are few and far between. Is something like MD5 suitable for this? My concern is that the data being hashed is very short, just 11 bytes. Do hash functions work reliably on such short data?

    Read the article

  • Wrapping 3 objects or less inside a while / foreach in PHP

    - by DarkGhostHunter
    Simple question. I have an array of 21 elements, and show every three of them inside a <div> block. The code is something like this: <?php $faces= array( 1 => 'happy', 2 => 'sad', (sic) 21 => 'angry' ); $i = 1; foreach ($faces as $face) { echo $face; $i++; } ?> The problem lies when this array doesn't have 21 elements, sometimes it gets 24, an other times 17. How I wrap every three of them, and wrap alone the rest? I came up with using switch and case, but that works only when there are 21 elements only. I think I could count them beforehand and put a closing in the last one (even if it is a group of one element).

    Read the article

  • Adding zeros when length is less

    - by David
    Is there a smart way to convert numbers to string and automatically add zeroes so the length is the same as the maximum? like this: for (var i=0; i<30; i++) { var c = i.toString(); if (c.length == 1) { c = '0'+=c; } } But smarter

    Read the article

  • What cable to connect Inspiron 1720 to HDMI TV?

    - by Bernhard Hofmann
    Hi I'm a little confused to say the least when it comes to video formats and protocols. I'd like to view my laptop output on my HD TV. The TV has HDMI, S-Video, and RCA inputs. My laptop has a VGA female port on the side for driving a 2nd monitor, and an S-VHS output at the back. No, it has no DVI, which I've heard is a poor decision from DELL, and even poorer decision on my part to buy it. Can I get true HD output from this to my TV? What cable do I need, or would I need a converter? Any other suggestions are also welcome, such as how to get something close to HD on my TV. Thanks! Bernhard

    Read the article

  • Les offres TV des firmes informatiques ont-elles leur place sur le marché ? Google repousse la sienne suite aux mauvaises critiques

    Les offres TV des firmes informatiques ont-elles leur place sur le marché ? Google repousse la sienne suite aux mauvaises critiques Mise à jour du 20.12.2010 par Katleen La fièvre des box TV semblait avoir contaminé les plus grandes firmes informatiques : d'abord Apple, puis Google et Microsoft. Mais Mountain View vient d'annoncer ses réticences à poursuivre dans cette voie. La firme, qui devait lancer ses offres télévisuelles dans quelques jours lors du "Consumer Eclectronics Show", a décidé de les repousser. Pourquoi un tel revirement ? Suite aux premières critiques des professionnels qui ont pu tester le produit en avant première. Les retours ont été plutôt négatifs, quali...

    Read the article

  • Pensez à notre site de web tv pour les partenaires !

    - by swalker
    Nous souhaitons vous remercier chaleureusement pour votre forte mobilisation autour du projet « Mini Studio ITPlace.tv ». Merci d’avoir répondu présent ! 14 Interviews Partenaires Des IA Channel dignes des plus grands journalistes du 20h Des partenaires ravis de pouvoir s’exprimer Des contenus de valeurs autour de nombreuses thématiques Un remerciement tout spécial pour Loïc qui a su mobiliser 5 de ses partenaires autour de thématiques que nous avons peu l’habitude d’adresser (solutions cross Apps/Tech, Sécurité, etc…). Nous reviendrons vers vous rapidement pour vous présenter les montages vidéos finaux, et voir avec vos partenaires comment utiliser au mieux ces médias. Pour vous connecter : http://www.itplace.tv

    Read the article

  • How can I test different TV display types for my XBLIG game?

    - by Steve Dunn
    The XBLIG submission check-list says to ensure that all important stuff critical to game-play be visible in the 'TitleSafeArea'. I've received a bug report during play-test of my game (Crazy Balloon Lite) that says parts of my scrolling 2D map are only half visible (i.e. chopped at the left of the screen). I've tested my game myself on a 47" TV and also a 19" VGA monitor, both of which look fine. The bug report says the issue occurs on a standard 20" TV. My question is: without buying different sizes of TVs, is there a way to test what my game will look like on different sized displays?

    Read the article

  • Les Google TV n'arriveront pas avant 2012 en France, les chaînes télévisées s'opposent à ses caractéristiques d'affichage

    Les Google TV n'arriveront pas avant 2012 en France, les chaînes télévisées s'opposent à ses caractéristiques d'affichage Mise à jour du 11.03.2011 par Katleen Il y a quelques jours, Jean-Marc Tassetto, le PDG de Google France, s'est exprimé à l'occasion de la remise d'un rapport au ministère des Finances. Il y a donné de mauvaises nouvelles concernant les Google TV, ces téléviseurs fabriqués par Sony et connectés à Internet. Si le concept a déjà été mal accueilli aux Etats-Unis, où il peine à se faire une place, il suscite également une certaine animosité dans notre pays. En effet, les grands groupes audiovisuels français ne voient pas cette arrivée d'un bon oeil, et se sont d'ailleur...

    Read the article

  • My computer freezes after some minutes while watching dvb tv from kaffeine but only when i use the cpu scaling utilities

    - by digitalcrow
    My computer freezes after some minutes while watching dvb tv from kaffeine but only when i use the cpu scaling utilities to enter cpu on performance mode. It freezes completely repeating a small sound loop from tv. cant go to terminal etc. I have a phenom II 3,40 ghz dualcore cpu , but i unlocked the other two cores so now its quadcore. On Windows i don't have any problems and i use the performance mode all the time and never breaks. I'm really dissapointed....

    Read the article

  • Microsoft diffuse le premier spot TV de Windows 8, la campagne de promotion de l'OS s'annonce plus dynamique que les précédentes

    Microsoft diffuse le premier spot TV de Windows 8 La campagne de promotion de l'OS s'annonce plus dynamique que les précédentes Pour sa sortie officielle prévue le 26 octobre, Microsoft entame la campagne marketing pour Windows 8 et diffuse une première vidéo promotionnelle. Souplesse, rapidité et habilité, telle est la ligne directrice de ce spot TV qui donne le ton d'une méga-campagne qui s'annonce plus dynamique, et de loin, par rapport aux précédentes. Le spot, diffusé aux États-Unis et sur YouTube, commence par un compte positif qui stagne à 8, suivi du déroulement rapide des fonctionnalités du nouvel OS centrées sur le multi-touch avec des clichés du numéro 8 qui re...

    Read the article

  • hibernate fail mapping two tables

    - by sebbalex
    Hi guys, I'd like to understand how it is possible: Until I was working with one table everything worked fine, when I have mapped another table it fails as shown below: Glassfish start: INFO: configuring from resource: /hibernate.cfg.xml INFO: Configuration resource: /hibernate.cfg.xml INFO: Reading mappings from resource : hibernate_centrale.hbm.xml //first table INFO: Mapping class: com.italtel.patchfinder.objects.centrale - centrale INFO: Reading mappings from resource : hibernate_impianti.hbm.xml //second table INFO: Mapping class: com.italtel.patchfinder.objects.Impianto - impianti INFO: Configured SessionFactory: null INFO: schema update complete INFO: Hibernate: select centrale0_.id as id0_, centrale0_.name as name0_, centrale0_.impianto as impianto0_, centrale0_.servizio as servizio0_ from centrale centrale0_ group by centrale0_.name INFO: Hibernate: select centrale0_.id as id0_, centrale0_.name as name0_, centrale0_.impianto as impianto0_, centrale0_.servizio as servizio0_ from centrale centrale0_ where centrale0_.name='ANCONA' order by centrale0_.name asc //Error org.hibernate.hql.ast.QuerySyntaxException: impianti is not mapped [from impianti where impianto='SD' order by modulo asc] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:181) ..... config: table1 <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.italtel.patchfinder.objects.Impianto" table="impianti"> <id column="id" name="id"> <generator class="increment"/> </id> <property name="impianto"/> <property name="modulo"/> </class> </hibernate-mapping> table2 <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.italtel.patchfinder.objects.centrale" table="centrale"> <id column="id" name="id"> <generator class="increment"/> </id> <property name="name"/> <property name="impianto"/> <property name="servizio"/> </class> </hibernate-mapping> connection stuff ... <property name="hbm2ddl.auto">update</property> <mapping resource="hibernate_centrale.hbm.xml"/> <mapping resource="hibernate_impianti.hbm.xml"/> </session-factory> </hibernate-configuration> Class: public List loadAll() { Session session = sessionFactory.getCurrentSession(); session.beginTransaction(); return session.createQuery("from centrale group by name").list(); } public List<centrale> loadImplants(String centrale) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction(); return session.createQuery("from centrale where name='" + centrale + "' order by name asc").list(); } public List<Impianto> loadModules(String implant) { Session session = sessionFactory.getCurrentSession(); session.beginTransaction(); return session.createQuery("from impianti where impianto='" + implant + "' order by modulo asc").list(); } } Do you have some advice? Thanks in advance

    Read the article

  • UDP + total order, non-reliable

    - by disown
    I'm trying to find a version of UDP which just alleviates the restriction of a maximum size of the message sent. I don't care about reliability or partial retransmission, if all chunks arrive I want the message to be assembled from the chunks in sending order and delivered to the listening app. If one or more chunks are missing I would just like to discard the message. The goal is to have a low-latency notification mechanism about real time data, but with the added support for bigger messages than what would fit in an IP datagram. I would like the protocol to be one way only, and not have long connection setup times. An optional feature to be able to respond to a received message wouldn't hurt (a concept of an unreliable connection), but is not necessary.

    Read the article

  • XMLAdapter for HashMap

    - by denniss
    I want to convert a list of items inside of my payaload and convert them into a hashmap. Basically, what I have is an Item xml representation which have a list of ItemID. Each ItemID has an idType in it. However, inside my Item class, i want these ItemIDs to be represented as a Map. HashMap<ItemIDType, ItemID> The incoming payload will represent this as a list <Item>... <ItemIDs> <ItemID type="external" id="XYZ"/> <ItemID type="internal" id="20011"/> </ItemIDs> </Item> but I want an adapter that will convert this into a HashMap "external" => "xyz" "internal" => "20011" I am right now using a LinkedList public class MapHashMapListAdapter extends XmlAdapter<LinkedList<ItemID>, Map<ItemIDType, ItemID>> { public LinkedList<ItemID> marshal(final Map<ItemIDType, ItemID> v) throws Exception { ... } public Map<ItemIDType, ItemID> unmarshal(final LinkedList<ItemID> v) throws Exception { ... } } but for some reason when my payload gets converted, it fails to convert the list into a hashmap. The incoming LinkedList of the method unmarshal is an empty list. Do you guys have any idea what I am doing wrong here? Do I need to create my own data type here to handle the LinkedList?

    Read the article

  • Sample code for Anymote in C++ version?

    - by summerdog
    Does anyone can tell me where to find the resource just like the following link ? (But I hope this is for C++ !!) https://code.google.com/p/googletv-android-samples/source/browse/#git%2FAnymoteLibrary%2Fsrc%2Fcom%2Fexample%2Fgoogle%2Ftv%2Fanymotelibrary%2Fclient There is a dynamic library : http://code.google.com/p/google-tv-chrome-extensions/source/browse/AnymoteExample/?r=2048c59701bab6386f7ea8011e4ca342fb1f133a#AnymoteExample%2Fplugins%2Fgtvremote_AnymoteExample.plugin%2FContents%2FMacOS Unfortunately, the arch of this library is i386. I want to build this project for the other platform. Orz Thanks.

    Read the article

  • can Dell netbooks with HDTV tuner drive HDMI output to 1920 x 1080 HDTV, and does any other brand of

    - by Jian Lin
    It has been a while that Dell netbook offered an internal HDTV tuner, and it always seem like Dell is the only one that has an internal HDTV tuner? And actually, does anyone have experience with it, since the processor is very basic, can it handle smooth HDTV on screen full size, and especially for the Dell mini 1010, it can output to HDMI, so can it drive an HDTV that is 1920 x 1080? thanks.

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >