Daily Archives

Articles indexed Sunday July 8 2012

Page 9/13 | < Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >

  • 2D Collision in Canvas - Balls Overlapping When Velocity is High

    - by kushsolitary
    I am doing a simple experiment in canvas using Javascript in which some balls will be thrown on the screen with some initial velocity and then they will bounce on colliding with each other or with the walls. I managed to do the collision with walls perfectly but now the problem is with the collision with other balls. I am using the following code for it: //Check collision between two bodies function collides(b1, b2) { //Find the distance between their mid-points var dx = b1.x - b2.x, dy = b1.y - b2.y, dist = Math.round(Math.sqrt(dx*dx + dy*dy)); //Check if it is a collision if(dist <= (b1.r + b2.r)) { //Calculate the angles var angle = Math.atan2(dy, dx), sin = Math.sin(angle), cos = Math.cos(angle); //Calculate the old velocity components var v1x = b1.vx * cos, v2x = b2.vx * cos, v1y = b1.vy * sin, v2y = b2.vy * sin; //Calculate the new velocity components var vel1x = ((b1.m - b2.m) / (b1.m + b2.m)) * v1x + (2 * b2.m / (b1.m + b2.m)) * v2x, vel2x = (2 * b1.m / (b1.m + b2.m)) * v1x + ((b2.m - b1.m) / (b2.m + b1.m)) * v2x, vel1y = v1y, vel2y = v2y; //Set the new velocities b1.vx = vel1x; b2.vx = vel2x; b1.vy = vel1y; b2.vy = vel2y; } } You can see the experiment here. The problem is, some balls overlap each other and stick together while some of them rebound perfectly. I don't know what is causing this issue. Here's my balls object if that matters: function Ball() { //Random Positions this.x = 50 + Math.random() * W; this.y = 50 + Math.random() * H; //Random radii this.r = 15 + Math.random() * 30; this.m = this.r; //Random velocity components this.vx = 1 + Math.random() * 4; this.vy = 1 + Math.random() * 4; //Random shade of grey color this.c = Math.round(Math.random() * 200); this.draw = function() { ctx.beginPath(); ctx.fillStyle = "rgb(" + this.c + ", " + this.c + ", " + this.c + ")"; ctx.arc(this.x, this.y, this.r, 0, Math.PI*2, false); ctx.fill(); ctx.closePath(); } }

    Read the article

  • How can I keep the correct alpha during rendering particles?

    - by April
    Rencently,I was trying to save textures of 3D particles so that I can reuse the in 2D rendering.Now I had some problem with alpha channel.Some artist told me I that my textures should have unpremultiplied alpha channel.When I try to get the rgb value back,I got strange result.Some area went lighter and even totally white.I mainly focus on additive and blend mode,that is: ADDITIVE: srcAlpha VS 1 BLEND: srcAlpha VS 1-srcAlpha I tried a technique called premultiplied alpha.This technique just got you the right rgb value,its all you need on screen.As for alpha value,it worked well with BLEND mode,but not ADDITIVE mode.As you can see in parameters,BLEND mode always controlled its value within 1.While ADDITIVE mode cannot guarantee. I want proper alpha,but it just got too big or too small consider to rgb.Now what can I do?Any help will be great thankful. PS:If you don't understand what I am trying to do,there is a commercial software called "Particle Illusion".You can create various particles and then save the scene to texture,where you can choose to remove background of particles.

    Read the article

  • Django - Add rows to MySQL database

    - by yeenow123
    So I already have a database setup with a few columns and a few rows already inserted in. I'm trying to create a view that you would just input information into a form and press Submit, then a row would be added to the MySQL database with the information you just typed in. I believe you can do this with admin, but I would like to try without admin and I'm not sure if this is possible? I've been using the MySQL commandline to add rows as of now..

    Read the article

  • PHP the SELECT FROM WHERE col IN no working using array

    - by Sam Ram San
    I'm trying to pull some data from MySQL using an Array that was fetch from a first query. Everything's fine all the way to the implode after that, it's been a headache for me. Can someone help me? <?php $var = 'somedata'; include("config/conect.php"); $zip="SELECT * FROM table WHERE firstcol LIKE '%$var%' ORDER BY seconcol"; $results = $connetction->query($zip); while ($row = $results->fetch_array()){ $mycode[]=$row['zip']; } array_pop($mycode); $mycode = implode(', ',$mycode); //print_r ($mycode); echo '<br /><br /><br />'; $usr="SELECT * FROM reg_temp WHERE zip IN('".join("','", $mycode)."')"; $results = $asies->query($usr); while ($row = $results-> fetch_arra()) { $name = $row['name']; echo $name; } ?>

    Read the article

  • python input UnicodeDecodeError:

    - by The man on the Clapham omnibus
    python 3.x >>> a = input() hope >>> a 'hope' >>> b = input() håpe >>> b 'håpe' >>> c = input() start typing hå... delete using backspace... and change to hope Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 1: invalid continuation byte >>> The situation is not terrible, I am working around it, but find it strange that when deleting, the bytes get messed up. Has anyone else experienced this? the terminal history shows that I thought that I entered h?ope any ideas? in the script that is using this, I do import readline to give command line history.

    Read the article

  • Is it possible to embed a flash player in a table and retain the table properties

    - by user1494241
    I'd like to embed a music (flash) player in a table with clickable images but the embed code seems to throw the table properties off - it extends the width of the table. Is it possible to embed the player on the same row as the image whilst still retaining the table width? Here's what I've been using: <table width="620" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div align="left"><object height="18" width="100%"> <param name="movie" value="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1253725&amp;auto_play=false&amp;player_type=tiny&amp;font=Georgia&amp;color=9a6600&show_playcount=false&default_width=375&default_height=40&show_user=false"></param> <param name="allowscriptaccess" value="always"></param> <param name="wmode" value="transparent"></param><embed wmode="transparent" allowscriptaccess="always" height="18" src="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1253725&amp;auto_play=false&amp;player_type=tiny&amp;font=Georgia&amp;color=9a6600&show_playcount=false&default_width=375&default_height=40&show_user=false" type="application/x-shockwave-flash" width="100%"></embed> </object> </td> <td> <div align="right"><img src="http://dl.dropbox.com/u/31856944/Virb/splash_freedownload-2.png" border="0" width="245" height="42" usemap="#Map" /></div> </td> <tr> <td> <div align="right"><img src="http://dl.dropbox.com/u/31856944/Virb/splash_share-2.png" border="0" width="620" height="31" usemap="#Map2" /></div> </td> </tr> </table>

    Read the article

  • extracting multiple tags from xml using PHP

    - by user1479431
    Here is my address.xml <?xml version="1.0" ?> <!--Sample XML document --> <AddressBook> <Addressentry> <firstName>jack</firstName> <lastName>S</lastName> <Address>2899,Ray Road</Address> <Email>[email protected]</Email> </Addressentry> <Addressentry> <firstName>Sid</firstName> <lastName>K</lastName> <Address>238,Baseline Road,TX</Address> <Email>[email protected]</Email> <Email>[email protected]</Email> </Addressentry> <Addressentry> <firstName>Satya</firstName> <lastName>Yar</lastName> <Address>6,Rural Road,Tempe,AZ</Address> <Email>[email protected]</Email> <Email>[email protected]</Email> <Email>[email protected]</Email> </Addressentry> </AddressBook> I am trying to load all the entries using PHP code as below. Each addressentry can have one or more tags. Right now from the code below I am able to extract only one tag. My question is how do I extract all tags associated with particular Addressentry. that is I want to print all emails on the same line. <?php $theData = simplexml_load_File("address.xml"); foreach($theData->Addressentry as $theAddress) { $theFirstName = $theAddress->firstName; $theLastName = $theAddress->lastName; $theAdd = $theAddress->Address; echo "<p>".$theFirstName." ".$theLastName."<br/> ".$theAdd."<br/> ".$theAddress->Email."<br/> </p>"; unset($theFirstName); unset($theLastName); unset($theAdd); unset($theEmail); } ?> Any help would be appreciated

    Read the article

  • Powershell GUI: Adding multiple instances of .tooltipseperate to menu

    - by obious
    So, I'm having a problem whereby for some reason I can only add one instance of a .tooltipseperator to a drop down menu. E.g. I have to create a new .tooltipseperator if I want to add another to a different menu list. I have this: $seperator = new-object System.Windows.Forms.Toolstripseparator $seperator1 = new-object System.Windows.Forms.Toolstripseparator which correlates to this: [Void]$packages_menu_bar.DropDownItems.Add($seperator1) [Void]$packages_menu_bar.DropDownItems.Add($Remove_from_AD) [Void]$process.DropDownItems.Add($Kill_process) [Void]$process.DropDownItems.Add($seperator) My question is this: how can I add the same instance on a .tooltipseperater to different menu items? Some sort of array? Thanks

    Read the article

  • How to resize controls at runtime in java

    - by user1349213
    Is there a way to resize a control, a JTextfield for example, at runtime in java? I want my textfield to have the resize cursors (just like when you point your cursor on the corner of a window) and will be able to resize on runtime. Ive read on the internet that vb6 and C# have those capabilities, is there anything for java? A sample code or a link to a good tutorial will be very much appreciated. Thank you.

    Read the article

  • Remove alert from a javascript

    - by albastar
    I've the below code from a tutorial,i want the action but i just want to remove the alert, here is the code: <script type="text/javascript"> setTimeout('read()', 10000); function read() { FB.api('/me/news.reads' + '?article=<?php echo $fbrdurl ?>&access_token=<?php echo $access_token ?>','post', function(response) { var msg = 'Error occured'; if (!response || response.error) { if (response.error) { msg += "\n\nType: "+response.error.type+"\n\nMessage: "+response.error.message; } alert(msg); } else { alert('Post was successful! Action ID: ' + response.id); } }); } </script> I've tried this: <script type="text/javascript"> setTimeout('read()', 10000); function read() { FB.api('/me/news.reads' + '?article=<?php echo $fbrdurl ?>&access_token=<?php echo $access_token ?>','post'; } </script> but not worked, thanks

    Read the article

  • What is wrong with my version of strchr?

    - by Eduard Saakashvili
    My assignment is to write my own version of strchr, yet it doesn't seem to work. Any advice would be much appreciated. Here it is: char *strchr (const char *s, int c) //we are looking for c on the string s { int dog; //This is the index on the string, initialized as 0 dog = 0; int point; //this is the pointer to the location given by the index point = &s[dog]; while ((s[dog] != c) && (s[dog] != '\0')) { //it keeps adding to dog until it stumbles upon either c or '\0' dog++; } if (s[dog]==c) { return point; //at this point, if this value is equal to c it returns the pointer to that location } else { return NULL; //if not, this means that c is not on the string } }

    Read the article

  • Joining tables, if percentage is above certain value

    - by CluelessGerman
    My question is similar to this one: Compare rows and get percentage However, little different. I adapted my question to the other post. I got 2 tables. First table: user_id | post_id 1 1 1 2 1 3 2 12 2 15 And second table: post_id | rating 1 1 1 2 1 3 2 1 2 5 3 null 3 1 3 4 12 4 15 1 So now I would like to count the rating for each post, in the second table. If the rating has more than, lets say, 50% positive ratings than I want to get the post_id and going it to the post_id from table one and add 1 to the user_id. At the end it would return the user_id with the number of positive posts. The result for above table would be: user_id | helpfulPosts 1 2 2 1 The post with post_id 1 and 3 have positive rating, because more than 50% have ratings of 1-3. The post with id = 2 is not positive, because the rating is exactly 50%. How would I achieve this? For clarification: It's a mysql rdbm and a positive post, is one where the number of rating_ids with 1, 2 and 3 are more than half of the overall rating. Basically the same thing, from the other thread I posted above.

    Read the article

  • Android: Unable to access a local website over HTTPS

    - by user1253789
    I am trying to access a locally hosted website and get its HTML source to parse. I have few questions: 1) Can I use "https://An IP ADDRESS HERE" as a valid URL to try and access. I do not want to make changes in the /etc/hosts file so I want to do it this way. 2) I cannot get the html, since it is giving me Handshake exceptions and Certificate issues. I have tried a lot of help available over the web , but am not successful. Here is the code I am using: public class MainActivity extends Activity { private TextView textView; String response = ""; String finalresponse=""; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView) findViewById(R.id.TextView01); System.setProperty("javax.net.ssl.trustStore","C:\\User\\*" ); System.setProperty("javax.net.ssl.trustStorePassword", "" ); } private class DownloadWebPageTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... urls) { TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { } } }; try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { } try { URL url = new URL("https://172.27.224.133"); HttpsURLConnection con =(HttpsURLConnection)url.openConnection(); con.setHostnameVerifier(new AllowAllHostnameVerifier()); finalresponse=readStream(con.getInputStream()); } catch (Exception e) { e.printStackTrace(); } return finalresponse; } private String readStream(InputStream in) { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(in)); String line = ""; while ((line = reader.readLine()) != null) { response+=line; } } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return response; } @Override protected void onPostExecute(String result) { textView.setText(finalresponse); } } public void readWebpage(View view) { DownloadWebPageTask task = new DownloadWebPageTask(); task.execute(new String[] { "https://172.27.224.133" }); } }

    Read the article

  • could not resolve property (complex properties)

    - by felipeoriani
    I have a asp.net mvc application with NHibernate and I do not know how to resolve a problem to query some data. I have this query: // create query var query = session.QueryOVer<Laudo>().Fetch(x => x.Equipament).Eager; // add some filters if (idEquipament.HasValue) query = query.And(x => x.Equipament.Id == idEquipament.Value); //I got the error here... if (idCompany.HasValue) query = query.And(x => x.Equipament.Company.Id == idCompany.Value); When I try to execute this query, I've got an exception with this message: "could not resolve property: Equipament.Company.Id of: DomainModel.Laudo" what can I do to fix this problem? Thanks

    Read the article

  • When to call glEnable(GL_FRAMEBUFFER_SRGB)?

    - by Steven Lu
    I have a rendering system where I draw to an FBO with a multisampled renderbuffer, then blit it to another FBO with a texture in order to resolve the samples in order to read off the texture to perform post-processing shading while drawing to the backbuffer (FBO index 0). Now I'd like to get some correct sRGB output... The problem is the behavior of the program is rather inconsistent between when I run it on OS X and Windows and this also changes depending on the machine: On Windows with the Intel HD 3000 it will not apply the sRGB nonlinearity but on my other machine with a Nvidia GTX 670 it does. On the Intel HD 3000 in OS X it will also apply it. So this probably means that I'm not setting my GL_FRAMEBUFFER_SRGB enable state at the right points in the program. However I can't seem to find any tutorials that actually tell me when I ought to enable it, they only ever mention that it's dead easy and comes at no performance cost. I am currently not loading in any textures so I haven't had a need to deal with linearizing their colors yet. To force the program to not simply spit back out the linear color values, what I have tried is simply comment out my glDisable(GL_FRAMEBUFFER_SRGB) line, which effectively means this setting is enabled for the entire pipeline, and I actually redundantly force it back on every frame. I don't know if this is correct or not. It certainly does apply a nonlinearization to the colors but I can't tell if this is getting applied twice (which would be bad). It could apply the gamma as I render to my first FBO. It could do it when I blit the first FBO to the second FBO. Why not? I've gone so far as to take screen shots of my final frame and compare raw pixel color values to the colors I set them to in the program: I set the input color to RGB(1,2,3) and the output is RGB(13,22,28). That seems like quite a lot of color compression at the low end and leads me to question if the gamma is getting applied multiple times. I have just now gone through the sRGB equation and I can verify that the conversion seems to be only applied once as linear 1/255, 2/255, and 3/255 do indeed map to sRGB 13/255, 22/255, and 28/255 using the equation 1.055*C^(1/2.4)+0.055. Given that the expansion is so large for these low color values it really should be obvious if the sRGB color transform is getting applied more than once. So, I still haven't determined what the right thing to do is. does glEnable(GL_FRAMEBUFFER_SRGB) only apply to the final framebuffer values, in which case I can just set this during my GL init routine and forget about it hereafter?

    Read the article

  • Python finding repeating sequence in list of integers?

    - by tijko
    I have a list of lists and each list has a repeating sequence. I'm trying to count the length of repeated sequence of integers in the list: list_a = [111,0,3,1,111,0,3,1,111,0,3,1] list_b = [67,4,67,4,67,4,67,4,2,9,0] list_c = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,23,18,10] Which would return: list_a count = 4 (for [111,0,3,1]) list_b count = 2 (for [67,4]) list_c count = 10 (for [1,2,3,4,5,6,7,8,9,0]) Any advice or tips would be welcome. I'm trying to work it out with re.compile right now but, its not quite right.

    Read the article

  • How to do left joins with least-n-per-group query?

    - by Nate
    I'm trying to get a somewhat complicated query working and am not having any luck whatsoever. Suppose I have the following tables: cart_items: +--------------------------------------------+ | item_id | cart_id | movie_name | quantity | +--------------------------------------------+ | 0 | 0 | braveheart | 4 | | 1 | 0 | braveheart | 9 | | . | . | . | . | | . | . | . | . | | . | . | . | . | | . | . | . | . | +--------------------------------------------+ movies: +------------------------------+ | movie_id | movie_name | ... | +------------------------------+ | 0 | braveheart | . | | . | . | . | | . | . | . | | . | . | . | | . | . | . | +------------------------------+ pricing: +-----------------------------------------+ | id | movie_name | quantity | price_per | +-----------------------------------------+ | 0 | braveheart | 1 | 1.99 | | 1 | braveheart | 2 | 1.50 | | 2 | braveheart | 4 | 1.25 | | 3 | braveheart | 8 | 1.00 | | . | . | . | . | | . | . | . | . | | . | . | . | . | | . | . | . | . | | . | . | . | . | +-----------------------------------------+ I need to join the data from the tables, but with the added complexity that I need to get appropriate price_per from the pricing table. Only one price should be returned for each cart_item, and that should be the lowest price from the pricing table where the quantity for the cart item is at least the quantity in the pricing table. So, the query should return for each item in cart_items the following: +---------------------------------------------+ | item_id | movie_name | quantity | price_per | +---------------------------------------------+ Example 1: Variable passed to the query: cart_id = 0. Return: +---------------------------------------------+ | item_id | movie_name | quantity | price_per | +---------------------------------------------+ | 0 | braveheart | 4 | 1.25 | | 1 | braveheart | 9 | 1.00 | +---------------------------------------------+ Note that this is a minimalist example and that additional data will be pulled from the tables mentioned (particularly the movies table). How could this query be composed? I have tried using left joins and subqueries, but the difficult part is getting the price and nothing I have tried has worked. Thanks for your help. EDIT: I think this is similar to what I have working with my "real" tables: SELECT t1.item_id, t2.movie_name, t1.quantity FROM cart_items t1 LEFT JOIN movies t2 ON t2.movie_name = t1.movie_name WHERE t1.cart_id = 0 Assuming I wrote that correctly (I quickly tried to "port over" my real query), then the output would currently be: +---------------------------------+ | item_id | movie_name | quantity | +---------------------------------+ | 0 | braveheart | 4 | | 1 | braveheart | 9 | +---------------------------------+ The trouble I'm having is joining the price at a certain quantity for a movie. I simply cannot figure out how to do it.

    Read the article

  • Learning to implement DIC in MVC

    - by Tom
    I am learning to apply DIC to MVC project. So, I have sketched this DDD-ish DIC-ready-ish layout to my best understanding. I have read many blogs articles wikis for the last few days. However, I am not confident about implementing it correctly. Could you please demonstrate to me how to put them into DIC the proper way? I prefer Ninject or Windsor after all the readings, but anyDIC will do as long as I can get the correct idea how to do it. Web controller... public class AccountBriefingController { //create private IAccountServices accountServices { get; set; } public AccountBriefingController(IAccountServices accsrv) accountServices = accsrv; } //do work public ActionResult AccountBriefing(string userid, int days) { //get days of transaction records for this user BriefingViewModel model = AccountServices.GetBriefing(userid, days); return View(model); } } View model ... public class BriefingViewModel { //from user repository public string UserId { get; set; } public string AccountNumber {get; set;} public string FirstName { get; set; } public string LastName { get; set; } //from account repository public string Credits { get; set; } public List<string> Transactions { get; set; } } Service layer ... public interface IAccountServices { BriefingViewModel GetBriefing(); } public class AccountServices { //create private IUserRepository userRepo {get; set;} private IAccountRepository accRepo {get; set;} public AccountServices(UserRepository ur, AccountRepository ar) { userRepo = ur; accRepo = ar; } //do work public BriefingViewModel GetBriefing(string userid, int days) { var model = new BriefingViewModel(); //<---is that okay to new a model here?? var user = userRepo.GetUser(userid); if(user != null) { model.UserId = userid; model.AccountNumber = user.AccountNumber; model.FirstName = user.FirstName; model.LastName = user.LastName; //account records model.Credits = accRepo.GetUserCredits(userid); model.Transactions = accRepo.GetUserTransactions(userid, days); } return model; } } Domain layer and data models... public interface IUserRepository { UserDataModel GetUser(userid); } public interface IAccountRepository { List<string> GetUserTransactions(userid, days); int GetUserCredits(userid); } // Entity Framework DBContext goes under here Please point out if my implementation is wrong, e.g.I can feel in AccountServices-GetBriefing - new BriefingViewModel() seems wrong to me, but I don't know how to fit the stud into DIC? Thank you very much for your help!

    Read the article

  • Clean way to perform commands in the Emacs minibuffer

    - by Christopher Monsanto
    Consider the following example: I want to read a file using ido from the minibuffer, but merge in all of the directories I use often. I can't just execute (ido-find-file) (ido-merge-work-directories) Because the second sexp will only execute after the user is finished selecting the file. The question then is: what is the best/cleanest way to execute commands in the minibuffer's command loop? The only way I know to do this is to bind my desired command to a key sequence, and add that sequence to unread-command-events so the key runs once we enter the minibuffer command loop: (setq unread-command-events (append (listify-key-sequence (kbd "M-s")) unread-command-events)) ; std key-binding for ido-merge-work-directories (ido-find-file) But that is very hacky, and I would like to know if there is a better solution. Thanks!

    Read the article

  • How can I get columns name from select query in php?

    - by Farshad Mehrvarzan
    I want to execute a SELECT query but I don't how many columns to select. Like: select name, family from persons; How can I know which columns to select? "I am currently designing a site for the execute query by users. So when the user executes this query, I won't know which columns selected. But when I want to show the results and draw a table for the user I should know which columns selected."

    Read the article

  • $_SESSION v. $_COOKIE

    - by taeja87
    I learned about $_SESSION about several weeks ago when creating a login page. I can successfully login and use it with variables. Currently I am trying to understand $_SESSION and $_COOKIE. Please correct me if I am wrong, I can use $_SESSION when logging in and moving around pages. With $_COOKIE, it is used to remember when I last visit and preferences. Another thing involving cookies is that when websites use advertisements (for example: Google AdSense), they use the cookies to track when visitor click on a advertisement, right? I can use both ($_SESSION & $_COOKIE)? I read somewhere that you can store the session_id as value for the cookie. Also, I read about security which let to me finding this: What do I need to store in the php session when user logged in?. Is using session_regenerate_id good for when a user comes back to the site? And this: How to store a cookie with php involving uniqid. For those wanting to know about the login, I use email and password. That way the user can be able to change their username. I look forward to learning more about these two from anybody who would like to share their knowledge about it. If I asked too many question, you can just answer the one that you have more experience with. If you need more information, just ask since I might have forgotten to include something. Thank You. Found this: What risks should I be aware of before allowing advertisements being placed on my website?

    Read the article

  • Mac CoreLocation Services does not ask for permissions

    - by Ryan Nichols
    I'm writing a Mac App that needs to use CoreLocation services. The code and location works fine, as long as I manually authenticate the service inside the security preference pane. However the framework is not automatically popping up with a permission dialog. The documentation states: Important The user has the option of denying an application’s access to the location service data. During its initial uses by an application, the Core Location framework prompts the user to confirm that using the location service is acceptable. If the user denies the request, the CLLocationManager object reports an appropriate error to its delegate during future requests. I do get an error to my delegate, and the value of +locationServicesEnabled is correct on CLLocationManager. The only part missing is the prompt to the user about permissions. This occurs on my development MPB and a friends MBP. Neither of us can figure out whats wrong. Has anyone run into this? Relevant code: _locationManager = [CLLocationManager new]; [_locationManager setDelegate:self]; [_locationManager setDesiredAccuracy:kCLLocationAccuracyKilometer]; ... [_locationManager startUpdatingLocation]; UPDATE: Answer It seems there is a problem with Sandboxing in which the CoreLocation framework is not allowed to talk to com.apple.CoreLocation.agent. I suspect this agent is responsible for prompting the user for permissions. If you add the Location Services Entitlement (com.apple.security.personal-information.location) it only gives your app the ability to use the CL framework. However you also need access to the CoreLocation agent to ask the user for permissions. You can give your app access by adding the entitlement 'com.apple.security.temporary-exception.mach-lookup.global-name' with a value of 'com.apple.CoreLocation.agent'. Users will be prompted for access automatically like you would expect. I've filed a bug to apple on this already.

    Read the article

  • Managing multiple AJAX calls to PHP scripts

    - by relativelycoded
    I have a set of 5 HTML dropdowns that act as filters for narrowing results returned from a mySQL database. The three pertinent filters are for "Province", "Region", and "City" selection, respectively. I have three functions: findSchools(), which runs when any of the filters (marked with CSS class .filter) are changed, and fetches the results via AJAX from a PHP script. Once that is done, two other functions are called... changeRegionOptions(), which, upon changing the "Province" filter, and updates the available options using the same method as the first function, but posting to a different script. changeCityOptions(), which runs if the "Region" filter was changed, and updates options, again using the same method. The problem is that since I want these AJAX functions to run simultaneously, and they by nature run asynchronously, I've tried using $.when to control the execution of the functions, but it doesn't fix the problem. The functions run, but the Region and City filters return blank (no options); the FireBug report shows absolutely no output, even though the POST request went through. The posted parameter for filter_province gets sent normally, but the one for region gets cut off at the end -- it sends as filter_region=, with no value passed. So I'm presuming my logic is wrong somewhere. The code is below: // When any of the filters are changed, let's query the database... $("select.filter").change(function() { findSchools(); }); // First, we see if there are any results... function findSchools() { var sch_province = document.filterform.filter_province.value; var sch_region = document.filterform.filter_region.value; var sch_city = document.filterform.filter_city.value; var sch_cat = document.filterform.filter_category.value; var sch_type = document.filterform.filter_type.value; $.post("fetch_results.php", { filter_province : sch_province, filter_region : sch_region, filter_city : sch_city, filter_category : sch_cat, filter_type : sch_type }, function(data) { $("#results").html(""); $("#results").hide(); $("#results").html(data); $("#results").fadeIn(600); } ); // Once the results are fetched, we want to see if the filter they changed was the one for Province, and if so, update the Region and City options to match that selection... $("#filter_province").change(function() { $.when(findSchools()) .done(changeRegionOptions()); $.when(changeRegionOptions()) .done(changeCityOptions()); }); }; This is just one of the ways I've tried to solve it; I've tried using an IF statement, and tried calling the functions directly inside the general select.filter.change() function (after findSchools(); ), but they all return the same result. Any help with this would be great!

    Read the article

  • Issue with Running Android Program on Eclipse

    - by Hossein Mobasher
    I downloaded complete Android Environment Development Environment Snapshots from marakana.com. I start eclipse and create new Android project. On the Run Configurations, i created New Configuration to run the application, and set the Target to Automatic and select the AVD that appropriate to run the application. But, when i click on the run icon, it starts the new emulator, and after some minutes, just android emulator be ran and my application doesn't run on it. What do i do to solve the running problem and run my project on emulator ? NOTE 1: Console outputs : [2012-03-07 16:03:49 - New] ------------------------------ [2012-03-07 16:03:49 - New] Android Launch! [2012-03-07 16:03:49 - New] adb is running normally. [2012-03-07 16:03:49 - New] Performing com.android.example.NewActivity activity launch [2012-03-07 16:03:53 - New] Launching a new emulator with Virtual Device 'Device' [2012-03-07 16:04:00 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error NOTE 2: My Program Source: package com.android.example; import android.app.Activity; import android.os.Bundle; public class NewActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } Thanks for your attention :)

    Read the article

  • Android AutocompleteView OnClickListener

    - by Chirag_RB
    I have 2 Auto Complete Views which i have to pre-populate with some text .However as soon as user clicks on the views , the text should disappear and allow user to enter text . I have written two separate on click listeners to do so . The On click listener for the first one is working fine . However i have to double click for the On click listener of the second one to work. Please find the chunk of code below and come up with some solution . final AutoCompleteTextView source = (AutoCompleteTextView) findViewById(R.id.source); ArrayAdapter source_adapter = new ArrayAdapter(this, R.layout.list_item, Model.City); source.setAdapter(source_adapter); source.setOnClickListener(new OnClickListener(){ public void onClick(View v) { source.setText(""); source.setTextSize(14); } }); final AutoCompleteTextView destination = (AutoCompleteTextView) findViewById(R.id.destination); ArrayAdapter destination_adapter = new ArrayAdapter(this, R.layout.list_item, Model.City); destination.setAdapter(destination_adapter); destination.setOnClickListener(new OnClickListener(){ public void onClick(View v) { destination.setText(""); destination.setTextSize(14); } });

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >