2018-10-22         Celeste

How do I prevent event propagation on link click?

When I click on my a-tag, I do not want the parent's event to trigger. If the child had a normal event listener, it could be prevented by event.stopPropagation(), but how do I do it when there is no "event"?<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body><div id="parent" style="width:100px; height:100px; background-color: red"> <a id="child" href="https://i.kym-cdn.com/entries/icons/facebook/000/013/564/doge.jpg">Text</a></div><script> docu...

 javascript                     3 answers                     24 view
 2018-10-22         Celeste

PG gem errors on attempting to make connection

I have installed Postgres 8.4.4 via MacPorts per a RobbyOnRails installation guide. When I attempt to connect to a project I get the following error:establish_connection':RuntimeError: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle, 9): no suitable image found. Did find: /Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle)The PG gem successfully installs, but the above error is g...

 ruby-on-rails                     1 answers                     82 view
 2018-10-22         Celeste

payfast not redirecting to notify_url

I am working with payfast integration in testing env. I have defined all required criteria like.merchant_idmerchant_keyamountitem_namereturn_urlcancel_urlnotify_urlProblem: I have defined notify_url but payfast is not calling my notify_url. It's just calling my return url.Notify Url:My notify_url is public accessibleIt's also responding 200 OKBut payfast is not redirecting to notify_url only redirecting to 'return_url' When a successful payment is made, PayFast will send an ITN(Payment Confirmation) to your notify_url.They will send the ITN to your notify_url before a ...

 payment-gateway                     1 answers                     82 view
 2018-10-22         Celeste

Sorting toMany relationship Set in core data

I have Two models Department and Worker. Departments has to-many relationship(workers) to worker.Worker has firstName field. How can i get a worker list sorted by firstName by accessing departmet.workers? Is there any way to add sort descriptors in to-many relationship? Minor improvement over Adrian Hosey's code:Instead of manually iterating over all workers you can also just do:-(NSArray *)sortedWorkers { NSSortDescriptor *sortNameDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"firstName" ascending:YES] autorelease]; NSArray *sortDescriptors = [[[NSArray allo...

 iphone                     6 answers                     46 view
 2018-10-22         Celeste

Accessing API through token from Auth0

I'm implementing Auth0 to use in my ASP.NET Core 2.1 app with React frontend and haven't been able to make API calls using the token obtained from Auth0. I keep getting unauthorized error.Here's the code in ConfigureServices() method in my Startup.cs:services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(jwtOptions => { jwtOptions.Authority = "https://myapp.auth0.com/"; ...

 asp.net-core                     1 answers                     88 view
 2018-10-22         Celeste

django-rest-framework: serializer.save doesn't return object's id

Short description: I have a problem with ModelSerializer. It is not filling id field of object on save.Useful details.My model:class Platform(models.Model): identifier = models.CharField(max_length=32, unique=True) description = models.TextField()My serializer:class PlatformSerializer(serializers.ModelSerializer): identifier = serializers.CharField(required=True, max_length=32) description = serializers.CharField(max_length=100000, required=False) class Meta: model=Platform fields=('id', 'identifier', 'description',) read_only_fields=('id...

 django                     2 answers                     21 view
 2018-10-22         Celeste

Start nano as a subprocess from python, capture input

I'm trying to start a text editor (nano) from inside Python, have the user enter text, and then capture the text once they writeout (Control-O). I haven't worked with the subprocess module before, nor pipes, so I don't know what to try next.So far I have this code:a = subprocess.Popen('nano', stdout=subprocess.PIPE, shell=True)Where a should capture the output. This code, however, doesn't bring up nano, and instead makes the python terminal behave strangely. Up and down keys (history) stop working and the backspace key becomes dysfunctional.Can someone point me in the right...

 python                     2 answers                     64 view
 2018-10-22         Celeste

How do I use Sprite Sheets in Pygame?

Argh!!! I am new to this whole python thing and the only way I know how to make a "animation" is by using individual pictures (as in 1 pic per file). Well, I got a sprite sheet that is perfect for what I need, only problem is that it is a sprite sheet. I don't want to spend the time, cropping each individual sprite out.More information, I am new to python and pygame. Just started learning the language back in August is a class that is moving very slowly...so if you could explain what you are doing so I can do it for future projects I would really appreciate it. I am also us...

 python                     1 answers                     74 view
 2018-10-22         Celeste

bundle.js file output and webpack-dev-server

I have this output configuration in my webpack.config file:config = { ... output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js', publicPath: 'http://localhost:8090/' },... }The bundle.js is not written to the path specified in path; it is only available through theweb server whereas I would like both.What should I change to have both the file and the web server ? When you run webpack-dev-server you are not actually bundling and rebuilding the webpack bundle, it is only serving it from mem...

 webpack                     2 answers                     39 view
 2018-10-22         Celeste

Spring boot testing error: java.lang.IllegalArgumentException: Page must not be null

I am trying to test the following controller: @RepositoryRestController@RequestMapping("movies")public class MovieController { private MovieService movieService; private PagedResourcesAssembler<Movie> pagedAssembler; private MovieResourceAssembler movieResourceAssembler; @Autowired public void setMovieService(MovieService movieService) { this.movieService = movieService; } @Autowired public void setPagedAssembler(PagedResourcesAssembler<Movie> pagedAssembler) { this.pagedAssembler = pagedAssembler; } @Autowired pub...

 spring                     2 answers                     46 view
 2018-10-22         Celeste

converting nvarchar to datetime

We have a table which contains column with datatype nvarchar(254). This column stores date and time in the following format:12-MAR-15 04.07.36.000000000 PMWe need to convert this into datetime format so that we can run time dependent queries to extract the required results. This data is not stored in any of the formats mentioned on CAST and CONVERT documentation pageI tried with 130 and 131 but no luck.The format here seems to be dd-mon-yy hh.mm.ss.mmmmmmm PMDoes anyone know how should we go about converting this into 'datetime' format?Any help would be much appreciated. ...

 sql                     3 answers                     35 view
 2018-10-22         Celeste

How should I write PHP $_POST vars in a mysql_query function?

In accessing my database, I have the user fill out a form, and in the target page, the posted values are used in the resulting MySQL query.$query = mysql_query("SELECT pass FROM database WHERE user='$_POST[user]'");However, for some reason or another, MySQL doesn't like my using a $_POST variable in the command, and it only works if I define (for example) $user = $_POST['user'];, and then put $user directly in the SQL command.On the other hand, I can use $_POST values in INSERT statements where specific column names are not required:$query = mysql_query("INSERT INTO databas...

 php                     5 answers                     54 view
 2018-10-22         Celeste

codeigniter controller function parameter

class Mymodel extends CI_Model { public function getJp($jp=""){ $sql = "SELECT * FROM daftarpaket WHERE jenisproduk = ?"; $data = $this->db->query($sql, $jp); return $data->result_array(); }}class Controller extends CI_Controller { public function daftarPaket($jp=""){ $data = $this->mymodel->getJp("$jp"); return $data->result_array(); }}how can i foreach my result_array of daftarpaket and daftarpaket parameter i take from value of select option before i click submit button?TY in your controller file class C...

 function                     1 answers                     98 view
 2018-10-22         Celeste

storing passwords in SQL Server

What is the recommended practice for storing user passwords in SQL Server 2008?I am storing user details for an intranet, and would like to get advice on best way to store a user details such as name, password and user access privillages etc. I am thinking of creating a nvarchar column and then encrypt this text before inserting into the table. The usual way to store password, is to use a hash function on the password, but to salt it beforehand. It is important to "salt" the password, to defend oneself against rainbow table attacks.So your table should look something li...

 sql-server-2008                     4 answers                     11 view
 2018-10-22         Celeste

Mongodb Vs Azure Documentdb which is better and why

I am going to use mongodb, but being a .net developer I am looking into Azure Documentdb. I want to know. Anyone is really using Azure Documentdb on production. Is azure Documentbd is as good as in performance as mongodb. TIA. Anyone is really using Azure Documentdb on production. R: Microsoft is using on MSN portal and One Note. Is azure Documentbd is as good as in performance as mongodb. Yes, it is.Mongo is more mature, but Azure DocumentDB is always being improved. I suppose that you are going to host your app on Azure, so I would go with Azure Doc...

 mongodb                     1 answers                     30 view
 2018-10-22         Celeste

Load HTML file through file naming in Android Studio

I need to load a random image, according to the outcome and based on that I need to load a certain HTML file. Can I link them through naming?When I load a drawable house.jpg it has to link dynamically with house.html.(The image and HTML file have to be separate. So no need to say you can put everything in one HTML file.) You can only do such a thing if our image is inside your /assets folder. Also, you must load your html with a baseUrl that's inside your assets folderYou can use WebView.loadUrl() or WebView.loadDataWithBaseURL():webView.loadUrl("file:///android_asset/fi...

 html                     1 answers                     98 view

Page 1 of 145  |  Show More Pages:  Top Prev Next Last