w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Affordable alternatives to Pusher
There's a whole host of self hosted realtime web technologies available including Slanger and poxa that allow Pusher's client and server libraries to be used. Slanger and Poxa are open source server implementations of the Pusher protocol. Slanger is written in Ruby and Poxa in Elixir. Of course, Pusher removes the hassle of installation and maintenance, has a whole host of server and client libraries, massively reduces resource usage (since you're outsourcing the realtime communications layer), has a great community of users, and of course handles scaling problems

Categories : Ruby On Rails

Magento VAT (tax) rates not working correctly on displayed prices: VAT is added even catalog prices are including tax
No shame at all in missing this setting - unless you knew about it you wouldn't think it would be related to the display of tax inclusive prices. System -> Configuration -> Sales - Shipping settings - Origin (if you are using the UK language pack replace Shipping Settings with Delivery Settings).

Categories : Magento

Android Development RSS Feed does not work
Hey man i feel your pain I spent two days on that chapter figuring out solutions for the bugs. Fist and foremost this is not a finish version of the book it is plagued with errors so don't feel bad and keep that in mind. strong text Here are the solutions to your problems. On mainActivity.java package com.example.nasadailyimage; import android.iotdHandler; import android.os.Bundle; import android.app.Activity; import android.graphics.Bitmap; import android.view.Menu; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); IotdHandler handler = new IotdHandler(); //create handler

Categories : Java

How to Work on new development without affecting same production code
I believe that I am in a similar situation. What we've done is simply create two almost identical databases; production and development. The production database feeds our reporting software while the development database is where we are free to test out changes before copying the changes into production. All data loaded into the production database is loaded into the development database through a series of jobs and stored procedures that execute daily. This method, however, does involve extensive duplication of tables, stored procedures, etc., but it is the simplest way we know how to get the functionality we need.

Categories : Sql Server

Git flow to work with troubled development method
If scheduled and weekly releases share common codebase (i.e you have single development mainline and one supported version per system) you can use "Branch per task" idea and Git Flow as implementation of idea. Would a different version control system work better? It's (mostly) a question of personal tastes and preferences

Categories : GIT

Can a high quality JPEG be converted to a low quality JPEG without decoding it?
Theoretically yes. But practically, any system capable of doing that would be capable of decoding and re-encoding the jpeg within reasonable time. Any code that attempts to reduce the jpeg quality directly would need to have the following 2 phases : Phase1. Parse the jpeg file to identify various markers and the payload. Phase2. Strip the high-entropy parts of the payload and prepare new file. Phase1 above would have the complexity of a jpeg decoder. Any potential performance gains would have to be gained by implementing Phase2 to execute faster than a jpeg encode at a lower Q-value. This is not an attractive proposition because the encoding time decreases with a reduced Q-factor2. In other words, encoding image-data at lower Q-factor is almost always faster than attempting to strip t

Categories : C

What is the proper way to work with shared modules in Python development?
I think that this is the best reference for creating a distributable python package: http://guide.python-distribute.org/creation.html also, don't feel that you need to nest everything under a single directory. You can do things like platform/ core/ coremodule api/ apimodule and then do things like from platform.core import coremodule, etc.

Categories : Python

onPostExecute doesn't run, @override doesnt work android development
The signatures don't match. You're attempting to override: protected void onPostExecute(Result result) with the signature protected void onPostExecute(JSONObject result) ...which doesn't exist in the superclass.

Categories : Java

Linode + Debian + Apache, a private folder for development work
First, this would probably be more appropriate for Serverfault. With that in mind... If I had to keep my dev environment in my home folder, I'd create a symlink in /var/www that ties to the dev folder. As far as securing it, I don't know if this is still a recommended or viable way of handling secure access, but it seems like http://www.codinglogs.com/blog/server-management/vps-setup-guide/nginx-password-protect-web-directory might be the way to go as long as you feel secure using a username/password combination. Another valid answer (also on stackoverflow) would be password protect /backoffice folder in nginx. If you want something more secure, the next step would probably firewall rules.

Categories : Linux

Nested models work fine in development but are not being saved in production
So I'm not 100% sure what the problem was but I've fixed it. I ended up removing anything that had to do with skus then slowly adding it back in bit by bit. What I think most likely caused the issue was that I had a version of a the Product class that I renamed because I wasn't using it and didn't want to lose track of the work that I had done (I know, not necessary as I'm using git. I guess old habits die hard) Anyway, I had changed the file name, however I neglected to rename the class definition in the file. The name was such that it came after the real Product class that I was using. I'm thinking that this caused a conflict on heroku. The thing I don't understand is why it didn't cause any problems in my local dev environment.

Categories : Ruby On Rails

Installed Eclipse "ADT" bundle for Android development - now auto assist doesn't work
Preferences - Java - Editor - Content Assist - Advanced - Restore Defaults EDIT: If others are having problem even after doing the above suggestion, please also check "Java proposals" is ticked/checked under - Preferences - Java - Editor - Content Assist - Advanced.

Categories : Eclipse

Do any standards and practices exist for applying acceptance test driven development to non-development tasks?
Take a look at this post in StackExchange: Agile methodologies such as Scrum in non-software development projects Also there is a nice article called "Scrum is not just for software" written by the Agile Alliance (note that this is a PDF download)

Categories : Misc

Order prices according to currency
select lowmoney, topmoney, currency from TheTable order by /* Order by amount in dollars (could calculate to euro as well) */ (lowmoney + (topmoney / 100)) * case currency when 'eur' then 1.3266 /* Current exchange rate, according to Google */ when 'usd' then 1 else null /* What to do with other currencies. */ end desc

Categories : Mysql

Analyzing Stock Prices in F#
I think the problem is that DescriptiveStatistics does not understand units of measure and so you need to pass it the data without the unit annotations. The easiest way to do this is to apply float conversion function to all elements in your msftClosedUsd using Seq.map function: let stats = DescriptiveStatistics(Seq.map float msftClosesUsd)

Categories : F#

Methods of comparing prices
If we restrict the problem to simply choosing which vendor to buy each product from, and you get a vendor-dependent reduction in shipping cost if you spend a vendor-dependent amount, then you can formulate your problem as an integer linear program (IP or ILP), which is a good strategy for problems suspected to be NP-hard because there has been a lot of research and software packages developed that try to solve ILP fast in practice. You can read about linear programming and ILP online. An ILP problem instance has variables, linear constraints on the variables, and a linear objective you want to minimize or maximize. Here's the ILP set up for your problem: For each product that a vendor sells, you have one vendor-product variable that tells how many of the product you will purchase from th

Categories : Algorithm

Extract products and prices from invoice
Finding the description /Vehicle Description((?!Registration$).*)Registration/m Finding the Registration Number /Registration Number((?!Vin$).*)Vin/m Finding the cost of cover /Cover(.*)/m These are all pretty lazy regex matches. However you did not provide a lot of different samples. But these should get you started. Example Usage: match = /Vehicle Description((?!Registration$).*)Registration/m.match(PDFTEXT) http://www.ruby-doc.org/core-2.0/Regexp.html

Categories : Ruby On Rails

MySql retrieve products and prices
It's hard to tell without sample data and desired output but you can try something like this SElECT p.*, q2.* FROM ( SElECT Product_id FROM Price WHERE `start` >= '2013-05-01' AND `end` <= '2013-05-15' GROUP BY Product_id LIMIT 0,10 ) q1 JOIN ( SELECT * FROM Price WHERE `start` >= '2013-05-01' AND `end` <= '2013-05-15' ) q2 ON q1.Product_id = q2.Product_id JOIN product p ON q1.Product_id = p.Id Here is SQLFiddle demo

Categories : Mysql

How to test localized prices with In-app billing v3
From the DOCS of the In-App Purchase API v3 The API also introduces a long-anticipated feature: the ability to query in-app product information directly from Google Play. Developers can now programmatically obtain an item's title, description and price. No currency conversion or formatting is necessary: prices are reported in the user's currency and formatted according to their locale

Categories : Android

List all products with no prices in MySQL
Assuming every product is in the price table, you can do an inner join. select a.Prod_id, a.Prod_name, a.Prod_description from PRODUCTS a inner join PRICES b on a.Prod_id = b.Prod_id where b.Prod_price_active=0

Categories : Mysql

Need help calculating prices in dropdown and checkboxes together
Since you are having multiple checkboxes and drop downs, it is difficult to have unique ids as the code is needed to replicated many times. Better you can have a class for checkboxes and dropdowns and trigger the function that updates the total charge on changing quantity. I have added a class for the drop downs and called a function to update the total. Here is the function body which will work for the entire table, function calculateTotal() { var chargetotal = 0; $('#tab > tbody > tr').each(function() { if ($('td:nth-child(1) > span >input', this).is(':checked')) { var price = parseFloat($('td:nth-child(3)', this).text().replace('$', '')); var quantity = $('td:nth-child(4) option:selected', this).val(); chargetotal = chargetotal + price*quantity; } $

Categories : Jquery

Underscore reduce for adding prices
This is a pretty subjective question, so I suppose I'll give a subjective answer: There are basically three things at issue here: actual code efficiency, code legibility, and code style. The last one doesn't really matter IMO except insofar as it affects legibility and the consistency of your code base. In terms of efficiency, _.reduce is more efficient than _.map + _.reduce, so you can drop that idea. Using _.map creates a new array with the transformed values - there's no need for this. The _.each + summation function approach may be marginally less efficient (you need to keep track of your running-total variable somewhere else) and to my mind it's less legible, because it takes the relevant code and moves it further from the loop where you're using it. You also don't get a nice clean

Categories : Javascript

Magento - Update all prices in category
Well, let's see what I can do from here. <?php require 'app/Mage.php'; Mage::app(); //What Magento Version are you running? Try Mage::init(); for later versions /** * We're going to modify your second collection here * Since the last bit didn't work, we're gonna load * The category, then load the products for that category **/ $categoryId = 5; $products = Mage::getModel('catalog/category') ->load($categoryId) ->getProductCollection() ->addStoreFilter() ->addAttributeToSelect('name') ->addAttributeToSelect('value'); if( $products->count() != 0 ) { //We actually want type coercion here foreach ($products as

Categories : PHP

Regex for prices, skipping over commas
you can use this pattern instead: $d{1,3}(?:,?d{3})*(?:.d{2})? note that i have supposed that you have always two digits after the period. You can easily change this if you need.

Categories : Regex

Sort orderbook when prices are floats
First of all, I would suggest storing prices as integers. Just make the unit cents, pence, öre or whatever the smaller unit is in your country - or even 1/1000th or 1/10000th of the main currency. This will save a lot of headache later on. But as long as you are not making if (x.price == y.price), it's perfectly fine to use price as a key. For sorting purposes, a binary tree only needs a less than (or greater than) comparison, which should be perfectly safe for floating point values. A value is always either smaller or bigger than some other value. It's only when you make calculations and try to determine if the value is precisely equal you get problems with floating point. [Or when you expect an exact result from calculations, such as multiplying by 2.46, then dividing by 2.46 and then

Categories : C++

How can I deformat string with prices in python?
Your problem is by using findallyou will retrieve all matching text fragments. But, there is two matching fragment in the last example: >>> re.findall(r"d..?", "From $3.50 tp $12,000.50" ) ['3.', '50', '12', '00', '0.', '50'] And joining them will not produce something that could be seen as a number: >>> "".join(['3.', '50', '12', '00', '0.', '50']) '3.5012000.50' Assuming all your prices start with $and you are only interested in the first price, something like that might be better: >>> import re >>> import string >>> p = [ "$12,000.50", "$3.50", "From $3.50 tp $12,000.50", "$12,000" ] >>> [re.search(r"$(d+(.d+)?)", string.replace(price,",","")).group(0) for price in p] ['$12000.50', '$3.50', '$3.50', '$12000'] >>>

Categories : Python

PayPal shipping prices for different countries
You could calculate the shipping on your side, and pass that shipping about over to PayPal as the amount to charge for shipping. There are several different ways to do this, some of which would depend on how you are currently integrated with PayPal.

Categories : Paypal

Display and calculate 3 different prices for every user in Ubercart
THis module does exactly what you're looking for, I;ve used it before for wholesale and retail prices https://drupal.org/project/uc_price_per_role

Categories : Drupal

How can I get rid of Nans in Matlab analyzing stock prices?
I'll have to make some assumptions here, as I didn't fully understand your question. The following first deletes all rows that exist of NaN exclusively, and continues by deleting all columns that contain at least one NaN: M = [ ... 6.41 16.51 NaN NaN 69.78 6.22 16 NaN NaN 68.48 6.17 15.61 NaN NaN 69.46 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 5.83 15.14 NaN NaN 69.85 6.4 17.64 NaN NaN 71.03 6.07 16.04 NaN NaN 68.64

Categories : Matlab

Finding percentage change in prices between rows
You can do this with correlated subqueries and joins. The first problem is identifying the most recent price. tmax helps with this by getting the latest date for each item. This is then joined to the original data to get information such as the price. Then a correlated subquery is used to get the previous price as least xxx milliseconds before that date. Note this is a relative time span, based on the original date. If you want an absolute timespan, then do date arithmetic on the current time. select t.itemid, t.price - t.prevprice, (t.price - t.prevprice) / t.price as change from (select t.*, (select t2.price from yourtable t2 where t2.itemid = t.itemid and t2.date < t.date - xxx order by date

Categories : SQL

Algorithm for Removing Outliers from a dataset of prices
One issue is that there are multiple definitions for what an outlier actually is. However, for this purpose a straight forward solution seems sufficient. You could remove outliers by limiting the range of values to either +- some percentage or +- some number of standard deviations (probably one or two, but it could very) from the average price. Likely you'd probably want to use a combination of both, as if the prices don't very much, then a discount could be viewed as an outlier, which may or may not be appropriate. In any case, you'd likely have to do some experimenting to determine how sensitive it is. Chances are you'd probably want to set it so outliers must be at least some percentage away from the mean even if it's only 5-20 percent. Below are a few percentage based limits based on

Categories : PHP

How to offer variable In-App Purchase prices like this developer is doing?
You can have multiple products which are the same, but with different ifentifiers and prices. Then, when you display your store you simply look at the record of purchases in the app and decide which one of your products to display.

Categories : Iphone

A better database model for holding postage prices
Have one entry for each country. name: Large Item country: UK standard_price: 5 express_price: 10 name: Large Item country: Europe standard_price: 10 express_price: name: Large Item country: Europe standard_price: 20 express_price: 30

Categories : Ruby On Rails

MongoDB $gt/$lt operators with prices stored as strings
If you intend to use $gt with strings, you will have to use regex, which is not great in terms of performance. It is easier to just create a new field which holds the number value of price or change this field type to int/double. A javascript version should also work, like so: db.products.find("this.price > 30.00") as js will convert it to number before use. However, indexes won't work on this query.

Categories : Mongodb

Floats, Decimals, Prices, and partial quantities
You can convert float to decimal like this: Decimal(str(float(3.5))) as a workaround. One more reason to use float is this intersting benchmarking article

Categories : Python

Auction Nudge - disappearing text and prices
Try this: <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> function auction_nudge_loaded() { var filter_cleared = false; $(document).ready(function() { //Clear text input on focus (only the first time!) $('#auction-nudge-filter').focus(function() { if(! filter_cleared) { $(this).val(''); filter_cleared = true; } }); //Each time the keyword input field is updated $('#auction-nudge-filter').keyup(function() { var keyword = $(this).val().toUpperCase(); //It

Categories : Jquery

How is the final price calculated when group prices are used?
All kinds of specialprices are ment for discounts only. Magento takes the lowest price after evaluation all discount types. This includes special prices, tier prices or catalogrules for examples. See Mage_Catalog_Model_Product_Type_Price::calculatePrice for further reference.

Categories : Magento

Can I use PayPal to change product prices based on location?
You can use PayPal to charge buyers in all these currencies, but unfortunately you cannot use PayPal for all your currency conversion and display the prices on your site. However, if you're selling in GBP and your buyer's funding sources are in EUR, we will of course automatically convert these. Note; our Adaptive Payments product does offer a 'CurrencyConversion' API call, but this API call is not intended for on-the-fly calculation for your product listings.

Categories : Paypal

Problems with Magento prices after included tax class to product
this is the famous magento rounding bug: go to /app/code/core/Mage/Core/Model/Store.php change method round to 4 digits: public function roundPrice($price) { return round($price, 4); } Best practice would of course be not to hack the core file. At least copy file to app/code/local/Mage/Core/Model/Store.php or do a rewrite. Well good is neither of the actions, but there might be no other way.... have fun!

Categories : Magento

Can Magento handle large numbers of product prices
Magento is able to handle this. Of course it depends on the hardware also :). There might be some problems in the add-to-cart and checkout process. by problems I mean it might slow down the process a little. For product listing Magento uses the index tables for prices (and others) so this shouldn't be an issue. By the way...your indexing process will take longer. You might not be able to run it from the backend (but that is not recommended anyway).

Categories : Magento

Hide prices on home page of featured products
is_home() function checks if the page is home page or not. Add this condition wherever u are displaying the content. If you are using widget the probably u need to write this condition while calling sidebar. if ( is_home() ) { // Hide Prices and products } else { // Show prices and products. }

Categories : Wordpress



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.