Sunday, May 8, 2016

Do I have to build maven webapp project everytime i make changes into static files?

Leave a Comment
I am using JBOSS AS7.1, Eclipse Luna for development. My eclipse installation does have a plugin installed for maven. I have created my webapp project using maven command-line. In my current set up, I have to build my maven project using mvn clean install every time for all changes, even for the static files like HTML, CSS. Then, I have to deploy the generated WAR file using JBOSS console running at http://localhost:9990/console. I am quite sure that there must be another way to do this. Surely, it does take a hell...
Read More

How to create a deployment package with SQL scripts in IIS

Leave a Comment
Using IIS-10, Web Deploy v3.6, Windows 10. It is an ASP.NET Website (not application) using SQL Server 2014 for the back-end. I was able to successfully create and deploy the package, but without SQL scripts. Could not find any info on how to do it for including SQL scripts in the package. Here is what I have tried: In IIS, under 'Default Web Site', select my web application. On the right hand side, click on 'Export Application'....
Read More

Scala higher kinded types in implicit def fails with “could not find implicit value”

Leave a Comment
I'm using implicit def to build a recursive HList type, to match several kind of higher kinded types of HList. I'm heavily inspired by this post. This code is working perfectly : sealed trait HList { type Plus[L <: HList] <: HList } class HNil extends HList { type Plus[L <: HList] = L def ::[T](v: T) = HCons(v, this) } case class Appender[L1 <: HList, L2 <: HList, R <: HList](fn: (L1, L2) => R) { def apply(l1: L1, l2: L2) = fn(l1, l2) } object HNil extends HNil object HList { def ++[L1...
Read More

Invalid column deleted while trying to query a column

Leave a Comment
I am trying to execute the following query in my android app: private static final String[] PROJECTION = { Data.CONTACT_ID, Data.MIMETYPE, Data.DISPLAY_NAME, Phone.NUMBER, Phone.TYPE, StructuredName.GIVEN_NAME, StructuredName.MIDDLE_NAME, StructuredName.FAMILY_NAME, Data.DELETED }; private static final String SELECTION = "(" + Data.MIMETYPE + " = ? AND " + Phone.TYPE...
Read More

How to retrieve an image sent from a desktop app to a Rails API

Leave a Comment
I'm building a desktop app using Electron, which is basically JavaScript. In it, I'm sending an image to my Rails API like this: var myHeaders = new Headers(); myHeaders.append('Authorization', 'Token token=redacted'); myHeaders.append('Content-Type', 'application/json'); myHeaders.append('Accept', 'application/json'); ... var formData = new FormData(); formData.append("img", base64EncodedImage); var myPost = {method: 'POST', headers: myHeaders, body: formData} fetch("url", myPost) (simplified) In my Rails console,...
Read More

How do I write a range pipeline that uses temporary containers?

Leave a Comment
I have a third-party function with this signature: std::vector<T> f(T t); I also have an existing potentially infinite range (of the range-v3 sort) of T named src. I want to create a pipeline that maps f to all elements of that range and flattens all the vectors into a single range with all their elements. Instinctively, I would write the following. auto rng = src | view::transform(f) | view::join; However, this won't work, because we cannot create views of temporary containers. How does range-v3 support...
Read More

HTML css Table misaligned Columns

Leave a Comment
I tried to create a table in AngularJS with sticky header and footer. I've managed to do that; here's a Plunker demo and code: <body ng-controller="MainCtrl as ctrl"> <table class="table table-bordered table-hover"> <thead> <tr> <th> Column1 </th> <th> Column2 </th>...
Read More

Scrolling is not working with CoordinatorLayout + parallax image + BottomSheetLayout

Leave a Comment
Introduction I have an activity, which implements a common pattern with parallax header image and scrolling content using CoordinatorLayout, AppBarLayout and CollapsingToolbarLayout. My xml layout looks like this: <android.support.design.widget.CoordinatorLayout android:fitsSystemWindows="true" android:layout_height="match_parent" android:layout_width="match_parent"> <android.support.design.widget.AppBarLayout...
Read More

Swift: UIBezierPath Stroke Animation from Center

Leave a Comment
I've been making a simple UIBezierPath animation with Swift. This path consists on creating a rounded rectangle with a colored border. The animation must be the drawing of the colored border. To do so, I've created a CAShapeLayer with a UIBezierPath(roundedRect:, cornerRadius: ) let layer = CAShapeLayer() var viewPrueba = UIView() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading...
Read More

Saturday, May 7, 2016

Serve git-lfs files from express' public folder

Leave a Comment
I'm using node.js (express) on Heroku, where the slug size is limited to 300MB. In order to keep my slug small, I'd like to use git-lfs to track my express' public folder. In that way all my assets (images, videos...) are uploaded to a lfs-store (say AWS S3) and git-lfs leaves a pointer file (with probably the S3 URL in it). I'd like express redirects to the remote S3 file when serving files from the public folder. My problem is I don't kwon how to retrieve the URL from the pointer file's content... app.use('/public/:pointerfile',...
Read More

Proximity alert for locations saved at server

Leave a Comment
I did some search but could not find a suitable answer. My App should compare with multiple locations for proximity. This means I will not be able to save all the locations into my app to confirm the proximity using locationManager. I want the proximity confirmation to be done in the server What would be the best way to implement this? Would it be sensible if the app asks for proximity confirmation every time the devices moves around? 4 AnswersAnswers 1 I would try a different approach, since location updates from...
Read More

Displaying null values after first users login inside android

Leave a Comment
I have 3 fragments inside an app and in one of them I display users name from the SQLite database. What happens is when I register a new user and login first time with it, inside the textview where the users name suppose to appear, it displays NULL value, but when I logout and login again with the same user, name appears as it should. After registering user, all the data is inserted inside a database, I have checked. Any ideas what can cause this problem? I will add some code on request as I have no idea which part of...
Read More

Open paradox / borland database as single file

Leave a Comment
my question is: how to connect java tp paradox / borland database ".DB" single files? Here's what I have: So, it's Paradox 7 database files. I'm trying drivers: http://www.hxtt.com/paradox.html & https://code.google.com/archive/p/paradoxdriver/ as: String url = "jdbc:paradox:/D:/BABAK/powerGold/SongTitle.DB"; Connection con = DriverManager.getConnection(url); But both throws exceptions like: D:/BABAK/powerGold/SongTitle.DB...
Read More

Xcode 7.3 crashes when breakpoint set or app crashes

Leave a Comment
I am having this issue and when I searched it on Stack Overflow I saw that many people have had this before: First of all, you can find the crash report here: http://pastebin.com/c726EUip What I've tried so far: I set the "Enable Clang Module Debugging" in Build Setting to NO I did pod update Tried to change LLDB to GDB but i think xcode no longer has this option This is the list of frameworks: Here are links to questions...
Read More

node certificate store, does node read only from hard coded list of certificates?

1 comment
After struggling for a while, is there any way to add new certificate to the list of certificates node trusts? It seems that node will trust only to certificates stored in hard coded list of certificates: https://github.com/nodejs/node/blob/master/src/node_root_certs.h So for example, node app should communicate with https://foo-bar-baz.com that use self signed certificate, causing request to that domain to return something like: [RequestError: Error: certificate has expired] Apparently how this can be fixed in java...
Read More

Get params validation on viewsets.ModelViewSet

Leave a Comment
I am new to django and building a REST API using django-rest-framework. I have written some code to check whether the user has supplied some parameters or not.But that is very ugly with lot of if conditions, so i want to refactor it.Below is the code that i have written please suggest how to refactor it. I am looking for some django based validations. class AssetsViewSet(viewsets.ModelViewSet): queryset = Assets.objects.using("gpr").all() def create(self, request): assets = [] farming_details = {} bluenumberid...
Read More

Strange Jackson Illegal character ((CTRL-CHAR, code 0)) Exception in Map Reduce Combiner

Leave a Comment
I have a Map-Reduce job with a mapper which takes a record and converts it into an object, an instance of MyObject, which is marshalled to JSON using Jackson. The value is just another Text field in the record. The relevant piece of the mapper is something like the following: ObjectMapper mapper = new ObjectMapper(); MyObject val = new MyObject(); val.setA(stringA); val.setB(stringB); Writer strWriter = new StringWriter(); mapper.writeValue(strWriter, val); key.set(strWriter.toString()); The outputs of the mapper are...
Read More

Rails + Jasmine-Ajax: what is the correct way to test code triggered by `ajax:success` (jquery-ujs)

Leave a Comment
I am trying to test a certain internal library that has some JS behavior triggered on the ajax:success event. The library creates a link that looks like this: <%= link_to 'click here', '/some_path', class: 'special-link', remote: true %> And in the JS part of the library there is event binding code, which is the part I want to black-box test through its effect on the DOM: $(document).on 'ajax:success', '.special-link', (e, data, status, xhr) -> # Code that has some effect on the DOM as a function of the...
Read More

Friday, May 6, 2016

Xamarin UWP custom CommandBar

1 comment
I'd like to create a custom CommandBar for the UWP part of my Xamarin project. I want to make a logo on a background color. The only way to get this, is making a visualbrush or grid, to contain both the background color and the picture. I've read it can be done like so; <Window.Resources> <VisualBrush x:Key="myBrush"> <VisualBrush.Visual> <Grid> <Rectangle Fill="Red" /> <Image Source="troll.png" /> </Grid> ...
Read More

Writing Tables in Torch to file

Leave a Comment
I am trying to save some tables of strings to files in Torch. I have tried using this Torch extension by Deepmind: hdf5. require 'hdf5' label = {'a', 'b','c','d'} local myFile = hdf5.open(features_repo .. 't.h5', 'w') myFile:write('label', label) myFile:close() I am getting the error: /home/user/torch/install/bin/luajit: ...e/user/torch/install/share/lua/5.1/hdf5/group.lua:222: torch-hdf5: writing data of type string is not supported Torch Tensors are written to file as intended. I have also tried using matio...
Read More

Android - Getting Contact List with street addresses but no low value ones like Skype where the address is only a city and state

Leave a Comment
I got a cursor retrieving all the contacts on the app that have a street address. This cursor is then passed into an Adapter. So far so good. Except I also get a bunch of low value contacts (mostly from Skype) that only have a State/Country info. Is there an easy way to modify the URI to skip those? public Cursor getDirectoryList (CharSequence constraint) { String[] selectionArguments = { "%"+constraint.toString()+"%" }; String selection = ContactsContract.CommonDataKinds.StructuredPostal.DISPLAY_NAME...
Read More

How to mimic Google Maps' bottom-sheet 3 phases behavior?

Leave a Comment
Background I'm assigned to make a UI that behaves similar to how Google Maps shows a bottom-sheet for a found result. It has 3 different phases: bottom content. the upper area is still touchable and won't scroll anything at the bottom full screen content, while the upper area has a large header. full screen content, while the upper area has just the toolbar. Here's what I'm talking about on Google Maps : The problem Thing...
Read More