Search Results

Search found 128 results on 6 pages for 'tristan sebens'.

Page 5/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • How should I deal with floating numbers that numbers that can get so small that the become zero

    - by Tristan Havelick
    So I just fixed an interesting bug in the following code, but I'm not sure the approach I took it the best: p = 1 probabilities = [ ... ] # a (possibly) long list of numbers between 0 and 1 for wp in probabilities: if (wp > 0): p *= wp # Take the natural log, this crashes when 'probabilites' is long enough that p ends up # being zero try: result = math.log(p) Because the result doesn't need to be exact, I solved this by simply keeping the smallest non-zero value, and using that if p ever becomes 0. p = 1 probabilities = [ ... ] # a long list of numbers between 0 and 1 for wp in probabilities: if (wp > 0): old_p = p p *= wp if p == 0: # we've gotten so small, its just 0, so go back to the smallest # non-zero we had p = old_p break # Take the natural log, this crashes when 'probabilites' is long enough that p ends up # being zero try: result = math.log(p) This works, but it seems a bit kludgy to me. I don't do a ton of this kind of numerical programming, and I'm not sure if this is the kind of fix people use, or if there is something better I can go for.

    Read the article

  • Can we only use the back-end of wordpress without any front-end ?

    - by Tristan
    Hello, i just asked a question few minutes ago which led me to this one : I want to know if there is any chance to use only the back-end of wordpress ? I mean, link my admin interface to post news link my visitor interface on my website to the wordpress news so the visitor can access the news So the visitor never find out that i'm using wordpress to generate the news and handle their comments and write my news ? Maybe it's possible but there is no point by doing so ? Thank you

    Read the article

  • jQuery code to track clicks on outgoing links (google analystics)

    - by Tristan
    Hello, I found this on the web: $('a[href^=http]:not("[href*=://' + document.domain + ']")').click(function() { pageTracker._trackPageview('/outgoing/' + $(this).attr('href')); }); But it's not working. In my Google Analytics account there are no /outgoing/ links showing (it's been 24+ hours since I implemented it). What's wrong with this code? I'm using jQuery of course ;) (PS : i already have : <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA MY CODE"); pageTracker._trackPageview(); } catch(err) {}</script>)

    Read the article

  • jQuery ajax : error while passing variables in data

    - by Tristan
    Hello, just a quick question : var h = $('#hebergeurJQUERY').val(); var t = $('#typeJQUERY').val(); function requestData() { $.ajax({ type: "GET", url: '12months/months.php', data : "hosting="+h+"&type="+t+"", ...... doesnt work while data : "hosting=Something&type=Something", Works. Any idea to something stupid i did (again ?) ;) Thanks

    Read the article

  • How to test if a user has uploaded a file ?

    - by Tristan
    Hello, on a page, i have : if (!empty($_FILES['logo']['name'])) { $dossier = 'upload/'; $fichier = basename($_FILES['logo']['name']); $taille_maxi = 100000; $taille = filesize($_FILES['logo']['tmp_name']); $extensions = array('.png', '.jpg', '.jpeg'); $extension = strrchr($_FILES['logo']['name'], '.'); //Début des vérifications de sécurité... if(!in_array($extension, $extensions)) { $erreur = 'ERROR you must upload the right type'; } if($taille>$taille_maxi) { $erreur = 'too heavy'; } if(!empty($erreur)) { ....................... } The problem is, if the users wants to edit information WITHOUT uploading a LOGO, it raises an error : 'error you must upload the right type' So, if a user didn't put anything in the inputbox in order to upload it, i don't want to enter in these conditions test. i tested : if (!empty($_FILES['logo']['name']) and if (isset($_FILES['logo']['name']) but both doesn't seems to work. Any ideas? thanks.

    Read the article

  • Books on data-intensive enterprise integration patterns

    - by Tristan
    I'm trying to understand design patterns used by data-intensive enterprise applications. A classic example is the financial industry, where system must consume, analyze, and execute on real-time financial data while providing information and configuration options to a broad set of traders and analysts. One can imagine similar system in airlines, major supply chain operations, and utility providers. Are there good books that provide and inside view of how these systems work? Enterprise Integration Patterns is one example, but I'm looking for something with more real-world applications, particularly in finance.

    Read the article

  • Problem with accessing in DOM with jQuery

    - by Tristan
    Hello, I changed the tree of my JSON-P output, and i cannot access to my object DOM anymore : Here's my output : jsonp1271634374310( {"Inter-Medias": {"name":"Inter-Medias","idGSP":"14","average":"80","services":"8.86"} }); And here's my jQuery script : success: function(data, textStatus, XMLHttpRequest){ widget = data.name; widget += data.average ; .... I know one level is missing, but if I try to do : data.Inter-Medias.name or data.name.name it's still not working. Any idea please ? I will have case where i'll have multiple Ojbect, so i want to display all of them, how to do that ? for (i=0;i < data.length;i++) Does it look right ? Bonus question : i understand function(data, textStatus, XMLHttpRequest) that in case of success this function is triggered, the data is what the script recieved from his request, but i have no idea what textStatus or XMLHttpRequest are here too and why ?! Thank you.

    Read the article

  • PHP error handling : my code is not optimized

    - by Tristan
    Hello, I must warn you, this code will heart your eyes, so please don't judge me, i'm trying to improve the way I handle errors all my tests are like this : if ($something < 27) { $error_IP= '<div class="error_message">something bad</div> '; }else{ $erreur_IP=''; } and here's the ugliest thing : if( !isset($_POST) || ($erreur_captcha !='') || ($erreur_email !='') || ($erreur_hebergeurVide != '') || ($erreur_paysVide != '') || ($erreur_slotVide != '') || ($erreur_rconVide != '') || ($erreur_tick != '') + a lot more :d ) What do you suggest to me to optimize my errors handling ? Thank you

    Read the article

  • What's the best way to implement news system without using wordpress ?

    - by Tristan
    Hello, I'm a little afraid of using Wordpress because of his connotation "all made", plus my website is 100% hand coded, actually, i use the phpBB but it's not what I want cause visitors have to go out of the website to go to the forum to see the news. So how/what can I do to have my own news system management (publish/review/moderate comments).... Are there tools (i mean except WYSIWYG) / PHP class I can use to implement myself ? I hope you understand what i mean. Thank you :)

    Read the article

  • 3 questions about JSON-P format.

    - by Tristan
    Hi, I have to write a script which will be hosted on differents domains. This script has to get information from my server. So, stackoverflow's user told me that i have to use JSON-P format, which, after research, is what i'm going to do. (the data provided in JSON-P is for displaying some information hosted on my server on other website) How do I output JSON-P from my server ? Is it the same as the json_encode function from PHP How do i design the tree pattern for the output JSON-P (you know, like : ({"name" : "foo", "id" : "xxxxx", "blog" : "http://xxxxxx.com"}); can I steal this from my XML output ? (http://bit.ly/9kzBDP) Each time a visitor browse a website on which my widget is it'll make a request on my server, requesting the JSON-P data to display on the client side. It'll increase dramatically the CPU load (1 visitor on the website who will have the script = 1 SQL request on my server to output data), so is there any way to 'caching' the JSON-P information output to refresh it only one or twice a day and stores it into a 'file' (in which extension?). BUT on the other hand i would say that requesting the JSON-P data directly (without caching it) is a plus, because, websites which will integrates the script only want to display THEIR information and not the whole data. So, making a script with something like that: jQuery.getJSON("http://www.something.com/json-p/outpout?filter=5&callback=?", function(data) { ................); }); Where filter= the information the website wants to display What do you think ? Thank you very much ;)

    Read the article

  • Pure python implementation of greenlet API

    - by Tristan
    The greenlet package is used by gevent and eventlet for asynchronous IO. It is written as a C-extension and therefore doesn't work with Jython or IronPython. If performance is of no concern, what is the easiest approach to implementing the greenlet API in pure Python. A simple example: def test1(): print 12 gr2.switch() print 34 def test2(): print 56 gr1.switch() print 78 gr1 = greenlet(test1) gr2 = greenlet(test2) gr1.switch() Should print 12, 56, 34 (and not 78).

    Read the article

  • Simple question about operator ||

    - by Tristan
    HEllo, i try to do that in FlashBuilder (FlexProject) protected function btn_detail_view_clickHandler(event:MouseEvent):void { CurrentState="Statistiques" || "PartMarche"; } But it's not working, i guess this is not the right syntax but what's the right syntax ? Thanks

    Read the article

  • Where do I put all these function-like #defines, in C?

    - by Tristan
    I'm working with an embedded system, and I'm ending up with a ton of HW-interfacing #define functions. I want to put all of these into a separate file (for OOP-ness), but I don't know the best way to #include that. Do I just put them all into a .c file, then include that? Seems silly to put these in a .h file.

    Read the article

  • Cross platform /dev/null in Python

    - by Tristan
    I'm using the following code to hide stderr on Linux/OSX for a Python library I do not control that writes to stderr by default: f = open("/dev/null","w") zookeeper.set_log_stream(f) Is there an easy cross platform alternative to /dev/null? Ideally it would not consume memory since this is a long running process.

    Read the article

  • linked list sort function only loops once

    - by Tristan Pearce
    i have a singly linked list that i am trying to sort from least to greatest by price. here is what i have so far struct part { char* name; float price; int quantity; struct part *next; }; typedef struct part partType; partType *sort_price(partType **item) { partType *temp1 = *item; partType *temp2 = (*item)->next; if ( *item == NULL || (*item)->next == NULL ) return *item; else { while ( temp2 != NULL && temp2->next != NULL ){ if (temp2->price > temp2->next->price){ temp1->next = temp2->next; temp2->next = temp2->next->next; temp1->next->next = temp2; } temp1 = temp2; temp2 = temp2->next; } } return *item; } the list is already populated but when i call the sort function it only swaps the first two nodes that satisfy the condition in the if statement. I dont understand why it doesnt do the check again after the two temp pointers are incremented.

    Read the article

  • Building a user subscription application

    - by Tristan O'Neil
    Hello, I'm trying to come up with the best way to handle user subscription and management for our magazine website. What I want to happen is a user purchases a subscription and they are granted online access of a certain membership role for a certain amount of time depending on how many years they subscribed for. I would also like the system to be able to send out emails when a subscription is almost up. I've seen some third party projects to help accomplish this but I'd prefer to write this from scratch as I want total control over how it works. Any suggestions would be helpful. The main thing I can't figure out is how to have an expiring membership. You must keep track of when the user signed up and how long until they should expire.

    Read the article

  • Rails model to represent multiple fields

    - by Tristan O'Neil
    I'm developing a rails project where I have one data model with multiple fields that are collection selects. I'd like to create another model to represent all of these collection select fields. So, for instance, my main data model has three collection select fields -- one for county, one for category, and one for classification. I could separate these into three separate data models, but that seems redundant since they all share the same characteristics. They have a type and a value, like a county is a county and it has a value of let's say Sonoma, just as category has a type of category and a value of let's say Winery. If you've ever used Drupal, I'm basically looking for the behavior of the taxonomy functionality. So you see my dilemma: I need to separate these fields into three separate fields but they have very similar data structures. Any suggestions would be greatly appreciated.

    Read the article

  • Self-contained python installation with executable tools included (pip, orbited, etc)

    - by Tristan
    I'm trying deploy a Python application on Windows as a folder that includes a full python 2.6 folder. I don't need/want a fancy solution like py2exe, I'm just trying to automate deployment of a web application. So long as I include python26.dll and set the PYTHONHOME correctly, things seem to work if I just include the Python26 folder in its entirety. However a number of the Python26/Script files don't work. For instance, pip.exe, orbited.exe, and morbid.exe all do nothing (complete with no output) when I try to run them on a system that doesn't have a real Python26 installation. I've run out of ideas. Suggestions?

    Read the article

  • jQuery : how to apply effect on a child element

    - by Tristan
    Hello, instead of re-writting the same function, i want to optimise my code : <div class="header"> <h3>How to use the widget</h3> <span id="idwidget" ></span> </div> <div class="content" id="widget"> the JS : <script type="text/javascript"> $(document).ready(function() { var showText="Show"; var hideText="Hide"; $("#idwidget").before("<a href='#' class='button' id='toggle_link'>"+showText+"</a>"); $('#widget').hide(); $('a#toggle_link').click(function() { if ($('a#toggle_link').text()==showText) { $('a#toggle_link').text(hideText); } else { $('a#toggle_link').text(showText); } $('#widget').toggle('slow'); return false; }); }); This is working just with the div which is called widget and the button called idwidget. But on this page i have also : <div class="header"> <h3>How to eat APPLES</h3> <span id="IDsomethingelse" ></span> </div> <div class="content" id="somethingelse"> And i want it to be compatible with the code. I heard about children attribute, do you have an idea how to do that please ? Thank you

    Read the article

  • OOP PHP simple question

    - by Tristan
    Hello, I'm new to OOP in PHP, is that to seems correct ? class whatever { Function Maths() { $this->sql->query($requete); $i = 0; while($val = mysql_fetch_array($this)) { $tab[i][average] = $val['average']; $tab[i][randomData] = $val['sum']; $i=$i+1; } return $tab; } I want to access the data contained in the array $foo = new whatever(); $foo->Maths(); for ($i, $i <= endOfTheArray; i++) { echo Maths->tab[i][average]; echo Maths->tab[i][randomData]; } Thank you ;)

    Read the article

  • Changing floating point behavior in Python to Numpy style.

    - by Tristan
    Is there a way to make Python floating point numbers follow numpy's rules regarding +/- Inf and NaN? For instance, making 1.0/0.0 = Inf. >>> from numpy import * >>> ones(1)/0 array([ Inf]) >>> 1.0/0.0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: float division Numpy's divide function divide(1.0,0.0)=Inf however it is not clear if it can be used similar to from __future__ import division.

    Read the article

  • Mysql configuration errror : using password (NO) instead of YES.

    - by Tristan
    Hello, I try to connect mysql via PHPMYADMIN, using my password, but it can't stop telling me that (access denied, using password NO) but i'm using a password :O When i connect via the console with my password, it works but not on phpmyadmin. It's really weird. Do you have an idea to fix that ? edit: it worked couple of days ago, because i created 2 databases and 2 users via phpmyadmin... Thanks edit : When i'm using CHROME it's working unless FireFox ... any ideas ?

    Read the article

  • 2 IP are stored for a visitor : PROXY ?

    - by Tristan
    Hello, on my database i've decided to store IP of the visitors who answoers to polls. It's all working, but there is only 2 cases where not only 1 IP is stored, but there is 2 SAME ip for the same visitor MySQLL output (i replaced 2 numbers by XX) 10.188.XX.129, 10.188.XX.129 Here's the script to recieve the IP of the visitor : <?php function realip() { if (isset($_SERVER)) { if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { $realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif (isset($_SERVER["HTTP_CLIENT_IP"])) { $realip = $_SERVER["HTTP_CLIENT_IP"]; } else { $realip = $_SERVER["REMOTE_ADDR"]; } } else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) { $realip = getenv( 'HTTP_X_FORWARDED_FOR' ); } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) { $realip = getenv( 'HTTP_CLIENT_IP' ); } else { $realip = getenv( 'REMOTE_ADDR' ); } } return $realip; } ? Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >