on-internet

Service Layer on CQRS pattern

I'm trying to architect an application using CQRS pattern instead of Repositories and Onion architecture instead of n-layers using MVC5 stack. I have the following layers right now: Web.Data - Contains DbContext Web.Model - POCO classes Web.Service - Implementation of Commands and Queries using MediatR --Commands -----Request -----Handlers --Queries -----Request -----Handlers Web.UI I was thinking to put the Business Logic (e.g validations) on the Handler classes but I recon that those classes have direct access to EF. Is it still a good place to put those logic? How about if I have an Emailin

Join the discussion →

Websphere MQ via JMS: NoClassDefFoundError

I'm trying to make a simple JMS client application for Websphere MQ 7.5 I already have ".bindings" file with connection factory and destination, which I'm trying to connecto to. This is my simple Java code, that I'm trying to run on mac: package com.company; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.naming.Context; import javax.naming.directory.InitialDirContext; import java.util.Hashtable; public class Main { public static final String cfLookup = "TEST12"; public static final String icf = "com.sun.jndi.fscontext.RefFSContextFactory"; static String url = "f

Join the discussion →

API urls: Implicit vs Explicit tenant ids

Within a multi tenant app, I have two choices to expose my resources: api.myapp.com/customer/{id} api.mayap.com/{tenant}/customer/{id} I am wondering about the pros and cons of exposing the tenant name. In the first case the tenant name is given as a header field, and in the second directly within the URL. On one hand I do want to have the cleanest and simplest possible URL structure. Since all resource IDs will be UUIDs, having the tenant namespace seems redundant. On the other I am not sure if having the tenant name exposed in the URLs will make caching easier or any other factor I have not

Join the discussion →

How to connect to HTTP Rest API that authenticates with LDAP

I am writing a Ruby script to connect to a REST API website. The website is authenticated by using LDAP / SSO using the AD credentials, so no basic authentication or user/password has to be provided. This is the code so far: resource_http = Net::HTTP.new(webserver.company.com, 443) resource_http.use_ssl = true resource_http.verify_mode = OpenSSL::SSL::VERIFY_NONE resource_request = Net::HTTP::Post.new("/api/endpoint") resource_request.set_form_data({"chocolate"=>"yes","beer"=>"yes"}) resource_response = resource_http.request(resource_request) But I receive an authorization error: Net::HTTPUnau

Join the discussion →

nginx not serving static files on a public server

I am trying to deploy a django project using nginx and gunicorn. I followed this tutorial. Gunicorn is able to run my project but nginx is not serving static files. My nginx conf: server { listen 80; server_name 69.12.74.39; location / { proxy_pass http://0.0.0.0:8001; } location /static/ { autoindex on; alias /home/ekodev/accounts/arham/ekomerz/static/; } } I checked the location of my static folder and its right. The gunicorn command i am using is: gunicorn ekomerz.wsgi:application --bind=0.0.0.0:8001 EDIT: On my local machine it works fine. server { listen localhost:8000; location / { proxy

Join the discussion →

java.lang.ClassNotFoundException: org.json.JSONObject

I am developing a WAR project in Eclipse Mars which is running on a Tomcat 7 application server. I am also using the Java JSON API to create JSONObjects from a REST web service.I have ensured that my pom.xml file includes the JSON dependency so that the correct jar is downloaded. <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20151123</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl<

Join the discussion →

When is it safe to call URL.revokeObjectURL?

If I understand correctly URL.createObjectURL creates a URL that represents a file or a blob. Because the URL is just a string the browser has no way to know when you're finished with the resource that URL represents so there's a provided URL.revokeObjectURL function. MDN shows this example: var canvas = document.getElementById("canvas"); canvas.toBlob(function(blob) { var newImg = document.createElement("img"); var url = URL.createObjectURL(blob); newImg.onload = function() { // no longer need to read the blob so it's revoked URL.revokeObjectURL(url); }; newImg.src = url; document.body.append

Join the discussion →

node.js Error: Cannot find module 'lodash.assign'

I have installed node.js in windows 64bit and i run into this when runnig gulp on local project. another note: npm install went good with packages.json Error: Cannot find module 'lodash.assign' at Function.Module._resolveFilename (module.js:326:15) at Function.Module._load (module.js:277:25) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object.<anonymous> (D:\NBCredit_FRTE\RelyToolsSln\RelyTools.Web\node_modules\gulp-jshint\node_modules\lodash.clone\node_modules\lodash._baseclone\index.js:9:14) at Module._compile (module.js:410:26) at Object.Module._extensions..

Join the discussion →

Regex to match substring of file path

I am trying to write a regular expression in Perl that matches a specific part of the file path. Input string: /usr/local/bin/mybinary Output it has to match to: /usr/local/bin My regular expression is: (\ /.*\ /) It is matching /usr/local/bin/, but the / after bin should be removed.

Join the discussion →

Updating the html tag using javascript [closed]

So i have code below which should check the value of the first drop-down selection menu with the id="country" and based on the value currently selected it will change the drop-down options of the second menu. Below is my attempt to solve this problem however it does not work :( any help? EDIT: I'm starting to think that the value of 'var country' is not being updated when it is manually changed, could it be that onChange does not work? i'm using chrome so it should be supported. <div id="forum2"> <form action="#forumhandler.php"> <fieldset> <legend>Shipping Calculator</legend> Country:<br> <se

Join the discussion →

Java Spring HttpMessageNotWritableException/JsonMappingException with Hibernate FetchType.LAZY in Jackson serialization process

I use Java Spring web controller And jackson for parsing responses. Also I have four Java Hibernate entities: User Filter Make Model, with bidirectional relation in Make -> Model(s): GeUser.getFilters().get(0).getModel().getMake().getModels().get(0).getMake()... I tried add @JsonIgnoreProperties(value = "models") in Model class but still get exception: WARNING: Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties disco

Join the discussion →

How to create the code signing certificate through the New-SelfSignedCertificate cmdlet

The MakeCert tool has the -eku option for describing the enhanced key usage object identifiers (OIDs) into the certificate. It allows to make the certificates for code signing and for other purposes. But it is not a cmdlet. New PowerShell versions have the New-SelfSignedCertificate cmdlet for local testing of the scripts. But it creates the certificate that can't be used for code signing: New-SelfSignedCertificate -DnsName www.SomeSite.com -CertStoreLocation Cert:\CurrentUser\My I don't see an option which is similar to -eku. How can I set the destination of my new self-signed certificate (cre

Join the discussion →

FolderBrowserDialog on company network to select subfolder

In my WPF app the user needs to select a folder, which path is in the company network. I use the System.Windows.Forms.FolderBrowserDialog and the following code gets executed on a button click event: FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.SelectedPath = "\\\\company.net\\data\\_Confidential"; DialogResult result = fbd.ShowDialog(); When the FolderBrowserDialog opens, the system automatically scans for other network devices and that causes the following problem: The network tree gets filled with other devices and causes my SelectedPath to scroll away. This is pretty annoying w

Join the discussion →

err_connection_refused - xampp

I reinstall xampp and since then it do problem now sudenly it stop to work the apache is running but when I try to run localhost via broswer I get: ERR_CONNECTION_REFUSED What's the problem and how can I fix it? SOLVED Because I change the port to 8080 berfore that I need to enter via localhost:8080 now its working great. thanks all

Join the discussion →

Nested Anova in R

I want to show that seeds of different species display different length due to the factor Species. For each species, I have several trees and for each tree, I have several seeds measured. Using R, I did an ANOVA: summary(aov(Length ~ Species)) However, the reviewer noticed a problem of independence because seeds may provide from the same tree. (and this is indeed a real problem !) To answer this issue, I think that I should do a nested ANOVA. Is that right ? However, there are plenty of ways to write the code: summary(aov(Length ~ Species*Tree)) summary(aov(Length ~ Tree*Species)) summary(aov(

Join the discussion →

How to use to_char function in JPA to get records from a timestamp

I am try to query from and database using eclipse link using entities. when I use normal query records are returned from current date by when I use JPA zero records are returned. Where could I be doing wrong, Or how can I use to_char function in JPA my database is postgresql. normal sql query that returns records select * from mytable where to_char(transaction_date, 'YYYY-MM-DD') = '2016-01-19'; MyEntity @Temporal(javax.persistence.TemporalType.DATE) private Date transaction_date; EntityManager e = EntityMgr.MyFact().createEntityManager(); e.getTransaction().begin(); Query qry = e.createQuery(

Join the discussion →

XAMPP: "httpd.exe - Entry Point Not Found" Error

Im trying to configure xampp in windows server 2012RT 64-bit. I downloaded latest version of xampp(xampp-win32-7.0.1-0). I am using oracle 11gR2 version, so I downloaded oracle instant client 11_2 (64-bit). I enabled extension for oracle in php.ini file extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client extension=php_pdo_oci.dll And restarted xampp server, I got error like this,

Join the discussion →

Share Python code when handling multiple exceptions

I've written a program that needs to deal with a function that can throw multiple exceptions. For each exception I catch I have some code that will handle it specifically. However, I also have some code I want to run no matter which exception was caught. My current solution is a handle_exception() function which is called from each except block. try: throw_multiple_exceptions() except FirstException as excep: handle_first_exception() handle_exception() except SecondException as excep: handle_second_exception() handle_exception() Is there a better way to do this? I would like the code to look l

Join the discussion →

How do I pause an Azure App Service Plan?

I thought one of the advantages of Azure was that I could turn services on and off depending on when I want them to be available. However I cant see how to pause my App Service Plan. Is it possible? I want to use the S1 tier so that I can play with what it offers. However I want to be able to pause the cost accumulation when I am not using it. I see from the app service pricing help that an app will still be billed for even though it is in the stopped state. Yet the link also clearly states that I only pay for what I use. So how does that work?

Join the discussion →

Testing Android Studio app on iPhone

I would like to develop Android app with Android Studio, but the only device I have for now is an iPhone (5 and 6). Is there a way to have a live-preview of an app on iOS? For installing Android OS on iPhone I've seen solutions like iDroid, but they seem to be not supported and not exactly working in this kind of way.

Join the discussion →

How can I change the docker id and name

I'm using jenkins to build docker containers and send the completed image to AWS S3 bucket. I'm trying to get a file that is pulled from Github onto the docker image and then package it up into a docker image. Currently I have jenkins completing the git pull and building the container but I can not get it to copy the files to the container. I get this error: Building in workspace /var/lib/jenkins/jobs/copy-to-docker/workspace [workspace] $ /bin/sh -xe /tmp/hudson5108979322433439821.sh + docker cp /var/lib/jenkins/jobs/Move git pull files to docker/workspace/html/:index.html + :/var/lib/docker/

Join the discussion →

jinja2 right align a float : formatting issue

i'm trying to align some floats, it works great if I use 'X' character as the fill parameter in the formatting doc : <ul> {% for race in rrr[1] %} <li><i class="fa fa-road"></i> {{ '{:X>5.1f}'.format(race.distance_number) }}km <i class="fa fa-area-chart"></i>{{ '{:.0f}'.format(race.elevation_number) if race.elevation_number is not none else '' }} </li> {% endfor %} </ul> If I use a X it aligns things well with {{'{:X>5.1f}'.format(race.distance_number) }} But if I use a space {{ '{: >5.1f}'.format(race.distance_number) }} which ultimately is what I want, it's not aligned anymore is there any w

Join the discussion →

Define cell format on AlaSQL/JS-XLSX Excel Export

Is it possible to define cell format on AlaSQL export to Excel? I'm maintaining a system that exports grid data to Excel using AlaSQL. The problem is that Excel data is not being converted to NUMBER. DATE values do OK, but Numeric types are always displayed as General. By forcing a convertion to Number type in JS, the message "Number stored as Text" is shown on xls file. I think it would be easier solving this problem using js-xlsx directly, but it would generate lots of changes in the project and this is not an option. I need to use something like it's shown here jsFiddle, passing json option

Join the discussion →

What does clf mean in machine learning?

When doing fitting, I always come across code like clf = svm.SVC(kernel='linear', C=1).fit(X_train, y_train) (from http://scikit-learn.org/stable/modules/cross_validation.html#k-fold) What does clf stand for? I googled around but didn't find any clues.

Join the discussion →

How to predict whether a name is a surname from an author name string (lexical analysis)

I'm writing a parser that converts messy author strings into neatly formatted strings in the following format: ^([A-Z]\. )+[[:surname:]]$. Some examples below: Smith JS => J. S. Smith John Smith => J. Smith John S Smith => J. S. Smith J S Smith => J. S. Smith I've managed to get quite far using various regular expressions to cover most of these, but have hit a wall for instances where a full name is provided in an unknown order. For example: Smith John John Smith Smith John Stone Obviously regular expressions won't be able to discern what order the given name, surname and middle name(s) are in

Join the discussion →

Add label text to radio buttons in Wordpress site using Contact Form 7

I'm trying to improve my website by making it more accessible and compliant with WCAG 2.0 (Level AA) guidelines. It's a Wordpress site that uses Contact Form 7 to create forms. By default, Contact Form 7 doesn't add a label to its input elements. It's easy enough to manually add a label complete with a for attribute to input of type "text": <label for="address">Street Address*</label><br /> [text* Address1 id:address] However, I'm having trouble doing this for radio buttons. I know that there's an option to "use_label_element" when generating a radio button tag with Contact Form 7, however thi

Join the discussion →

How to name value with range of 0.0 to 1.0?

Quite often I use values between 0.0 and 1.0 to hold progress, or transparancy, or other things that can go from none to full. A percentage if you will. I don't want to call it a percentage because it is not expressed as a value from 0 to 100. To give my variables a clear name, I still would like to describe this kind of value. What would be an appropriate name?

Join the discussion →

Linker can't find SDL2main and SDL2?

When I tried to compile my SDL project in CodeBlocks I got the following error: -------------- Build: Debug in SDLTEST (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -LC:\MingwLibs\SDL2-2.0.3\lib -o bin\Debug\SDLTEST.exe obj\Debug\main.o -lmingw32 -lSDL2main -lSDL2 c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL2main c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL2 collect2.exe: error: ld returned 1 exit status Process terminated with status

Join the discussion →

I can't compile my SDL project in CodeBlocks

When I tried to compile my SDL project in CodeBlocks I got the following error: -------------- Build: Debug in SDLTEST (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -LC:\MingwLibs\SDL2-2.0.3\lib -o bin\Debug\SDLTEST.exe obj\Debug\main.o -lmingw32 -lSDL2main -lSDL2 c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL2main c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL2 collect2.exe: error: ld returned 1 exit status Process terminated with status

Join the discussion →
Older stories