on-internet

Get latest or new products on home page in magento with layout update

I create new theme in Magento and want to show latest or new products on home page with pagination and number of show product. I copied catalog/product/list.phtml from it's cored file to my template so that i can customize it. Below is code in layout update in homepage: <reference name="content"> <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml"> <action method="setCategoryId"><category_id>3</category_id></action> <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> <block type="page/htm

Join the discussion →

How to use over scroll mode in Android

Problem I need to give some priority for scrolling events in my Activity. I'm using aiCharts (charts library) and I need to zoom, pan, etc. on my areas. Without any ScrollViews it works fine, but, if I use the mentioned Layout, these features works bad. I think because of priority of views. Possible solution I tried to use setOverScrollMode(View.OVER_SCROLL_ALWAYS); on views that need to be on "top" of ScrollView and HorizontalScrollView but doesn't work properly. Layout <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <HorizontalScrollView android:layout_w

Join the discussion →

How can i get HTTP Authorization header

I am developing a Chrome extension to capture the Authentication information. I want to get the HTTP Authorization Header. I tried the Chrome API webRequest.onSendHeaders, but it didn't work following is my code: /***************onsendHeaders*************/ chrome.webRequest.onSendHeaders.addListener(function(details) { console.log(details.url, details.requestHeaders); for(var i = 0; i < details.requestHeaders.length;i++) { var header = details.requestHeaders[i]; if(header.name.toLowerCase() == "authorization") { alert("AUTH!"); /*Never get alert when I login to websites*/ } } }, {"urls":["*://

Join the discussion →

What hash function should I use for a bloom-filter with +128-bit keys?

https://github.com/joeyrobert/bloomfilter uses Random class for the hash function which is a performance killer. What I'm trying to do is input the class with byte[]s instead of a generic argument(T) and get rid of private int Hash(T item) { return item.GetHashCode(); } I know there is a huge performance benefit but I have no idea how to replace _random.Next(_bitSize) here: #region Public Methods /// <summary> /// Adds an item to the bloom filter. /// </summary> /// <param name="item">Item to be added</param> public void Add(T item) { _random = new Random(Hash(item)); for (int i = 0; i < _numb

Join the discussion →

Getting the first non None value from list

Given a list, is there a way to get the first non-None value? And, if so, what would be the pythonic way to do so? For example, I have: a = objA.addreses.country.code b = objB.country.code c = None d = 'CA' In this case, if a is None, then I would like to get b. If a and b are both None, the I would like to get d. Currently I am doing something along the lines of (((a or b) or c) or d), is there another way?

Join the discussion →

inner join with containable cakephp

I have 3 tables, restaurants, orders, users. orders table has fields restaurant_id, status and user_id. restaurant -> hasMany orders orders belogsTo Restaurant orders belongsTo users I need to find only those restaurants that have order with status = 1, and at the same time need to fetch user's info. So, I am making inner join with orders table, $options['joins'] = array( array('table' => 'orders', 'alias' => 'Order', 'type' => 'INNER', 'conditions' => array( 'Restaurant.id = Order.restaurant_id', ) ) ); But how Can I also get users' information along with this, because according to cake docum

Join the discussion →

ValidatorEnable not disabling requiredfieldvalidator

I have some client side script in an ASPX file that enables or disables a required field validator based on whether the form field is visible or not. var oVal1 = document.getElementById(v1); var oVal2 = document.getElementById(v2); ValidatorEnable(oVal1, true); ValidatorEnable(oVal2, false); When I alert the enabled properties of oVal1 and oVal2, they show the correct settings for this condition - oVal1 is enabled, oVal2 is disabled. The problem is the validators are ALWAYS firing. I need to selectively disable one since the field isn't visible, it's not required in this case.

Join the discussion →

Error 1334 .File cannot be found in the Data1.cab

I am working on a Win 7-64 bit machine. I have a software installation package which contains the .msi file, a CAB file and some MST files. I wanted to modify the cabinet file. So I extracted the cab file using CABARC utility. But before making any changes to the extracted files, just for testing the utility I removed the original cab file from the current directory. And created a new cab file from the files extracted from the original cab file, again using CABARC utility. But now if I run the .msi file, it shows the error: ERROR:1334. The file "XYZ" cannot be installed because the file cannot

Join the discussion →

Sticky sidebar: stick to bottom when scrolling down, top when scrolling up

I have been looking for some time now for a solution to my sticky sidebar problem. I have a specific idea of how I would like it to act; effectively, I would like it to stick to the bottom as you scroll down, and then as soon as you scroll back up I would like it to stick to the top, in a fluid motion (no jumping). I am unable to find an example of what I am trying to achieve, so I have created an image that I hope will illustrate the point clearer: Sidebar sits under the header. As you scroll down the sidebar remains level with the content of the page so that you can scroll through both sideb

Join the discussion →

WordPress ContactForm7 datepicker field - disable/block specific dates?

I currently have a WordPress site installed where users can book a tour of our facility (we are a university). I have used the ContactForm7 plugin to create a form within a page where visitors can enter their contact information and then can use a datepicker field to select the specific date that they want to take their tour on. My question is (I've searched high and low for a solution to this but to no avail) is there a way that I can disable or block specific dates from being selected in this datepicker field in the form? For example, there are a number of days when tours are not available (

Join the discussion →

Kendo UI Editor max and minimum characters

I am using MVC extensions for Kendo UI editor. Is there an option to set the minimum and maximum number of characters excluding the HTML content. I used StringLength attribute but that includes the HTML content.

Join the discussion →

iOS reading data from BLE device

I'm trying to read data from a BLE device but keep getting permission error. Demo project can be found here: https://github.com/sergiomtzlosa/CoreBluetooth-Demo (keep in mind - my codes are a bit different than this one). No problem with connection and reading value in general but there are some characteristics (which are essential) give permission error. Console log: Update error!!! Characteristic: "Unknown (< fff4 >)" with error: "Reading is not permitted". So, when I subscribe or read data from that characteristic, it sends me NULL everytime (probable reason: no read permission). Console lo

Join the discussion →

Session.cookie_domain in php.ini

I have been reading as much as possible about the php.ini file and i have found nothing about whether or not its bad/dangerous to not set the session.cookie_domain in the php.ini. We are in a production environment and this is not set. Are there security issues with not setting this. Cookies appear to be working well, no real issues. The php.ini file looks like this: session.cookie_domain =

Join the discussion →

video.js size to fit div

I have a video in a div with a 40% width. In the html, width="100%" height="auto" makes the video disappear. Setting a specific size in pixels won't fit the div. Leaving the html blank leaves the video the wrong size and with black bars on the sides. I've tried the suggestions in most other posts, but can't seem to get it to work. <div id="box"><video id="trialvid" class="video-js vjs-default-skin" controls preload="auto" width="auto" height="auto" poster="images/reelthumbnail.jpg" data-setup='{"example_option":true}'> <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'

Join the discussion →

Data noise with PCA for dimension reduction

I have a question related to data noise and principal component analysis (PCA). Situation I have a data matrix containing X, Y, Z joint data. I have applied PCA, with the stipulation of retaining 98% of the variance. However, even after reduction the data still remains very noisy. Problem I have spent a few hours reading, and I'm unsure of the best approach to take. I need to perform PCA for dimension reduction. However, the noise present in the dataset still presents several issues. I need an intermediate step before applying PCA to reduce the noise contained in the dataset. I have been advis

Join the discussion →

Data noise with PCA

I have a question related to data noise and principal component analysis (PCA). Situation I have a data matrix containing X, Y, Z joint data. I have applied PCA, with the stipulation of retaining 98% of the variance. However, even after reduction the data still remains very noise. Problem I have spent a few hours reading, and I'm unsure of the best approach to take. I need to perform PCA for dimension reduction. However, the noise present in the dataset still presents several issues. I need an intermediate step before applying PCA to reduce the noise contained in the dataset. I have been advis

Join the discussion →

A more accurate data type than float or double?

Does C++ have a more accurate data type than float or double, or do I just have to settle for the fact that my calculations will be off? EDIT: As Mr. Lister has pointed out, my question is regarding the precision. It's a bit frustrating when you add two floats/doubles together and the number is off half the time comparing to the calculation done by hand.

Join the discussion →

Blocking request in Chrome

I'm trying to block some requests in a Chrome app. I created a JavaScript listener that does this validation: chrome.webRequest.onBeforeRequest.addListener( { urls: ["*://site.com/test/*"] }, ["blocking"] ); But the requests are not blocking. Did I miss something in this code? My manifest: "background": { "scripts": ["listener.js"], "persistent": true }, "permissions": ["tabs", "http://*/*"], "manifest_version": 2,

Join the discussion →

SMTP 535 5.7.0 Error: authentication failed

I used SMTP protocol for sending email in my system.The system is developed with Codeigniter.in the system two types of email sending functionality, one is from codeigniter Email libraries and other is from swift mailer.In codeigniter it is working but in swift mailer an authentication failure message is shown. Both functions use same login details.The port used is 25.

Join the discussion →

How to convert blob image into binarybase64 in java?

I have image in blob format from DB , i am holding that blob image in byte array and converting it to Binary Base64 format. For encoding the blob to binary base 64 I am using below code, byte[] imageByte = getblob();//from DB byte[] encodedImage = Base64.encodeBase64(imageByte); is there any other way to do it or am doing it in right way please help me?

Join the discussion →

Uploadify not showing progress on Firefox Mac

While reviewing my website code, I've noticed that my uploadify is working fine on all browsers except for Firefox, and this is only happening on Firefox which is on a MAC machine. It is very odd, but the files are actually uploading fine, its just that the loading progress bar % does not increase and stays at 0 until the script is actually completed. Code is the same for all browsers and it is even working in IE 8. Ive tried on all browsers, PC and mac. I have used the onUploadProgress callback function 'onUploadProgress' : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBy

Join the discussion →

bad argument to internal function error in python

I have a python script that uses ReportLab to create a report, the script has been tested and works as expected however on occasions I get the following error message TraceBack info: File "C:\tools\LegionellaTool.py", line 605, in <module> createReport(selectedCoolingTowers, Report_outputs_folder, dbo_COLGIS, openPDF) Error Info: ..\Objects\moduleobject.c:50: bad argument to internal function Line 605 is createReport(selectedCoolingTowers, Report_outputs_folder, dbo_COLGIS, openPDF) createReport is the function that ...creates the report. I have debugged through the code and I havent got any e

Join the discussion →

Web service call through JS, DataType Json

I am trying to call web service through a JS but anyhow it doesnt get call. I am trying to make sum of 2 number. Page contains of 3 textbox and it has it text set hard codded as : <form id="form1" runat="server"> <div> <asp:TextBox ID="Text1" Text="5" runat="server"> </asp:TextBox> <asp:TextBox ID="Text2" Text="2" runat="server"> </asp:TextBox> <asp:TextBox ID="Text3" runat="server"> </asp:TextBox> </div> </form> My code are as follows: <script type="text/javascript"> $(document).ready(function () { debugger; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "C:/Users

Join the discussion →

How to find whether the ip address is proxy/vpn/vps

I have a hosted web application, I would like to prevent signup from proxy/VPN/VPS ip address. How do i check whether the users ip address is proxy/vpn/vps syste. For example clixsense.com site, users can't create account, it shows cannot access from proxy/vpn/vps ip address. Thanks in advance.

Join the discussion →

Some std::unique_ptr uses and "gotchas"

What are some of C++11 std::unique_ptr uses and gotchas? Can I use std::unique_ptr also to store dynamically allocated arrays? Can I use std::unique_ptr also with resources using a custom deletion mechanism?

Join the discussion →

How to send a request (and receive it) in XML format from some web-service?

I'm working in a E-Commerce website, with JSF 2. In order to communicate with the company that makes all the operation with the banks, I need to send this XML to them (it's just a sample provided from them): <?xml version="1.0" encoding="ISO-8859-1"?> <requisicao-transacao versao="1.2.0" id="6560a94c-663b-4aec-9a45-e45f278e00b4" xmlns="http://ecommerce.cbmp.com.br"> <dados-ec> <numero>1001734898</numero> <chave>e84827130b9837473681c2787007da5914d6359947015a5cdb2b8843db0fa832</chave> </dados-ec> <dados-pedido> <numero>1603662828</numero> <valor>100</valor> <moeda>986</moeda> <data-hora>2010-07-

Join the discussion →

ViewDidLoad not called when adding to Container View

I have a container view set up in my storyboard file but I want to embed the view controller programmatically after setting some properties. This is my code in the parent VC's viewDidLoad: _workoutVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"entryTableVC"]; _workoutView = _workoutVC.tableView; [self addChildViewController:_workoutVC]; [_workoutVC.tableView setFrame:_container.bounds]; [_container addSubview:_workoutView]; However, viewDidLoad in the child is not called at any time. When I run the simulator my container view is blank. I've

Join the discussion →
Older stories