Daily Archives

Articles indexed Sunday May 2 2010

Page 1/69 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • About function scopes in javascript

    - by Shawn
    Look at the code below. I want to alert the value of i at the moment that specific listener was added. Is other words, clicking each marker should alert a different value. Where can I store the value of i in a way that it won't change and be accessible inside the scope of that function? Here is problematic code: (it is difficult to test because you need a key from Google) <html> <head> <title>a</title> <script type="text/javascript"> function init() { map = new GMap2(document.getElementById("map_canvas")); // http://code.google.com/intl/es/apis/maps/documentation/reference.html#GMap2 map.setCenter(new GLatLng(0, 0), 1); // http://code.google.com/intl/es/apis/maps/documentation/reference.html#GMap2.setCenter for(var i = 0; i < 10; i++) { var marker = new GMarker(point); // http://code.google.com/intl/es/apis/maps/documentation/reference.html#GMarker map.addOverlay(marker); // http://code.google.com/intl/es/apis/maps/documentation/reference.html#GMap2.addOverlay GEvent.addListener(marker, "click", function() // http://code.google.com/intl/es/apis/maps/documentation/reference.html#GEvent.addListener { alert(i); // Problem: I want the value of i at the moment when the listener is added. }); } } window.onload = init; </script> </head> <body id="map_canvas"> </body> </html> Thanks!

    Read the article

  • JPA ManyToMany problem...

    - by Parhs
    Hello i have an Entity Exam @Id @GeneratedValue(strategy=GenerationType.TABLE) private Long id; ..... ...... @ManyToMany private List<Exam> exams; @ManyToMany(mappedBy="id") private List<Exam> parentExams; The problem is that @ManyToMany private List<Exam> exams; is ok works great... but this doesnt validate?! @ManyToMany(mappedBy="id") private List<Exam> parentExams; Any idea what to do ? I just want to get the exams that are parents of the current exam. ??e???? ??µ?sµat??? ?aµe??

    Read the article

  • ASP.NET MVC: What is the lifetime of a Controller instance?

    - by Kivin
    I was unable to find any documentation on the MSDN site. Is the lifetime (construction and disposition) of the Controller object defined in the ASP.NET MVC Spec? The reason for this question is to determine whether or not it is safe to store contextual information in Controller members/properties or whether using the HttpContext would be more appropriate.

    Read the article

  • C++ vs Matlab vs Python as a main language for Computer Vision Postgraduate

    - by Hough
    Hi all, Firstly, sorry for a somewhat long question but I think that many people are in the same situation as me and hopefully they can also gain some benefit from this. I'll be starting my PhD very soon which involve the fields of computer vision, pattern recognition and machine learning. Currently, I'm using opencv (2.1) C++ interface and I especially like its powerful Mat class and the overloaded operations available for matrix and image seamless operations and transformations. I've also tried (and implemented many small vision projects) using opencv python interface (new bindings; opencv 2.1) and I really enjoy python's ability to integrate opencv, numpy, scipy and matplotlib. But recently, I went back to opencv C++ interface because I felt that the official python new bindings were not stable enough and no overloaded operations are available for matrices and images, not to mention the lack of machine learning modules and slow speeds in certain operations. I've also used Matlab extensively in the past and although I've used mex files and other means to speed up the program, I just felt that Matlab's performance was inadequate for real-time vision tasks, be it for fast prototyping or not. When the project becomes larger and larger, many tasks have to be re-written in C and compiled into Mex files increasingly and Matlab becomes nothing more than a glue language. Here comes the sub-questions: For postgrad studies in these fields (machine learning, vision, pattern recognition), what is your main or ideal programming language for rapid prototyping of ideas and testing algorithms contained in papers? For postgrad studies, can you list down the pros and cons of using the following languages? C++ (with opencv + gsl + svmlib + other libraries) vs Matlab (with all its toolboxes) vs python (with the imcomplete opencv bindings + numpy + scipy + matplotlib). Are there computer vision PhD/postgrad students here who are using only C++ (with all its availabe libraries including opencv) without even needing to resort to Matlab or python? In other words, given the current existing computer vision or machine learning libraries, is C++ alone sufficient for fast prototyping of ideas? If you're currently using Java or C# for your postgrad work, can you list down the reasons why they should be used and how they compare to other languages in terms of available libraries? What is the de facto vision/machine learning programming language and its associated libraries used in your university research group? Thanks in advance.

    Read the article

  • Let other computer view my localhost over a network...

    - by Smickie
    Hi, I have apache and what not running on my local machine (mac), there also another mac on the local network. How does this other machine access my localhost? For example I have a local website at example.local.net in my vhost. How can another computer on the network navigate to this site? Cheers!

    Read the article

  • Merge aspnetdb database with another one?

    - by Xaisoft
    I have an aspnetdb and I have created another aspnetdb for another website, but instead of starting from scratch, I would like to import all the data from the one that has users and other data into the new aspnetdb. Is there a way to do this? Are any tools available?

    Read the article

  • Passing parameters between interrupt handlers on a Cortex-M3 ...

    - by Captain NedD
    I'm building a light kernel for a Cortex-M3. From a high priority interrupt I'd like to invoke some code to run in a lower priority interrupt and pass some parameters along. I don't want to use a queue to post work to the lower priority interrupt. I just have a buffer and size to pass to it. In the proramming manual it says that the SVC interrupt handler is synchronous which presumably means that if you invoke it from an interrupt that's a lower priority than SVC's handler it gets called immediately (the upshot of this being that you can pass parameters to it as though it were a function call (a little like the BIOS calls in MS-DOS)). I'd like to do it the other way: passing parameters from a high priority interrupt to a lower priority one (at the moment I'm doing it by leaving the parameters in a fixed location in memory). What's the best way to do this (if at all possible)? Thanks,

    Read the article

  • How to directly store SQLite data in XCode?

    - by Justin
    Hi guys: Searched on here and got some vague answers, so I thought i'd rephrase the problem to get some clearer answers- Right now I have an SQL Lite db that reads/parses information from a pre-formatted .txt file. When I open the app, there is a slight 'lag' as the iDevice parses the info, then gets fetched for the iDevice. I'm just wondering if there's any way to just 'save' all the information directly in the xCode so there's no lag/fetch time? Thank you.

    Read the article

  • Create many constrained, random permutation of a list

    - by Eyal
    I need to make a random list of permutations. The elements can be anything but assume that they are the integers 0 through x-1. I want to make y lists, each containing z elements. The rules are that no list may contain the same element twice and that over all the lists, the number of times each elements is used is the same (or as close as possible). For instance, if my elements are 0,1,2,3, y is 6, and z is 2, then one possible solution is: 0,3 1,2 3,0 2,1 0,1 2,3 Each row has only unique elements and no element has been used more than 3 times. If y were 7, then 2 elements would be used 4 times, the rest 3.

    Read the article

  • Python questions from beginner

    - by ChrisC
    I'm thinking about rewriting an MS Access db I wrote years ago into a stand-alone Python app. Other than a college class called "Intro to C++" (console only, with OOP concepts) and the Access db itself, I have no experience, so I need to ask if the basis for my decision to go with Python is correct. Is it true that: 1) Python is relatively easy to pick up? 2) Python apps can run as "portable" (ie from one directory, no registry needs, nothing needs to be pre-installed on a Windows PC) as long as I use an embedded db?

    Read the article

  • Haskell Convert Byte String To UTC Time

    - by Steve
    I have been trying to make a function in Haskell to take a ByteString which is a datetime and convert it to UTC time taking into account the time zone from the original encoding. I am very new to Haskell so I may be making a really basic mistake. convertStringToUtc s = do estTimeZone <- hoursToTimeZone -5 time <- read $ B.unpack(s) localTimeToUTC estTimeZone time The error I get is: Couldn't match expected type `Int -> b' against inferred type `UTCTime' In the expression: localTimeToUTC estTimeZone time In the expression: do { estTimeZone <- hoursToTimeZone - 5; time <- read $ B.unpack (s); localTimeToUTC estTimeZone time }

    Read the article

  • Binding to an ObservableCollection attached property.

    - by bwreichle
    I want to create an attached property of type ObservableCollection<Notification> and bind it to a property of the same type on the DataContext. Currently I have: internal static class Squiggle { public static readonly DependencyProperty NotificationsProperty = DependencyProperty.RegisterAttached( "Notifications", typeof(ObservableCollection<Notification>), typeof(TextBox), new FrameworkPropertyMetadata(null, NotificationsPropertyChanged, CoerceNotificationsPropertyValue)); public static void SetNotifications(TextBox textBox, ObservableCollection<Notification> value) { textBox.SetValue(NotificationsProperty, value); } public static ObservableCollection<Notification> GetNotifications(TextBox textBox) { return (ObservableCollection<Notification>)textBox.GetValue(NotificationsProperty); } ... } With the following XAML: <TextBox x:Name="configTextBox" Text="{Binding Path=ConfigText, UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" AcceptsTab="True" local:Squiggle.Notifications="{Binding Path=Notifications}" /> Unfortunatly, when I actually run this I get an exception stating: A 'Binding' cannot be used within a 'TextBox' collection. A 'Binding' can only be set on a DependencyProperty of a DependencyObject. This only seems to be a problem when the attached property is of type ObservableCollection so it seems like WPF is trying to do something magical when binding properties of this type and getting confused in the process. Anyone know what I need to do to make it work?

    Read the article

  • Facebook FQL Question

    - by Michael
    I'm trying to use the Facebook Javascript API to run FQL queries, and it works fine if I try and get users by username or uid, but doesn't work when I'm searching by name. function get_username() { var name = prompt("Enter name: ") FB.api( { method: 'fql.query', query: 'SELECT username FROM user WHERE name in "'+name+'"' }, function(response) { var x = response[0].username alert('Username is ' + x); } ); } I realize that this will probably return multiple users, but I can't figure out how to tell if it's returning multiple users or no users at all, it seems to freeze after trying to get response[0].username. I'm probably making a beginner mistake but any ideas?

    Read the article

  • Assign a post to a user in ASP.NET Membership

    - by Alon
    I'm writing a forum in ASP.NET. I have a table of posts. How can I assign a post to a user? If I had a normal User table, I'd just creating a new field in the post table "UserId" and creating an assocation in the Linq to Sql designer. But now? Should I include the aspnet_Users in the designer? Thanks.

    Read the article

  • Rails Message This User Button

    - by bob
    Hello, I am using this http://github.com/professionalnerd/simple-private-messages plugin in rails and I am on a user page show.html.erb - User and I want to put a button there that, when clicked, goes to the current user's inbox and populates the field call "send to" with the "user" name. How do I send that data along when the button is clicked? <%= link_to image_tag('send_message_button.jpg', :title => 'send #{user} a message', :alt => 'send #{user} a message'), new_user_message_path(current_user), :class=>'messageuser' %> This goes to the current_user's inbox. I want to send the "params[:user_id]" variable along with it so that I can then fill out the "send to" textbox in the inbox page with it. How do I send that params variable along with this button?

    Read the article

  • Summer Programming Plans

    - by Gabe
    I've wanted to start "hacking" for many months now. But I put it off in favor of school and other things. Now, though, I'm free for the summer and want to learn as much as I can. I have a rough idea of what I want to try my hand at, but need some guidance as to what specifically - and how - I should learn. This is my plan so far: 1) Get good at programming in general. I plan to read up on how to think/work like a programmer. I'm waiting for the Pragmatic Programmer to arrive, which will be the first book I read. Q: What other books/ebooks should I look at? What more can I do here? 2) Learn/Improve at HTML/CSS. My first project will be to make a personal website/blog for myself using HTML and CSS. ----Then I hope to write/design articles like Dustin Curtis. After I finish this (and learn a programming language) I'll try to create user-based a user-focused website. Q: It's my understanding that just trying to design/manage websites is a good way to learn/improve at HTML/CSS. Is that all correct? 3) Try music development. This might be a sort of stretch for stackoverflow, but I'm interested in mixing/making techno songs. (Think Justice, or Daft Punk, or MSTRKRFT.) Q: I have a Mac. Any ideas on how I could start/learn music making? Any programs I should download, for instance? 4) My main goal: Learning a web development language/framework. I'm a year into learning/using C++. But what I really want to do is develop websites and web apps. I've searched online, and there seems to be great debate over which language/framework to learn first (and which is best). I think I've narrowed it down to three: Ruby (Rails), Python (Django), and PHP (?). Q #1: Which should I learn and use first? (Reasons?) Q #2: One reason I was leaning towards PHP is that I'm taking a PHP development course next semester. Learning it now would make that course easy. If PHP was not the answer to Q #1, is it worth learning both? Or, would it be better to just focus on PHP for this summer and next semester, and then transition thereafter to a better language? 5) iPhone/iPad Programming (Maybe). I've a number of simple, useful app ideas that I'd like to eventually get too. I just bought a Mac, as well as a few app development books. Q #1: Am I spreading myself thin trying to learn all of the above, and objective-C? Q #2: How much harder/easier is objective-C compared to the above languages? Also, how easy is it to learn obj-C after learning a web development language (and some C++)? Q #3: Yes or no? Should I go for it, or just keeep with #1-4 for now? Also: If you have any tips on how I should learn (or how you learned to hack), I'm all ears. I'd be especially interested in how you planned out learning: did you just hack whenever you felt like it, or did you "study" the language a few hours a day, or something else? Thanks so much, guys.

    Read the article

  • Referencing movie clips from within an actionscript class

    - by Ant
    Hi all, I have been given the task of adding a scoring system to various flash games. This simply involves taking input, adding functionality such as pausing and replaying and then outputting the score, time left etc. at the end. I've so far successfully edited two games. Both these games used the "actions" code on frames. The latest game I'm trying to do uses an actionscript class which makes it both easier and harder. I'm not very adept at flash at all, but I've worked it out so far. I've added various movie clips that are to be used for displaying the pause screen background, buttons for replaying etc. I've been showing and hiding these using: back._visible = true; //movie clip, instance of back (back.png) I doubt it's best practice, but it's quick and has been working. However, now with the change of coding style to classes, this doesn't seem to work. I kinda understand why, but I'm now unsure how to hide/show these elements. Any help would be greatly appreciated :) I've attached the modified AS. class RivalOrbs extends MovieClip { var infinite_levels, orbs_start, orbs_inc, orbs_per_level, show_timer, _parent, one_time_per_level, speed_start, speed_inc_percent, max_speed, percent_starting_on_wrong_side, colorize, colors, secs_per_level; function RivalOrbs() { super(); mc = this; this.init(); } // End of the function function get_num_orbs() { if (infinite_levels) { return (orbs_start + (level - 1) * orbs_inc); } else if (level > orbs_per_level.length) { return (0); } else { return (orbs_per_level[level - 1]); } // end else if } // End of the function function get_timer_str(secs) { var _loc2 = Math.floor(secs / 60); var _loc1 = secs % 60; return ((_loc2 > 0 ? (_loc2) : ("0")) + ":" + (_loc1 >= 10 ? (_loc1) : ("0" + _loc1))); } // End of the function function frame() { //PLACE PAUSE CODE HERE if (!Key.isDown(80) and !Key.isDown(Key.ESCAPE)) { _root.offKey = true; } else if (Key.isDown(80) or Key.isDown(Key.ESCAPE)) { if (_root.offKey and _root.game_mode == "play") { _root.game_mode = "pause"; /* back._visible = true; btn_resume._visible = true; btn_exit._visible = true; txt_pause._visible = true; */ } else if (_root.offKey and _root.game_mode == "pause") { _root.game_mode = "play"; } _root.offKey = false; } if (_root.game_mode == "pause" or paused) { return; } else { /* back._visible = false; btn_resume._visible = false; btn_exit._visible = false; txt_pause._visible = false; */ } if (show_timer && total_secs != -1 || show_timer && _parent.timesup) { _loc7 = total_secs - Math.ceil((getTimer() - timer) / 1000); var diff = oldSeconds - (_loc7 + additional); if (diff > 1) additional = additional + diff; _loc7 = _loc7 + additional; oldSeconds = _loc7; trace(oldSeconds); mc.timer_field.text = this.get_timer_str(Math.max(0, _loc7)); if (_loc7 <= -1 || _parent.timesup) { if (one_time_per_level) { _root.gotoAndPlay("Lose"); } else { this.show_dialog(false); return; } // end if } // end if } // end else if var _loc9 = _root._xmouse; var _loc8 = _root._ymouse; var _loc6 = {x: _loc9, y: _loc8}; mc.globalToLocal(_loc6); _loc6.y = Math.max(-mc.bg._height / 2 + gap / 2, _loc6.y); _loc6.y = Math.min(mc.bg._height / 2 - gap / 2, _loc6.y); mc.wall1._y = _loc6.y - gap / 2 - mc.wall1._height / 2; mc.wall2._y = _loc6.y + gap / 2 + mc.wall1._height / 2; var _loc5 = true; for (var _loc4 = 0; _loc4 < this.get_num_orbs(); ++_loc4) { var _loc3 = mc.stage["orb" + _loc4]; _loc3.x_last = _loc3._x; _loc3.y_last = _loc3._y; _loc3._x = _loc3._x + _loc3.x_speed; _loc3._y = _loc3._y + _loc3.y_speed; if (_loc3._x < l_thresh) { _loc3.x_speed = _loc3.x_speed * -1; _loc3._x = l_thresh + (l_thresh - _loc3._x); _loc3.gotoAndPlay("hit"); } // end if if (_loc3._x > r_thresh) { _loc3.x_speed = _loc3.x_speed * -1; _loc3._x = r_thresh - (_loc3._x - r_thresh); _loc3.gotoAndPlay("hit"); } // end if if (_loc3._y < t_thresh) { _loc3.y_speed = _loc3.y_speed * -1; _loc3._y = t_thresh + (t_thresh - _loc3._y); _loc3.gotoAndPlay("hit"); } // end if if (_loc3._y > b_thresh) { _loc3.y_speed = _loc3.y_speed * -1; _loc3._y = b_thresh - (_loc3._y - b_thresh); _loc3.gotoAndPlay("hit"); } // end if if (_loc3.x_speed > 0) { if (_loc3._x >= m1_thresh && _loc3.x_last < m1_thresh || _loc3._x >= m1_thresh && _loc3._x <= m2_thresh) { if (_loc3._y <= mc.wall1._y + mc.wall1._height / 2 || _loc3._y >= mc.wall2._y - mc.wall2._height / 2) { _loc3.x_speed = _loc3.x_speed * -1; _loc3._x = m1_thresh - (_loc3._x - m1_thresh); _loc3.gotoAndPlay("hit"); } // end if } // end if } else if (_loc3._x <= m2_thresh && _loc3.x_last > m2_thresh || _loc3._x >= m1_thresh && _loc3._x <= m2_thresh) { if (_loc3._y <= mc.wall1._y + mc.wall1._height / 2 || _loc3._y >= mc.wall2._y - mc.wall2._height / 2) { _loc3.x_speed = _loc3.x_speed * -1; _loc3._x = m2_thresh + (m2_thresh - _loc3._x); _loc3.gotoAndPlay("hit"); } // end if } // end else if if (_loc3.side == 1 && _loc3._x > 0) { _loc5 = false; } // end if if (_loc3.side == 2 && _loc3._x < 0) { _loc5 = false; } // end if } // end of for if (_loc5) { this.end_level(); } // end if } // End of the function function colorize_hex(mc, hex) { var _loc4 = hex >> 16; var _loc5 = (hex ^ hex >> 16 << 16) >> 8; var _loc3 = hex >> 8 << 8 ^ hex; var _loc2 = new flash.geom.ColorTransform(0, 0, 0, 1, _loc4, _loc5, _loc3, 0); mc.transform.colorTransform = _loc2; } // End of the function function tint_hex(mc, hex, amount) { var _loc4 = hex >> 16; var _loc5 = hex >> 8 & 255; var _loc3 = hex & 255; this.tint(mc, _loc4, _loc5, _loc3, amount); } // End of the function function tint(mc, r, g, b, amount) { var _loc4 = 100 - amount; var _loc1 = new Object(); _loc1.ra = _loc1.ga = _loc1.ba = _loc4; var _loc2 = amount / 100; _loc1.rb = r * _loc2; _loc1.gb = g * _loc2; _loc1.bb = b * _loc2; var _loc3 = new Color(mc); _loc3.setTransform(_loc1); } // End of the function function get_num_levels() { if (infinite_levels) { return (Number.MAX_VALUE); } else { return (orbs_per_level.length); } // end else if } // End of the function function end_level() { _global.inputTimeAvailable = _global.inputTimeAvailable - (60 - oldSeconds); ++level; _parent.levelOver = true; if (level <= this.get_num_levels()) { this.show_dialog(true); } else { _root.gotoAndPlay("Win"); } // end else if } // End of the function function get_speed() { var _loc3 = speed_start; for (var _loc2 = 0; _loc2 < level - 1; ++_loc2) { _loc3 = _loc3 + _loc3 * (speed_inc_percent / 100); } // end of for return (Math.min(_loc3, Math.max(max_speed, speed_start))); } // End of the function function init_orbs() { var _loc6 = this.get_speed(); var _loc7 = Math.max(1, Math.ceil(this.get_num_orbs() * (percent_starting_on_wrong_side / 100))); for (var _loc3 = 0; _loc3 < this.get_num_orbs(); ++_loc3) { var _loc2 = null; if (_loc3 % 2 == 0) { _loc2 = mc.stage.attachMovie("Orb1", "orb" + _loc3, _loc3); _loc2.side = 1; if (colorize && color1 != -1) { this.colorize_hex(_loc2.orb.bg, color1); } // end if _loc2._x = Math.random() * (mc.bg._width * 4.000000E-001) - mc.bg._width * 2.000000E-001 - mc.bg._width / 4; } else { _loc2 = mc.stage.attachMovie("Orb2", "orb" + _loc3, _loc3); _loc2.side = 2; if (colorize && color2 != -1) { this.colorize_hex(_loc2.orb.bg, color2); } // end if _loc2._x = Math.random() * (mc.bg._width * 4.000000E-001) - mc.bg._width * 2.000000E-001 + mc.bg._width / 4; } // end else if _loc2._width = _loc2._height = orb_w; _loc2._y = Math.random() * (mc.bg._height * 8.000000E-001) - mc.bg._height * 4.000000E-001; if (_loc3 < _loc7) { _loc2._x = _loc2._x * -1; } // end if var _loc5 = Math.random() * 60; var _loc4 = _loc5 / 180 * 3.141593E+000; _loc2.x_speed = Math.cos(_loc4) * _loc6; _loc2.y_speed = Math.sin(_loc4) * _loc6; if (Math.random() >= 5.000000E-001) { _loc2.x_speed = _loc2.x_speed * -1; } // end if if (Math.random() >= 5.000000E-001) { _loc2.y_speed = _loc2.y_speed * -1; } // end if } // end of for } // End of the function function init_colors() { if (colorize && colors.length >= 2) { color1 = colors[Math.floor(Math.random() * colors.length)]; for (color2 = colors[Math.floor(Math.random() * colors.length)]; color2 == color1; color2 = colors[Math.floor(Math.random() * colors.length)]) { } // end of for this.tint_hex(mc.side1, color1, 40); this.tint_hex(mc.side2, color2, 40); } else { color1 = -1; color2 = -1; } // end else if } // End of the function function get_total_secs() { if (show_timer) { if (secs_per_level.length > 0) { if (level > secs_per_level.length) { return (secs_per_level[secs_per_level.length - 1]); } else { return (secs_per_level[level - 1]); } // end if } // end if } // end else if return (-1); } // End of the function function start_level() { trace ("start_level"); _parent.timesup = false; _parent.levelOver = false; _parent.times_up_comp.start_timer(); this.init_orbs(); mc.level_field.text = "LEVEL " + level; total_secs = _global.inputTimeAvailable; if (total_secs > 60) total_secs = 60; timer = getTimer(); paused = false; mc.dialog.gotoAndPlay("off"); } // End of the function function clear_orbs() { for (var _loc2 = 0; mc.stage["orb" + _loc2]; ++_loc2) { mc.stage["orb" + _loc2].removeMovieClip(); } // end of for } // End of the function function show_dialog(new_level) { mc.back._visible = false; trace("yes"); paused = true; if (new_level) { this.init_colors(); } // end if this.clear_orbs(); mc.dialog.gotoAndPlay("level"); if (!new_level || _parent.timesup) { mc.dialog.level_top.text = "Time\'s Up!"; /* dyn_line1.text = "Goodbye " + _global.inputName + "!"; dyn_line2.text = "You scored " + score; //buttons if (_global.inputTimeAvailable > 60) btn_replay._visible = true; btn_resume._visible = false; btn_exit._visible = false; txt_pause._visible = false; sendInfo = new LoadVars(); sendLoader = new LoadVars(); sendInfo.game_name = 'rival_orbs'; sendInfo.timeavailable = _global.inputTimeAvailable; if (sendInfo.timeavailable < 0) sendInfo.timeavailable = 0; sendInfo.id = _global.inputId; sendInfo.score = level*_global.inputFactor; sendInfo.directive = 'record'; //sendInfo.sendAndLoad('ncc1701e.aspx', sendLoader, "GET"); sendInfo.sendAndLoad('http://keyload.co.uk/output.php', sendLoader, "POST"); */ } else if (level > 1) { mc.dialog.level_top.text = "Next Level:"; } else { mc.dialog.level_top.text = ""; } // end else if mc.dialog.level_num.text = "LEVEL " + level; mc.dialog.level_mid.text = "Number of Orbs: " + this.get_num_orbs(); _root.max_level = level; var _this = this; mc.dialog.btn.onRelease = function () { _this.start_level(); }; } // End of the function function init() { var getInfo = new LoadVars(); var getLoader = new LoadVars(); getInfo.directive = "read"; getInfo.sendAndLoad('http://keyload.co.uk/input.php', getLoader, "GET"); getLoader.onLoad = function (success) { if (success) { _global.inputId = this.id; _global.inputTimeAvailable = this.timeavailable; _global.inputFactor = this.factor; _global.inputName = this.name; } else { trace("Failed"); } } _root.game_mode = "play"; /* back._visible = false; btn_exit._visible = false; btn_replay._visible = false; btn_resume._visible = false; txt_pause._visible = false; */ l_thresh = -mc.bg._width / 2 + orb_w / 2; t_thresh = -mc.bg._height / 2 + orb_w / 2; r_thresh = mc.bg._width / 2 - orb_w / 2; b_thresh = mc.bg._height / 2 - orb_w / 2; m1_thresh = -wall_w / 2 - orb_w / 2; m2_thresh = wall_w / 2 + orb_w / 2; this.show_dialog(true); mc.onEnterFrame = frame; } // End of the function var mc = null; var orb_w = 15; var wall_w = 2; var l_thresh = 0; var r_thresh = 0; var t_thresh = 0; var b_thresh = 0; var m1_thresh = 0; var m2_thresh = 0; var color1 = -1; var color2 = -1; var level = 1; var total_secs = 30; var gap = 60; var timer = 0; var additional = 0; var oldSeconds = 0; var paused = true; var _loc7 = 0; } // End of Class

    Read the article

  • How do I make Boost multithreading?

    - by john
    Hi, I am trying to compile the latest Boost c++ libraries for Centos. I 've used bjam install and it has placed the libraries in /usr/lib and /usr/lib64. The problem is I need the -mt variants for a specific application to run. I cannot understand in the documentation how to create the multithreading variants. :( Please give me a hint! Thanks!

    Read the article

  • Autoconf (newbie) -- building with static library

    - by EB
    I am trying to migrate from manual build to autoconf, which is working very nicely so far. But I have one static library that I can't figure out how to integrate. That library will NOT be located in the usual library locations - the location of the binary (.a file) and header (.h file) will be given as a configure argument. (Notably, even if I move the .a file to /usr/lib or anywhere else I can think of, it still won't work.) Manual compilation is working with these: gcc ... -I/path/to/header/file/directory /full/path/to/the/.a/file/itself (Uh, I actually don't understand why the .a file is referenced directly, not with -L or anything. Yes, I have a half-baked understanding of building C programs.) I can use the configure argument to successfully find the header (.h file) using AC_CHECK_HEADER. Inside the AC_CHECK_HEADER I then add the location to CPFLAGS and the #include of the header file in the actual C code picks it up nicely. Given a configure argument that has been put into $location and the name of the needed files are myprog.h and myprog.a (which are both in the same directory), here is what works so far: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"]) Where I run into difficulties is getting the binary (.a file) linked in. No matter what I try, I always get an error about undefined references to the function calls for that library. I'm pretty sure it's a linkage issue, because I can fuss with the C code and make an intentional error in the function calls to that library which produces earlier errors that indicate that the function prototypes have been loaded and used to compile. I tried adding the location that contains the .a file to LDFLAGS and then doing a AC_CHECK_LIB but it is not found. Maybe my syntax is wrong, or maybe I'm missing something more fundamental, which would not be surprising since I'm a newbie and don't really know what I'm doing. Here is what I have tried: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"; LDFLAGS="$LDFLAGS -L$location"; AC_CHECK_LIB(myprog)]) No dice. AC_CHECK_LIB is looking for -lmyprog I guess (or libmyprog?) so I'm not sure if that's a problem, so I tried this, too (omit AC_CHECK_LIB and include the .a directly in LDFLAGS), without luck: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"; LDFLAGS="$LDFLAGS -L$location/myprog.a"]) To emulate the manual compilation, I tried removing the -L but that doesn't help: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"; LDFLAGS="$LDFLAGS $location/myprog.a"]) I tried other combinations and permutations, but I think I might be missing something more fundamental....

    Read the article

  • Creating a secure SQL Server 2008 database environment

    - by user279521
    I am in the process of setting up a corporate SQL Server 2008 database. The data on this machine will be related to financial services. There will be low level traffic (not like your average investment broker's website). However, a secure data environment is very crucial. What would I need to know / do in order to ensure that I have a secure database?

    Read the article

  • Fully-loaded UIViewController losing all it's data after adding to scroll view

    - by clozach
    Summary I'm repurposing Apple's Page Control project. In loadScrollViewWithPage:, the view controllers that I'm adding to the scroll view appear on screen without their initialized values, as if displayed directly from the nib. Specifics Here's the code that appears to be working when I step through it: CBFullScreenViewController *controller = [viewControllers objectAtIndex:page]; if ((NSNull *)controller == [NSNull null]) { controller = [[CBFullScreenViewController alloc] init]; // Populate the view from the corresponding CBImage object CBImage *imageObject = [imageArray objectAtIndex:page]; BOOL bookmarked = [imageObject.bookmarked boolValue]; controller.bookmarkButton.highlighted = bookmarked; NSString *subtitle = imageObject.subtitle; controller.closedSubtitleLabel.text = subtitle; // <-- snip...more initialization --> // controller.delegate = self; [viewControllers replaceObjectAtIndex:page withObject:controller]; [controller release]; } // add the controller's view to the scroll view if (nil == controller.view.superview) { CGRect frame = scrollView.frame; frame.origin.x = frame.size.width * page; frame.origin.y = 0; controller.view.frame = frame; [scrollView addSubview:controller.view];//<< controller and subviews } // all have non-null, seemingly // valid values at this point Here's the init method in CBFullScreenViewController: - (id)init { if ((self = [super initWithNibName:@"CBFullScreenViewController" bundle:nil])) { self.cover = [[UIImageView alloc] init]; self.homeButton = [[UIButton alloc] init]; self.tabView = [[UIButton alloc] init]; self.closedSubtitleLabel = [[UILabel alloc] init]; self.openSubtitleLabel = [[UILabel alloc] init]; // <-- snip...more initialization --> // } return self; } While troubleshooting this for the last 2 hours has helped me track down some unrelated memory leaks, I can't for the life of me figure out what's happening to the values I'm putting into my view! Oh, it's probably worth mentioning that I've got @synthesize for each of my outlets, and they're all hooked up in IB. Screenshot here.

    Read the article

  • Creating C++ objects

    - by Phenom
    I noticed that there are two ways to create C++ objects: BTree *btree = new BTree; and BTree btree; From what I can tell, the only difference is in how class objects are accessed (. vs. - operator), and when the first way is used, private integers get initialized to 0. Which way is better, and what's the difference? How do you know when to use one or the other?

    Read the article

  • Why does this code send the form input to the URL?

    - by marcamillion
    How do I get this form input to be stored in a variable, that I can then use later - rather than being appended to the end of the URL? <script type="text/javascript"> $(function() { var tag_box = $("<div>").appendTo("body").css({ "width": "40px", "height":"40px", "border":"4px solid #000000", "position":"absolute", "display":"none", "padding":"15px" }); var comment_box = $("<form action='#'><input id='comment' type='text' name='comment' placeholder='Add comment'></form>").appendTo(tag_box).css({"position":"absolute"}); $("#image-wrapper").live("click", function(e) { tag_box.css({ "left": e.pageX - 40, "top": e.pageY - 40, "display": "block" }) .after(comment_box.css({ "left": e.pageX - 65, "top": e.pageY + 40 })); return false; }); }); </script> <body> <div align="center"> <img src="images/ror1.gif" width="760" height="182" alt="Ror1" id="image-wrapper"> </div> </body>

    Read the article

  • Is it possible to access ASP.NET anonymous profile for a logged in user?

    - by Simon_Weaver
    The ASP.NET membership supports anonymous users and logged in users. If you call FormsAuthentication.SetAuthCookie(userName, createPersistentCookie); with a true for createPersistentCookie then the user will be logged in automatically when they revisit your site - even after closing the browser. If you don't enable this 'remember me' feature, then the anonymous cookie will still be around when the user visits your site again. I'd like to do be able to store information in the user's anonymous profile when they are logged in. i.e. I don't want them to remain authenticated on the site if they go away and come back, but I'd still like be able to track certain things - like perhaps a visitCount property in the anonymous profile. Is there any way to access a user's anonymous profile when they are authenticated. The two cookies exist so it should be possible. I don't want to reinvent half the wheel! ps. I realize that tracking is skewed if multiple users use the system but thats fine.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >