Monday, October 24, 2016

Regenerate WordPress thumbnails with media hosted on S3

Leave a Comment
I have a WordPress site that uses the WPRO (WordPress Read Only) plugin to host all media files on Amazon S3. I've changed the thumbnail and image sizes in my custom theme, and uploading new images to the media library uses the new sizes. However, when I try to regenerate all thumbnails using "Regenerate Thumbnails," it doesn't work, often complaining that the original cannot be found. How can I force the regenerate thumbnails plugin to use the original image on S3 to recreate the thumbnails for existing images? 0...
Read More

VS 2013 Designer - “An attempt was made to load a program with an incorrect format”

Leave a Comment
Amongst other items, my solution contains a project that defines a control and another project that uses this control on a form. When I try to open this form in the VS Designer, I get the following error: Could not load file or assembly 'libX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. where libX is neither the project with...
Read More

Website shows Forbidden message when using HTTPS

Leave a Comment
I have this in my htaccess file Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / Options -Indexes RewriteRule ^login/?$ login.php [L] RewriteRule ^logout/?$ logout.php [L] # This will process the /section/(.*) requests, ?section=1 will be appended to query string RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^section\/(.*)?$ index.php?section=1&id=$1 [L,QSA] # This will process all other requests RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}...
Read More

angular tree control not highlighting the whole cell

Leave a Comment
I tried to implement angular tree control from http://wix.github.io/angular-tree-control, however, i cannot highlight the whole cell, it's only highlighting the label. I tried to change the css that the treecontrol comes with but still i can't make it highlight the whole cell. the current and expected result is here: treecontrol { font-family: Verdana, Helvetica, Arial, sans-serif; font-size:13px; color: #555; ...
Read More

Sunday, October 23, 2016

Sending Email with Delayed_Job

Leave a Comment
I have what I think is a working setup to send emails via Delayed_Job. However, I haven't received my test email and it isn't practical to wait for more to happen with a delay of days. I need to figure out: What's wrong that's causing the email not to send. How to test it without waiting days at a time. I'm new to Delayed_Job, so pardon the newbie mistakes. Here's the model that includes the send_reminder_emails method. They were fully functional without the .delay(run_at: self.mail_date) bit, so at least I know...
Read More

Friday, October 21, 2016

Transparent iframe over another iframe

Leave a Comment
What I'm trying to achieve is an iframe positioned over another iframe containing a PDF document - the first iframe should be transparent, and it should cover the iframe with PDF. I need this specifically for IE (9+). The code I've tried so far: <html> <head> <style> </style> </head> <body> <iframe src="iframeContent.html" frameborder="0" style="width: 1000px; height: 1000px; position: fixed; left:0px; top: 0px; background:transparent" allowTransparency="true"></iframe>...
Read More

How do I auto-submit an upload form when a file is selected?

Leave a Comment
I have a simple file upload form. How do I make it submit automatically when a file has been selected? I don't want the user to have to click the Submit button. 11 AnswersAnswers 1 You can simply call your form's submit method in the onchange event of your file input. document.getElementById("file").onchange = function() { document.getElementById("form").submit(); }; http://jsfiddle.net/cwvc4/73/ Answers 2 Using jQuery: <form id="target" action="destination.html"> <input type="file" id="file"...
Read More

WebViewClient not calling shouldOverrideUrlLoading

Leave a Comment
The problem is rather simple. In the application we want to keep track of the current url being displayed. For that we use shouldOverrideUrlLoading callback from the WebViewClient by saving the url into a class field for every update. Here is the relevant code: mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { ...
Read More

How to trigger tag creation in select2 single select (e.g. when adjacent button is pressed)?

Leave a Comment
I am using select2 4.0.3. I have a select2 box to enter email addresses, and I would like to make sure that all email addresses are included in .val(), also the one that the user was still typing in the search field. The form field is referenced by $('.invite-emails-field'). When I press the Send button, in the event handler $('.invite-emails-field').val() just gives me the first two addresses test1@example.com and test2@example.com,...
Read More

Thursday, October 20, 2016

How to set the position of spinner with cordova

Leave a Comment
I have this in my config.xml <preference name="show-splash-screen-spinner" value="true" /> And the spinner works great, however i need to change the position from center to something like center + 10% vertically There is any way of doing this? 1 AnswersAnswers 1 You have to fork the original cordova-plugin-splashscreen on github Then on your config.xml you change it to use your fork, remove the original plugin (something like <plugin name="cordova-plugin-splashscreen" source="npm" />) and add your...
Read More

Open window and close immediately

Leave a Comment
There is a way in JS to open window and close it immediately, that it will not open in new tab , I just want want to open a window (like in background if possible ) do some check on it and immediately close it, without the effect that the new tab is open , is it possible? Something like this but without the effect that the window is opened... var popup = window.open("http://www.google.com"); popup.close(); UPDATE: Here is solution which I found but it's flicking sometimes and I want to avoid it... function goNewWin()...
Read More

Wednesday, October 19, 2016

How to let IDEA auto import pom.xml with Annotation Processors defined

Leave a Comment
I am using QueryDsl, so my source depends on generated code. FIRST Whenever IDEA (auto) imports pom.xml, the following setting is always empty: Build, Execution, Deployment -> Compiler -> Annotation Processors -> Annotation Processors I have to set it manually, which is very troublesome. SECOND I have multi-modules using QueryDsl, which I want to be grouped into one profile with the QueryDsl com.mysema.query.apt.jpa.JPAAnnotationProcessor applied. Build, Execution, Deployment -> Compiler ->...
Read More

Stratified sampling in Spark

Leave a Comment
I have data set which contains user and purchase data. Here is an example, where first element is userId, second is productId, and third indicate boolean. (2147481832,23355149,1) (2147481832,973010692,1) (2147481832,2134870842,1) (2147481832,541023347,1) (2147481832,1682206630,1) (2147481832,1138211459,1) (2147481832,852202566,1) (2147481832,201375938,1) (2147481832,486538879,1) (2147481832,919187908,1) ... I want to make sure I only take 80% of each users data and build an RDD while take the rest of the 20% and build...
Read More

Retrieve which replica instance was used for mongo query using node.js

Leave a Comment
I use the official node.js mongodb client for performing Mongo queries targeting a cluster via a connection string similar to: mongodb://euwest1-01,euwest1-02,uswest2-01/dbname?replicaSet=mycluster&readPreference=nearest. As you see, I include in my cluster some differently geo-located instances and "nearest" should guarantee the right replica to be picked. Nevertheless, I would like to know which one was used to perform any query, so that I can include to each of my operations' log the mongo replica that was used...
Read More

Tuesday, October 18, 2016

Setting an object on req. in the first of two middlwares seems to not be present at the time the second middlware is called

Leave a Comment
I have two express middlwares where one is setting an object to the req and the other that follows it uses that object to turn a switch statement. Here's an illustration: module.exports = (req, res, next) => { if (!req.headers.authorization) { return res.status(401).end() } const token = req.headers.authorization.split(' ')[1] return jwt.verify(token, config.database.jwtSecret, (err, decoded) => { if (err) { return res.status(401).end() } const userId = decoded.sub return User.findById(userId,...
Read More

Monday, October 17, 2016

HttpUrlConnection setting Range in Android is ignored

Leave a Comment
I'm trying get a 206 response from my server using Android. Here's the code. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { try { URL url = new URL("http://aviddapp.com/10mb.file"); ...
Read More

Docker - no such file or directory

Leave a Comment
I'm receiving an error from docker when I run my docker file. It's saying the /var/lib/docker/aufs/layers/xxxx: no such file or directory when I run Docker build . I have tried numerous ways to remove containers and images so I'm pretty much stock on this one. Any The Docker file is: FROM node:6 RUN git clone https://github.com/preboot/angular2-webpack.git WORKDIR angular2-webpack RUN sed -i.bak 's/--port 8080/--host 0.0.0.0 --port 8080/' package.json RUN npm i CMD [ "npm", "run", "start" ] The complete console...
Read More

How to read the json file of a dinamical way in relation to their size structure

Leave a Comment
I have the following JSON file named ProcessedMetrics.json which is necessary read for send their values to some template: { "paciente": { "id": 1234, "nombre": "Pablo Andrés Agudelo Marenco", "sesion": { "id": 12345, "juego": [ { "nombre": "bonzo", "nivel": [ { "id": 1234, "nombre": "caida libre", "segmento": [ ...
Read More

Facebook API Error: “User does not have sufficient administrative permission for this action on this page.”

Leave a Comment
I'm using a Facebook app (in development mode) to generate a page access token so that my personal web app can schedule/edit/delete posts on a Facebook fan page. I'm using the Graph Explorer to generate the token while logged in as the admin of the fan page. When I use that token, I'm able to GET a list of the scheduled posts, but whenever I try to edit or delete a post, I get this error: "User does not have sufficient administrative...
Read More

Sunday, October 16, 2016

How to display image in large size onmouseover inside a dynamic div

Leave a Comment
I am trying to make a simple photo gallery in angularJS. Below is the code index.html <!DOCTYPE html> <html > <head> <title></title> <script src="http://code.angularjs.org/1.2.0rc1/angular.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="test.js"></script> </head> <body ng-app="testModule" ng-controller="testCtrl"> <div style="width:...
Read More

Make ServletContextListener spring aware

Leave a Comment
I am plugging in Spring to existing Java EE web Application. I have following lines in my web.xml: <listener> <listener-class>com.MyContextListener</listener-class> </listener> And Following MyContextListener class? public class MyContextListener implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { //... } } What should I do to make MyContextListener be managed by Spring? Edited: My assumption is: Spring should create all servlets...
Read More

Friday, October 14, 2016

AWS MQTT on OSX

Leave a Comment
In the OSX app here, I can use AWS MQTT with iOS9, but when I try the same with OSX10.11, I get this error: CFNetwork SSLHandshake failed (-9829) Error -9828 is defined as errSSLPeerCertUnknown = -9829, /* unknown certificate */ My OSX info.plist is <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict> <key>amazonaws.com</key>...
Read More

Thursday, October 13, 2016

Responsive pre tag

Leave a Comment
I simply want to show terminal output on a Webpage. Atm I'm using a pre tag to do that with pre { white-space: pre-wrap; } as you can see upon http://irc.dabase.com/. My problem is that when I rotate my iPhone6 IOS device, it often doesn't reformat properly. Why is this? Can you offer some good CSS rules to make this use case of showing terminal output on a Webpage better? 3 AnswersAnswers 1 You can try this to achieve - pre...
Read More

Tuesday, October 11, 2016

Alamofire 4 and special characters in JSON

Leave a Comment
I've got a problem with special characters with Alamofire 4.The JSON contains æ, ø and å and the browser shows them fine, also my previous solution using SwiftyJSON did.Alamofire 4 shows something like this instead: U00e6 Using this call: Alamofire.request(specificURL, method: .get, parameters: param, encoding: URLEncoding.default, headers: nil).responseJSON { (response: DataResponse<Any>) in print(response) } What...
Read More

Swift / SKStoreProductViewController pushViewController results in (lldb)

Leave a Comment
To push the user to the iTunes store for desired items I'm using the following function: func openStoreProductWithiTunesItemIdentifier(identifier: String) { let storeViewController = SKStoreProductViewController() storeViewController.delegate = self let parameters = [ SKStoreProductParameterITunesItemIdentifier : identifier, SKStoreProductParameterAffiliateToken : ITUNES_AFFILIATE_ID] storeViewController.loadProductWithParameters(parameters)...
Read More