macro to add value in cells corresponding to same category

Uncategorized
Question: I am fairly new to macro-VBA . It could be very helpful if some one could guide me in the following. I have a data-set that has category name in column A and in column B the corresponding values. It looks somewhat like this Based on the category name in column A, I should get a sum of values present in B. that is if cells A1:A3 belongs to category "a", values present in B1:B3 should be summed and the corresponding rows should be merged in column C and the resultant sum should be displayed in column C Output should look like this I tried to code using in the following way Sub main() Dim i As Long Dim a As Long ' Dim sum As Long sum =…
Read More

NoMethodError in Admin::ApartmentPostsController#create

Uncategorized
Question: I am using active admin for my admin panel in Ruby on Rails website. I have this code on my ApartmentPost resource. ActiveAdmin.register ApartmentPost do permit_params :title, :max_stay, :min_stay, :bed_configuration, :number_of_guests,:features, :description, :admin_user_id, :apartment_number,:latitude, :longitude, :clean_fee, :country, :location, photos: [] form(html: { multipart: true }) do |f| f.inputs do f.input :title f.input :max_stay f.input :min_stay f.input :bed_configuration f.input :number_of_guests f.input :features f.input :description f.input :country f.input :location f.input :apartment_number f.input :latitude f.input :longitude f.input :clean_fee f.input :admin_user_id, as: :hidden, input_html: {value: current_admin_user.id} f.file_field :photos, multiple: true end f.actions end So the error I am getting is while creating a new ApartmentPost. The error is: I had created a column called rate in AparmentPost but now it is already removed. Still it gives this error. Here's the table from schema.rb:create_table…
Read More

How to get latitude and longitude from JSON using volley?

Uncategorized
Question: I am trying to use volley library to get longitude and latitude of a particular address. Though I have been able to get the address successfully, but I am not getting the latitude and longitude values. String googleMapUrl = "http://maps.googleapis.com/maps/api/geocode/json?address="+ place + "&sensor=false"; JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, googleMapUrl, null, new Response.Listener() { @Override public void onResponse(JSONObject response) { try { Toast.makeText(MainActivity.this, "Response "+ response, Toast.LENGTH_SHORT).show(); // JSONArray res = o.getJSONArray("results"); for (int i = 0; i < response.length(); i++) { //JSONObject jsonObj = new JSONObject(result.toString()); //JSONArray resultJsonArray = jsonObj.getJSONArray("results"); JSONObject jsonObj = (JSONObject) response.get("i"); JSONObject resultJsonArray = jsonObj.getJSONObject("results"); // Extract the Place descriptions from the results // resultList = new ArrayList(resultJsonArray.length()); JSONObject before_geometry_jsonObj = resultJsonArray.getJSONObject("0"); JSONObject geometry_jsonObj = before_geometry_jsonObj .getJSONObject("geometry"); JSONObject location_jsonObj = geometry_jsonObj .getJSONObject("location"); String lat_helper =…
Read More

Error 1 error LNK1104: cannot open file ‘opencv_calib3d2411d.lib’

Uncategorized
Question: I am tried to use the OpenCV-2.4.11 library in visual studio 2013. unfortunately, every time I run any C++ code even "Filtering Image", the compiler generates this error Link: fatal error LINK1104: can't open file 'opencv_core2411d.obj' Also, I'm using Windows 10 and please provide steps to successfully import opecv2.4.11 into visual studio and let me know why I am receiving this error. Also, I put the opencv_calib3d2411d.lib to the additional dependencies.Also, I clicked on YES in Use Library Dependency.but Still, have the same problem.If you can give another solution, Its good. Answer: Read more
Read More

ngannotate-rails not working in development mode

Uncategorized
Question: I'm using ngannotate-rails to help get angular code to work in a compressed format. This is in a Rails 3.2 + Angular 1.5.x app. I've added the following to my Gemfile and ran bundle group :assets do gem 'sprockets-derailleur', '~> 1.0.0' # Speed up precompiles with multi-core compile gem 'turbo-sprockets-rails3', '~> 0.3.14' # Compile only changed assets gem 'sass-rails', ' ~> 3.2' # Main CSS extension in use gem 'less', '~> 2.6.0' # Less required for ui-utils plugin for AngularJS gem 'therubyracer', '~> 0.12.1' # v8 library required for less gem 'coffee-rails' # Language which compiles into JS gem 'uglifier' # JS parser, minifier, compressor or beautifier toolkit gem 'ngannotate-rails', '~> 1.2' # AngularJS minifier end Then in config/environments/development.rb I've added the following if ENV['NG_FORCE'] == 'true' config.assets.compress =…
Read More

Alphabetical category index for Woocommerce?

Uncategorized
Question: I'm setting up an alphabetical index for my Woocommerce product categories. I'm not sure where to start to accomplish this task. Here are two examples of what I'm trying to achieve: https://www.spiritshop.com/school/california https://www.prepsportswear.com/college_directory/us/California.aspx I see this popular category layout quite often on websites. I would assume there is a plugin, but I have searched for a plugin solution for many days now and have not been successful. Can someone point in a direction to complete my task? I also use the flatsome theme. Thank You. Wyatt Answer: Read more
Read More

Deleting everything between [ ] in a list

Uncategorized
Question: I have a list of 500 individual lines and they consist of:12 asdfdfsdfz adf [SGH] 1 sDasd fsdfsdf [SGV] and so on 500 times. I wish to remove everything in between the brackets and the brackets themselves Any help would be helpful thanks in advanced Answer: Use a Unix tool called sed and match them with RegEx, and now you have two problems. sed 's/[[A-Z]*]//g' your.file > output.txt Do note that this will delete them only if there's nothing but UPPERCASE letters between the brackets, i.e. it will not delete something like [abcd] Strictly speaking, the above command will only delete An opening bracket [, followed by Zero or more uppercase letters, and followed by A closing bracket ]. Read more
Read More

How to enter date, month, year in 3 different dropdowns more efficiently

Uncategorized
Question: So, I have just started out on automation and I am stuck on how I can have my date, month, year which are in 3 different drop downs with different xpaths entered in more efficient way such that I do not have to use select class for every single one of them Here is the code:::::::::::::::::::::::package com.singh.assignment; import java.io.FileReader; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class Json { public static void main(String args[]) { JsonParser parser = new JsonParser(); try { Object obj = parser.parse(new FileReader("C:\Users\dell\eclipse- workspace\Assignment\data.json")); JsonObject jsonObject = (JsonObject) obj; String fname = (String) jsonObject.get("fname").getAsString(); String lname = (String) jsonObject.get("lname").getAsString(); String baseurl = (String) jsonObject.get("baseurl").getAsString(); String mstatus = (String) jsonObject.get("mstatus").getAsString(); System.setProperty("webdriver.gecko.driver","E:\WORK\geckodriver.exe\"); WebDriver driver = new FirefoxDriver();…
Read More

Running Kmeans Clustering example with Maven (Mahout in Action)

Uncategorized
Question: I'm considering the same example as in How to run examples in mahout in action book, but I want to use Maven to run it. It builds fine with > mvn clean -DskipTests package but when I try to run it:> java -cp target/K-Means-1.0-SNAPSHOT.jar Clustering.Kmeans Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/mahout/math/Vector at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.apache.mahout.math.Vector at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more This is strange, since I included mahout-math-0.7 in my pom.xml, and I manually checked that it includes Vector.class. So what's going wrong? Do I need to use hadoop rather than java, or is there something…
Read More