Daily Archives

Articles indexed Sunday April 11 2010

Page 12/79 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Creating get/set method dynamically in javascript

    - by portoalet
    I am trying to create a UserDon object, and trying to generate the get and set methods programmatically ( based on Pro Javascript book by John Resig page 37 ), and am testing this on Firefox 3.5 The problem is: in function UserDon, "this" refers to the window object instead of the UserDon object. So after calling var userdon = new UserDon(...) I got setname and getname methods created on the window object (also setage and getage). How can I fix this? function UserDon( properties ) { for( var i in properties ) { (function(){ this[ "get" + i ] = function() { return properties[i]; }; this[ "set" + i ] = function(val) { properties[i] = val; }; })(); } } var userdon = new UserDon( { name: "Bob", age: 44 });

    Read the article

  • Change environment in cake php

    - by ryudice
    I just started with cakePHP for a small project, I have rails experience and I can see they are really similar however I cant seem to find where to chagne the environment you are working? I'm current working with test because I see all those debugging messages but I want to see how the design looks and I need to get rid of those messages so I need to change environment to production.

    Read the article

  • css issue for alignment of divs

    - by jay
    Hi, I am working on this site philippdecor.com and I am having a difficulty in figuring out this css issue. When I on mouse over on "Main categories" that appears on the right side, it shows a drop down with links in it. Two things happens, 1) in IE(7) - the drop down hides behind another div 2) in both ie and ff, it pushes other div below that to go down and on mouse out, it looks fine. I am not sure which css property can fix this. please help me out code

    Read the article

  • How to distinguish between two different UDP clients on the same IP address?

    - by Ricket
    I'm writing a UDP server, which is a first for me; I've only done a bit of TCP communications. And I'm having trouble figuring out exactly how to distinguish which user is which, since UDP deals only with packets rather than connections and I therefore cannot tell exactly who I'm communicating with. Here is pseudocode of my current server loop: DatagramPacket p; socket.receive(p); // now p contains the user's IP and port, and the data int key = getKey(p); if(key == 0) { // connection request key = makeKey(p); clients.add(key, p.ip); send(p.ip, p.port, key); // give the user his key } else { // user has a key // verify key belongs to that IP address // lookup the user's session data based on the key // react to the packet in the context of the session } When designing this, I kept in mind these points: Multiple users may exist on the same IP address, due to the presence of routers, therefore users must have a separate identification key. Packets can be spoofed, so the key should be checked against its original IP address and ignored if a different IP tries to use the key. The outbound port on the client side might change among packets. Is that third assumption correct, or can I simply assume that one user = one IP+port combination? Is this commonly done, or should I continue to create a special key like I am currently doing? I'm not completely clear on how TCP negotiates a connection so if you think I should model it off of TCP then please link me to a good tutorial or something on TCP's SYN/SYNACK/ACK mess. Also note, I do have a provision to resend a key, if an IP sends a 0 and that IP already has a pending key; I omitted it to keep the snippet simple. I understand that UDP is not guaranteed to arrive, and I plan to add reliability to the main packet handling code later as well.

    Read the article

  • How to evaluate query by DBMS?

    - by Kevinniceguy
    Sorry...I mean what question will be for this query? SELECT SUM(price) FROM Room r, Hotel h WHERE r.hotelNo = h.hotelNo and hotelName = 'Paris Hilton' and roomNo NOT IN (SELECT roomNo FROM Booking b, Hotel h WHERE (dateFrom <= CURRENT_DATE AND dateTo >= CURRENT_DATE) AND b.hotelNo = h.hotelNo AND hotelName = 'Paris Hilton');

    Read the article

  • How can I select the pixels from an image in opencv?

    - by ajith
    This is refined version of my previous question. Actually I want to do following operation... summation for all k|(i,j)?wk [(Ii-µk)*(Ij-µk)], where wk is a 3X3 window, µk is the mean of wk, Ii & Ij are the intensities of the image at i and j. I dont know how to select Ii & Ij separately from an image which is 2 dimensional[Iij]...or does the equation mean anything else?

    Read the article

  • What is a good software development plan?

    - by Totophil
    Whilst browsing through answers on SO I came across something that is, in my view, one of the more frequent software development management misconceptions: "[software development] plan is a reasonably detailed description of all the activities you need to undertake". Hence the question: what is good software development plan? Can it be boiled down just to a work breakdown structure; is WBS the single most important thing for a software development plan anyway?

    Read the article

  • What is the most efficient way to solve system of equations containing the digamma function?

    - by Neil G
    What is the most efficient way to solve system of equations involving the digamma function? I have a vector v and I want to solve for a vector w such that for all i: digamma(sum(w)) - digamma(w_i) = v_i and w_i 0 I found the gsl function gsl_sf_psi, which is the digamma function (calculated using some kind of series.) Is there an identity I can use to reduce the equations? Is my best bet to use a solver? I am using C++0x; which solver is easiest to use and fast?

    Read the article

  • Shared Library Issues In Linux

    <b>Innovations:</b> "Shared libraries are one of the many strong design features of Linux, but can lead to headaches for inexperienced users, and even experienced users in certain situations."

    Read the article

  • Debug the PHP interpreter with GDB.

    - by The Rook
    I would like to use GDB to step though the C++ code that makes up the php.so Apache extension. I want to see what PHP is doing while its running a PHP application. Preferably i would use an IDE like Netbeans or Eclipse on a LAMP system.

    Read the article

  • How to properly use references with variadic templates

    - by Hippicoder
    I have something like the following code: template<typename T1, typename T2, typename T3> void inc(T1& t1, T2& t2, T3& t3) { ++t1; ++t2; ++t3; } template<typename T1, typename T2> void inc(T1& t1, T2& t2) { ++t1; ++t2; } template<typename T1> void inc(T1& t1) { ++t1; } I'd like to reimplement it using the proposed variadic templates from the upcoming standard. However all the examples I've seen so far online seem to be printf like examples, the difference here seems to be the use of references. I've come up with the following: template<typename T> void inc(T&& t) { ++t; } template<typename T,typename ... Args> void inc(T&& t, Args&& ... args) { ++t inc(args...); } What I'd like to know is: Should I be using r-values instead of references? Possible hints or clues as to how to accomplish what I want correctly. What guarantees does the new proposed standard provide wrt the issue of the recursive function calls, is there some indication that the above variadic version will be as optimal as the original? (should I add inline or some-such?)

    Read the article

  • How do I change the environment in CakePHP?

    - by ryudice
    I just started using CakePHP for a small project. I have rails experience, and I can see Cake and Rails are really similar, but I can't seem to find where to change the environment in which you are working. How can I do so? I'm currently working with test because I want to see all those debugging messages, but I want to see how the final design looks and I need to get rid of those messages. How can I change the environment to production?

    Read the article

  • Using Rails, problem testing has_many relationship

    - by east
    The summary is that I've code that works when manually testing, but isn't doing what I would think it should when trying to build an automated test. Here are the details: I've two models: Payment and PaymentTranscation. class Payment ... has_many :transactions, :class_name => 'PaymentTransaction' class PaymentTranscation ... belongs_to payment The PaymentTransaction is only created in a Payment model method, like so: def pay_up ... transactions.create!(params...) ... end I've manually tested this code, inspected the database, and everything works well. The failing automated test looks like this: def test_pay_up purchase = Payment.new(...) assert purchase.save assert_equal purchase.state, :initialized.to_s assert purchase.pay_up # this should create a new PaymentTransaction... assert_equal purchase.state, :succeeded.to_s assert_equal purchase.transactions.count, 1 # FAILS HERE; transactions is an empty array end If I step through the code, it's clear that the PaymentTransaction is getting created correctly (though I can't see it in the database because everything is in a testing transaction). What I can't figure out is why transactions is returning an empty array in the test when I know a valid PaymentTransaction is getting created. Anybody have some suggestions? Thanks in advance, east

    Read the article

  • what is the question for the query?

    - by Kevinniceguy
    Sorry...I mean what question will be for this query? SELECT SUM(price) FROM Room r, Hotel h WHERE r.hotelNo = h.hotelNo and hotelName = 'Paris Hilton' and roomNo NOT IN (SELECT roomNo FROM Booking b, Hotel h WHERE (dateFrom <= CURRENT_DATE AND dateTo >= CURRENT_DATE) AND b.hotelNo = h.hotelNo AND hotelName = 'Paris Hilton');

    Read the article

  • Faster integer division when denominator is known?

    - by aaa
    hi I am working on GPU device which has very high division integer latency, several hundred cycles. I am looking to optimize divisions. All divisions by denominator which is in a set { 1,3,6,10 }, however numerator is a runtime positive value, roughly 32000 or less. due to memory constraints, lookup table is not option. Can you think of alternatives? I have thought of computing float point inverses, and using those to multiply numerator. Thanks

    Read the article

  • Connect bluetooth headphones both to PC and phone at the same time

    - by Sergiy Byelozyorov
    I have recently bought Philips SHB6110. Extract from the 13th page of manual: Therefore you can connect your Bluetooth stereo headset. with a Bluetooth stereo enabled phone to both listen to music and lead calls, or with a Bluetooth phone that does not support Bluetooth stereo (A2DP) to lead calls and at the same time to a Bluetooth audio device (Bluetooth enabled MP3 player, Bluetooth audio adapter etc.) to listen to music. Make sure to pair the phone first with your Bluetooth headset, then turn both the phone and headset off to then pair the Bluetooth audio device. With the SwitchStream feature you can listen to music and monitor your calls at the same time. Even while listening to music, you will hear a ring tone when receiving a call and can switch to the call simply by tapping the button. The manual however doesn't specify how do I connect to both device at the same time. I use Toshiba Satellite Pro P300-1CG laptop with Belkin Mini Bluetooth Adapter and Nokia N95 phone. Operating system is Windows 7 64-bit and I have Skype installed. Both phone and compute can be used for listening to music and talking on the phone (on PC via Skype). Best solution would be if I could connect to PC and phone as the same time and monitor calls both mobile and Skype calls while listening music from Winamp. If that is not possible, then I would like at least to be able to listen music from PC, while monitoring calls from mobile. So, please tell me how do I connect both PC and phone to headphones?

    Read the article

  • Using Shapefile data to determine neighborhood for a longitude/latitude

    - by Kunal
    I'm trying to determine the neighborhood for a location, based on Zillow's freely published Shapefile data. I don't really know anything about the Shapefile format, and am having some trouble finding tutorials online -- but I basically want to take latitude/longitude pairs, and run it against the Shapefile data to determine the corresponding neighborhood(s). Can anyone point me in the right direction? Not even sure where to start. This is where I've grabbed the Shapefile files: http://www.zillow.com/howto/api/neighborhood-boundaries.htm

    Read the article

  • Setting up Mercurial/TortoiseHg to work with UltraCompare

    - by Tim Pietzcker
    Hi, I'm trying to get my favorite Windows diff/merge tool, UltraCompare (V7.00) to work with Mercurial/TortoiseHg. I have set up UltraCompare in my Mercurial.ini like this (only relevant bits shown): [merge-tools] UltraCompare.executable = C:\Programme\IDM Computer Solutions\UltraCompare\uc.com UltraCompare.args = $base $local $other UltraCompare.priority = 1 UltraCompare.gui = True UltraCompare.binary = True UltraCompare.checkconflicts = True UltraCompare.checkchanged = True However, the three-way-merge fails. The path names get messed up if the path to the repository that is being merged to contains a space. I have done some more testing, and I've found out (using Process Explorer) that uc.com is called with a broken command line if there is a space in the repository's path: Compare "C:\Programme\IDM Computer Solutions\UltraCompare\uc.exe" " "c:\dokume~1\tim~1.pie\lokale~1\temp\test.txt~base.akr6au" "E:\Eigene Dateien\test\test-merge\test.txt" "c:\dokume~1\tim~1.pie\lokale~1\temp\test.txt~other.b92442" and "C:\Programme\IDM Computer Solutions\UltraCompare\uc.com" "c:\dokume~1\tim~1.pie\lokale~1\temp\test.txt~base.e7vryp" "E:\test\test-merge\test.txt" "c:\dokume~1\tim~1.pie\lokale~1\temp\test.txt~other.u_qxme" There is an extraneous " after the path of the executable in the first example - not in the second (which works fine). To me, it seems as if UltraCompare is doing everything right, and that Mercurial/TortoiseHg are passing a defective command line to it. Would you say so, too? Is there a workaround? I've just updated to Mercurial 1.5/TortoiseHg 1.0, and the problem persists. Support for other merge tools (Beyond Compare and others) has been added, sadly not UltraCompare...

    Read the article

  • Fast way to set text format for a range of Text using TLF

    - by wezzy
    Hi, i have to set the text format for some tokens in a plain text. I'm trying to use the Text Layout Framework to improve the speed of the operation but i've founded that TLF is far slower (10X in my tests) than the old setTextFormat(). For each token i call this function: public function setTextFormat(format:TextLayoutFormat, begin:int, end:int):void{ var selection:SelectionState = new SelectionState(this._textFlow, begin, end, this._normalFormat); IEditManager(_textFlow.interactionManager).applyLeafFormat(format, selection); } is there any faster and clever way to do this operation ? Thanks

    Read the article

  • Problem with grails web app running in production: "No such property: save for class: JsecRole"

    - by Sarah Boyd
    I've got a grails 1.1 web app running great in development but when I try and run it in production with an sqlserver database it crashes in a weird way. The relevant part of my datasource.groovy is as follows: environments { development { dataSource { dbCreate = "create-drop" // one of 'create', 'create-drop','update' url = "jdbc:hsqldb:mem:devDB" } } test { dataSource { dbCreate = "update" url = "jdbc:hsqldb:mem:testDb" } } production { dataSource { dbCreate = "update" driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver" endUsername = "sa" password = "pw4db" url = "jdbc:sqlserver://localhost:1433;databaseName=ReleasePlanner;selectMethod=cursor" The error message I receive is: Message: No such property: save for class: JsecRole Caused by: groovy.lang.MissingPropertyException: No such property: save for class: JsecRole Class: ProjectController At Line: [28] Code Snippet: 27: println "###about to create project roles" 28: userManagerService.createProjectRoles(project) 29: userManagerService.addUserToProject(session.user.id.toString(), project, 'owner') } } } The stacktrace is as follows: org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingPropertyException: No such property: save for class: JsecRole at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382) at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180) Caused by: groovy.lang.MissingPropertyException: No such property: save for class: JsecRole at UserManagerService.createProjectRoles(UserManagerService.groovy:9) at UserManagerService$$FastClassByCGLIB$$6fa73713.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at UserManagerService$$EnhancerByCGLIB$$fcf60984.createProjectRoles(<generated>) at UserManagerService$createProjectRoles.call(Unknown Source) at ProjectController$_closure4.doCall(ProjectController.groovy:28) at ProjectController$_closure4.doCall(ProjectController.groovy) ... 2 more Any help is appreciated. Thanks Sarah

    Read the article

  • Force-directed graphing

    - by David
    Hello, I'm trying to write a force-directed or force-atlas code base for a graphing application I'm building for myself. Here is an example of what I'm attempting: http://sawamuland.com/flash/graph.html I managed to find some pseudo code to accomplish what I'd like on the Wiki Force-atlas article. I've converted this into ActionScript 3.0 code since it's a Flash application. Here is my source: var timestep:int = 0; var damping:int = 0; var total_kinetic_engery:int = 0; for (var node in list) { var net_force:int = 0; for (var other_node in list) { net_force += coulombRepulsion(node, other_node, nodeList); } for (var spring in list[node].relations) { net_force += hookeAttraction(node, spring, nodeList); } list[node].velocity += (timestep * net_force) * damping; list[node].position += timestep * list[node].velocity; total_kinetic_engery += list[node].mass * (list[node].velocity) ^ 2; } The problem now is finding pseudo code or a function to perform the the coulomb repulsion and hooke attraction code. I'm not exactly sure how to accomplish this. Does anyone know of a good reference I can look at...understand and implement quickly? Best.

    Read the article

  • Hi There!! Problems using 2 simplemodal osx calls

    - by Marcos
    Well, i´m developing a webpage that contains two tags (program and events), that shows two different contents. When I click the program button(it´s a tag), it´s ok, it´s shows the table on the div´s. But, when I click the events button, again it´s shows the program tag contents, and I want to show the events table content. I´ve read de solution for this question on this site, but not happens, when i change my JS file, the content of both tags disapears. Please, somebody help me!...Thank´s

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >