Search Results

Search found 1440 results on 58 pages for 'adam 0'.

Page 47/58 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • JavaScript Prototype and Encapsulation

    - by Adam Davies
    Sorry I'm probably being a realy noob here...but: I have the following javascript object: jeeni.TextField = (function(){ var tagId; privateMethod = function(){ console.log("IN: privateMethod"); } publicMethod = function(){ console.log("IN: publicMethod: " + this.tagId); } jeeni.TextField = function(id){ console.log("Constructor"); this.tagId = id; } jeeni.TextField.prototype = { constructor: jeeni.TextField, foo: publicMethod }; return jeeni.TextField; }()); Now when I run the following code I get the corresponding result: var textField1 = new jeeni.TextField(21); // Outputs: Constructor textField1.foo(); // Outputs: IN: publicMethod: 21 console.log(textField1.tagId); // Outputs: 21 console.log(textField1.privateMethod); // Outputs: undefined So my question is why is privateMethod hidden and tagId is not. I want them both to be private scope. Please help a noob. Thanks

    Read the article

  • Ruby on Rails: Best way to save search queries in a database

    - by Adam Templeton
    For a RoR app I'm helping develop, I need to save all search queries in a database so I can analyze them later. My plan right now is to create a Result model and table, and just save each search query's text in that table, along with a user's ID, the time, etc. However, the app has about 15,000 users, so I'm afraid the single table approach won't be super efficient when it comes time to parse that data. (The database is setup via MySQL, if that factors in at all.) Am I just being paranoid? Is there a Ruby gem that handles this sort of thing, or a better approach I could take? Any input would be appreciated.

    Read the article

  • What was your first home computer?

    - by Adam Tegen
    What was your first home computer? The one that made you "fall in love" with programming. There are 300+ entries, many (most?) of which are duplicates. As with all StackOverflow Poll type Q&As, please make certain your answer is NOT listed already before adding a new answer - searching doesn't always find it (model naming variations, I assume). If it already exists, vote that one up so we see what the most popular answer is, rather than duplicating an existing entry. If you see a duplicate, vote it down so the top entries have only one of each model listed. If you have interesting or additional information to add, use a comment or edit the original entry rather than creating a duplicate.

    Read the article

  • Unable to .append(); without eliminating all the spaces in the code

    - by Adam
    $('#form_holder').append('<div id="spec_id_'+count+'"><div class="avail_container"> <input class="avail_fields" type="checkbox" checked="checked" name="special'+count+'" /><span class="avail_field_label">Special Date</span></div> <div class="avail_container"><div class="avail_time_container"><span class="field_label">Time</span> <select name="special'+count+'_time_from_1"> <?php for ($t = 0; $t<24; $t++){ ?> <option value="<?php echo $t; ?>"><?php echo $t; ?></option> <?php } ?> </select>: <select name="special'+count+'_time_from_2"> <?php for ($t = 0; $t<60; $t+=15){ ?> <option value="<?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?>"><?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?></option> <?php } ?> </select> <span class="field_label">to</span> <select name="special'+count+'_time_to_1"> <?php for ($t = 0; $t<24; $t++){ ?> <option value="<?php echo $t; ?>"><?php echo $t; ?></option> <?php } ?> </select>: <select name="special'+count+'_time_to_2"> <?php for ($t = 0; $t<60; $t+=15){ ?> <option value="<?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?>"><?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?></option> <?php } ?> </select> </div> </div> </div>'); I'm assuming javascript or jquery does not like breaks like I have here, because all my javascript code does not work. What would be an alternative to eliminating all the spaces, which would make viewing the code difficult?

    Read the article

  • Loop through Javascript array, print with string.

    - by Adam
    I have a simple array like: var myArr=["one","two","three"]; an I have a counting loop, which increases the value of var "i" by one. What I want to do is print the next value from the array each time the loop runs, next to a text string, like so: alert('value number '+myArr[i]+); But for some reason I can't get this to work. The following code works, so I'm assuming I'm not calling the counter right: alert('value number '+myArr[0]+);

    Read the article

  • Multiple column Union Query without duplicates

    - by Adam Halegua
    I'm trying to write a Union Query with multiple columns from two different talbes (duh), but for some reason the second column of the second Select statement isn't showing up in the output. I don't know if that painted the picture properly but here is my code: Select empno, job From EMP Where job = 'MANAGER' Union Select empno, empstate From EMPADDRESS Where empstate = 'NY' Order By empno The output looks like: EMPNO JOB 4600 NY 5300 MANAGER 5300 NY 7566 MANAGER 7698 MANAGER 7782 MANAGER 7782 NY 7934 NY 9873 NY Instead of 5300 and 7782 appearing twice, I thought empstate would appear next to job in the output. For all other empno's I thought the values in the fields would be (null). Am I not understanding Unions correctly, or is this how they are supposed to work? Thanks for any help in advance.

    Read the article

  • How to change size of UIButton

    - by Adam
    I'm trying to resize a UIButton in my iPhone app. I have a UIButton synthesized and when I call the following code, it moves on the screen, but the width & height of the button never change. button.frame.size = CGRectMake(104, 68, 158, 70); For example, when I change the height (70) to 40, the height of the button does not change. If I change the x or y, however, it will move on the screen. Any ideas?

    Read the article

  • Django Custom Field: Only run to_python() on values from DB?

    - by Adam Levy
    How can I ensure that my custom field's *to_python()* method is only called when the data in the field has been loaded from the DB? I'm trying to use a Custom Field to handle the Base64 Encoding/Decoding of a single model property. Everything appeared to be working correctly until I instantiated a new instance of the model and set this property with its plaintext value...at that point, Django tried to decode the field but failed because it was plaintext. The allure of the Custom Field implementation was that I thought I could handle 100% of the encoding/decoding logic there, so that no other part of my code ever needed to know about it. What am I doing wrong? (NOTE: This is just an example to illustrate my problem, I don't need advice on how I should or should not be using Base64 Encoding) def encode(value): return base64.b64encode(value) def decode(value): return base64.b64decode(value) class EncodedField(models.CharField): __metaclass__ = models.SubfieldBase def __init__(self, max_length, *args, **kwargs): super(EncodedField, self).__init__(*args, **kwargs) def get_prep_value(self, value): return encode(value) def to_python(self, value): return decode(value) class Person(models.Model): internal_id = EncodedField(max_length=32) ...and it breaks when I do this in the interactive shell. Why is it calling to_python() here? >>> from myapp.models import * >>> Person(internal_id="foo") Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 330, in __init__ setattr(self, field.attname, val) File "/usr/local/lib/python2.6/dist-packages/django/db/models/fields/subclassing.py", line 98, in __set__ obj.__dict__[self.field.name] = self.field.to_python(value) File "../myapp/models.py", line 87, in to_python return decode(value) File "../myapp/models.py", line 74, in decode return base64.b64decode(value) File "/usr/lib/python2.6/base64.py", line 76, in b64decode raise TypeError(msg) TypeError: Incorrect padding I had expected I would be able to do something like this... >>> from myapp.models import * >>> obj = Person(internal_id="foo") >>> obj.internal_id 'foo' >>> obj.save() >>> newObj = Person.objects.get(internal_id="foo") >>> newObj.internal_id 'foo' >>> newObj.internal_id = "bar" >>> newObj.internal_id 'bar' >>> newObj.save() ...what am I doing wrong?

    Read the article

  • Best practices for storing & selecting time/date with php & mysql?

    - by Adam
    I often find myself storing data in a mysql database, and then wanting to display all sorts of stats about my data, specifically stuff like 'how many rows do I have for this date, or that date'. Does anyone know of (or could write) a good tutorial on this subject? Ideally a good tutorial would overview: Best practices when storing the data (i.e. what formats to use, how to use them servertime vs. generated time, etc.) Best practices when selecting data from the database with php (i.e. how to sort rows by date, how to retrieve only rows from a certain date, or a certain hour, etc).. Timezones and other issues that might come up. Thanks in advance.

    Read the article

  • object consisting of jQuery element

    - by Adam Kiss
    hello, current code I've built function to do something over collection of jQuery elements: var collection = $([]); //empty collection I add them with: collection = collection.add(e); and remove with: collection = collection.not(e); It's pretty straightforward solution, works nicely. problem Now, I would like to have an object consisting of various settings set to any jQuery element, i.e.: function addObject(e){ var o = { alpha: .6 //float base: {r: 255, g: 255, b: 255} //color object } e.data('settings', o); } But when I pass jQuery object/element to function (i.e. as e), calling e.data doesn't work, although it would be simplest and really nice solution. question If I have an "collection" of jQuery elements, what is the simplest way of storing some data for each element of set?

    Read the article

  • How do I use jquery to both download & delete files dynamically from servlet

    - by Adam
    Is it possible to a jquery $.get() to call a servlet and use it to both download a file or update the page without reloading the page? (Or more basically, can I download a file without reloading the page?) For example, I am using a servlet that either returns a file to download of mimetype "application/octet-stream", or returns text to be update in the page of type "text/html". I can write a form with a submit, but then it reloads the page, so I've been trying to use $.get()... but the download doesn't work. <script type="text/javascript"> jQuery(document).ready(function(){ $("#handleFileOptions button").button(); }); function handleFilesSubmit(requestType) { $.get('FileServlet', {filename: $('#radioFileList input:radio:checked').button("widget").text(), requestType: requestType}, function(data){ ...?... }); } </script> In the html: <div id = "handleFiles"> <div id ="radioFileList"> <div id="radioFileList"> <input value="file0.txt" type="radio" id="fileitem0><label for="fileitem0">file0.txt</label> <input value="file1.txt" type="radio" id="fileitem1><label for="fileitem0">file1.txt</label> </div> </div> <div id="handleFileOptions"> <button id="handleFileOption0" onclick="handleFilesSubmit('Download')">Download</button> <button id="handleFileOption1" onclick="handleFilesSubmit('Delete')">Delete</button> </div> </div>

    Read the article

  • Building html structure in php or javascript?

    - by Adam
    I've been doing a lot of ajax calls and using the returned data to build html with javascript. However, I've noticed some people are returning the constructed html in the ajax calls since they're doing it all in php. What is the preferred method? I have a bunch of stuff already using javascript, so I guess I would prefer not changing everything to use just php. But, I'm assuming php would be more "secure."? The following is what I've been doing: $main_frag = $("<div class='order-container'/>"); $contact_frag = $("<div class='group'><div class='line-data'>Name: "+data.name+"</div><div class='line-data'>Email: "+data.email+"</div><div class='line-data'>Phone: "+data.phone+"</div></div>"); $address_frag = $("<div class='group'><div class='line-data'>Address 1: "+data.address_one+"</div><div class='line-data'>Address 2: "+address2+"</div><div class='line-data'>City: "+data.city+"</div><div class='line-data'>Province: "+data.province+"</div><div class='line-data'>Postal Code: "+data.postal+"</div></div>"); etc.. I just want to hear the opinions of the community.

    Read the article

  • my div tag is not aligning properly after jquery.html replacement

    - by Adam
    <div class="container"><span class="field_label">Job</span><input class="fields2" type="text" maxlength="200" name="first_name" /></div> <div class="container"><span class="field_label">Date</span><input class="fields2" type="text" maxlength="200" name="the_date" id="the_date" /></div> <div class="container" id="sched_text">sdfdsfdsf</div> <!-- schedule text--> <div class="container"><span class="field_label">Time</span> .container{ position:relative; display:block; float:right; border: 1px solid; padding-bottom: 10px; } my html/css here has my containers aligning right below each other. However, when I use .html in jquery to change or add text to sched_text it throws the css off and places the div tag not as a block anymore but placed somewhere to the side. Does something change when you use .html text? what would the proper way of doing it? Thanks Ok the issue is that my .html or .text is not a string. I just did .text(the_Week[i][1]); which results in a number. How do I present it as a string?

    Read the article

  • replay in django + apcahce + mod_wsgi ??

    - by Adam
    I have a simple django page that has a counter on it. I use Apache2 and mod_wsgi to serve it. First, when I enter this page, the counter shows 0, as it should. The second time when I enter the page the counter shows 1 - again, it is the right behavior. The problem begins now, cause when I enter this page the third time, I get 0 again. When I refresh it goes between 0, and 1, clearly using some cache or so. If I wait for some time and then try again, it will show 2, and 3, but will be stuck with those values, till this cache or whatever it is will be flushed, and then the counter continues. Does somebody knows how I can get it work right (the real scenario deals with getting data from the DB, but the problems with this strange cache are the same). BTW, I don't have any caching engine set in my django settings.

    Read the article

  • Is there a way to update a database when installing/upgrading an app?

    - by Adam
    I have a main application, and a bunch of sub-applications (they are separate apps, which do not appear on the android home dashboard). I was planning on having a SQLite DB which the main app maintains, and get a list of available sub-apps from. Is there a way to update this main database as the user installs the sub-apps? Two alternative I was thinking of include: User installs the sub-apps via the main app, which would then update the DB. Rather than use the DB to find all installed sub-apps, have each sub-app declare a category, and use intents to query for all applications which match that query (is this even possible? if so, advice is welcomed). Thanks!

    Read the article

  • How can I extract a range of lines from a text file on unix?

    - by Adam J. Forster
    I have a ~23000 line sql dump containing several databases worth of data. I need to extract a certain section of this file (i.e. the data for a single database) and place it in a new file. I know both the start and end line numbers of the data that I want. Does anyone know a unix command (or series of commands) to extract all lines from a file between say line 16224 and 16482 and then redirect them into a new file?

    Read the article

  • Left Join only returning one row

    - by Adam
    I am trying to join two tables. I would like all the columns from the product_category table (there are a total of 6 now) and count the number of products, CatCount, that are in each category from the products_has_product_category table. My query result is 1 row with the first category and a total count of 68, when I am looking for 6 rows with each individual category's count. <?php $result = mysql_query(" SELECT a.*, COUNT(b.category_id) AS CatCount FROM `product_category` a LEFT JOIN `products_has_product_category` b ON a.product_category_id = b.category_id "); while($row = mysql_fetch_array($result)) { echo ' <li class="ui-shadow" data-count-theme="d"> <a href="' . $row['product_category_ref_page'] . '.php" data-icon="arrow-r" data-iconpos="right">' . $row['product_category_name'] . '</a><span class="ui-li-count">' . $row['CatCount'] . '</span></li>'; } ?> I have been working on this for a couple of hours and would really appreciate any help on what I am doing wrong.

    Read the article

  • JSON to display text -- Freezes UI

    - by Adam Storr
    Hi everyone, I currently have a very simple view which displays info from a JSON feed. The problem I'm facing is the few second pause I encounter once I press this tab. How can I make this view load instantly and then have the label.text areas load after? Preferable with an activity indicator? Should I use threads? Thanks in advance! Code: - (NSString *)stringWithUrl:(NSURL *)url { NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadRevalidatingCacheData timeoutInterval:30]; NSData *urlData; NSURLResponse *response; NSError *error; urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error]; return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding]; } - (id)objectWithUrl:(NSURL *)url { SBJsonParser *jsonParser = [SBJsonParser new]; NSString *jsonString = [self stringWithUrl:url]; return [jsonParser objectWithString:jsonString error:NULL]; } - (NSDictionary *)downloadStats { id response = [self objectWithUrl:[NSURL URLWithString:@"http://www.example.com/JSON"]]; NSDictionary *feed = (NSDictionary *)response; return feed; [feed release]; } - (void)viewDidLoad { [super viewDidLoad]; [GlobalStatsScrollView setScrollEnabled:YES]; [GlobalStatsScrollView setContentSize:CGSizeMake(320, 360)]; } - (void)viewWillAppear:(BOOL)animated { NSLog(@"View appears"); // Download JSON Feed NSDictionary *feed = [self downloadStats]; totalproduced.text = [feed valueForKey:@"Produced"]; totalno.text = [feed valueForKey:@"Total"]; mostcommon.text = [feed valueForKey:@"Most Common"]; }

    Read the article

  • need help understanding a function.

    - by Adam McC
    i had previously asked for help writing/improving a function that i need to calculate a premium based on differing values for each month. the premium is split in to 12 months and earned on a percentage for each month. so if the policy start in march and we are in jan we will have earned 10 months worth. so i need to add up the monthly earning to give us the total earned. wach company wil have differeing earnings values for each month. my original code is Here. its ghastly and slow hence the request for help. and i was presented with the following code. the code works but returns stupendously large figures. begin set @begin=datepart(month,@outdate) set @end=datepart(month,@experiencedate) ;with a as ( select *, case calmonth when 'january' then 1 when 'february' then 2 when 'march' then 3 when 'april' then 4 when 'may' then 5 when 'june' then 6 when 'july' then 7 when 'august' then 8 when 'september' then 9 when 'october' then 10 when 'november' then 11 when 'december' then 12 end as Mnth from tblearningpatterns where clientname=@client and earningpattern=@pattern ) , b as ( select earningvalue, Mnth, earningvalue as Ttl from a where Mnth=@begin union all select a.earningvalue, a.Mnth, cast(b.Ttl*a.earningvalue as decimal(15,3)) as Ttl from a inner join b on a.Mnth=b.Mnth+1 where a.Mnth<=@end ) select @earningvalue= Ttl from b inner join ( select max(Mnth) as Mnth from b ) c on b.Mnth=c.Mnth option(maxrecursion 12) SET @earnedpremium = @earningvalue*@premium end can someone please help me out?

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >