w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Most Efficient Way To Export Access 2003 Listbox RowSource (query) To Excel 2003
Try generating a XML file. Here an example: http://blogs.msdn.com/b/brian_jones/archive/2005/06/27/433152.aspx P.S. About first method. To avoid users clicks you can hide Excel. Also you can speed up Excel (see functions below). Use Prepare() before putting data and Ended() after it or in case of error. Public Sub Prepare() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Application.EnableEvents = False ActiveSheet.DisplayPageBreaks = False Application.DisplayStatusBar = False Application.DisplayAlerts = False End Sub Public Sub Ended() Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic Application.EnableEvents = True ActiveSheet.DisplayPageBreaks = True Application.DisplayStatus

Categories : SQL

Nested Weights Vs Nested Layouts with weights. Which is better?
The second layer of layouts doesn't prevent the extra processing from occurring/propagating. My understanding is that linearlayout actually ALWAYS does the two passes but that could be simply what happens in practice because if you aren't using weights, you could do the same layout using relativelayout. Just to elaborate. the onMeasure propogation occurs twice from the root moving down. In both cases, the framelayouts are measured 4 times.

Categories : Android

GridBagLayout row weights
If you don't need any other special features of the GridBagLayout, you could use a BorderLayout instead, where the "north" part is an embedded GridLayout with an unspecified number of rows (i.e. the "rows" argument is 0). public class LayoutTest implements Runnable { public static void main(String[] args) { SwingUtilities.invokeLater(new LayoutTest()); } @Override public void run() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); JPanel north = new JPanel(new GridLayout(0, 1)); for (int i = 0; i < 5; ++i) { JPanel p = new JPanel(); p.setPreferredSize(new Dimension(0, 25)); p.setBorder(new LineBorder(Color.BLACK, 1));

Categories : Java

What should I store Weights in?
Option 1 Use enum Measurement and Dictionary<Measurement, string> to map from Measurement to the display name. public enum Measurement { Grams, FluidOunces, ... } private static Dictionary<Measurement, string> displayName = new Dictionary<Measurement, string> { { Measurement.Grams, "Grams" }, { Measurement.FluidOunces, "Fluid Ounces" }, ... }; public static string DisplayName(Measurement measurement) { return displayName[measurement]; } Option 2 Use class Measurement that has no public constructor, has public static readonly instances, and has properties. public class Measurement { public string DisplayName { get; private set; } private Measurement(string displayName) { this.DisplayName = displayName; } publi

Categories : C#

Misunderstanding Android weights
Weights are somewhat counter-intuitive at times. Try using decimals so the big one will be .66 and the small one will be .34. There are many examples out there that use whole numbers but I believe that in most cases it is better to use numbers between 0 and 1. EDIT: So I just looked a little more at your xml and realized it's probably more because of the width and heights you are using. For best results with weights you should use "fill_parent."

Categories : Android

Display Some Nodes with their weights
This looks promising: JavaScript InfoVis Toolkit Specifically: this Demo Or Raphaël—JavaScript Library with this demo.

Categories : C#

Using RelativeLayout instead of Nested Weights
You are right that RelativeLayout is difficult to make into tables such as the one you made above. LinearLayout is really ideal for that, which is why the TableLayout and TableRow view groups are subclasses of LinearLayout. I can recommend a couple of alternatives besides RelativeLayout that will increase layout efficiency, however. First, you can eliminate the second vertically oriented LinearLayout and change the layout weight of the first 4 rows of buttons from 1 to 1.25. This will reduce the number of layout passes from 8 to 4, which is the best you can do for a table. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:o

Categories : Android

Creating a linearlayout with weights
I'm not sure if this is your only problem but when using wieght your layout_width should be "0dp" for a horizontal orientation and layout_height should be "0dp" for a vertical orientation. So for example your first child should be <LinearLayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="4" android:gravity="center_horizontal|center_vertical" android:orientation="horizontal" > because it belongs to a parent LinearLayout who's orientation is vertical Update Something like this should get you really close. Note I had to take out your resources to make it work in my editor so you will just have to put those back in <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pare

Categories : Android

Android LinearLayout and weights issue
Try This layout Updated Layout <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center_horizontal" android:orientation="vertical" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="one" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="two" /> </LinearLayout> <View android:layout_width="1dp" android:layout_height="88dp" android:background="@android:color/darker_gray" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android

Categories : Android

When I need to update weights in MultiLayer Perceptron?
I am pretty sure that you have misunderstood the concept here. Two possible strategies are: update weights after all errors for one input vector are calculated update weights after all errors for all the input vectors are calculated which is completely different from what you have written. These two method are sample/batch strategies, both having their pros and cons, due to simplicity the first approach is much more common in implementations. Regarding your "methods", second method is the only correct one, process of "propagating" the error is just a computational simplification of computing derivative of error function, and the (basic) process of learning is a steepest descent method. If you compute the derivative only for part of dimensions (output layer), perform a step in the dire

Categories : Machine Learning

Frequency weights in R (multilevel using lme4)
iccs is a complex survey (see chapter 3 of the user guide) and the R survey package cannot (yet) handle multi-level models - you can read the bottom of this post for more detail if you don't care about standard errors, most of the functions in lme4 have a weights= argument that should give you reasonable guesses.. but the standard errors will all be wrong. the iccs 2009 user guide recommends other software on pdf page 33 of 112.

Categories : R

What is the iOS equivalent to Android layout weights?
You can probably emulate this behavior with the auto layout system in iOS. Note, however, that this requires iOS 6.0+. The reason that this didn't exist for so long is that it didn't make sense on the iOS platform (All ratios were the same on all devices). Using NSLayoutConstraint you could try constraining the width / height of your view to a certain percentage of its superview. I've never tried to do it myself, though. Learning autolayout, however, will require a bit of a time investment (nothing extreme, maybe an hour or two). I suggest the various WWDC videos about it. I don't know if it will work exactly as I have described it, but if it is possible you will undoubtedly be using either NSLayoutConstraint, or overriding layoutSubviews on your custom view to do your layout logi

Categories : Android

Sort array by multiple weights
Maybe my answer was focused too heavy on implementation details. Your question is if there are more elegant ways for this? And I'm saying no. You basically have to map an object with 3 integers to one single integer which you can compare later on. If there will be much more attributes in your class which you have to include in the comparison in the future I'm suggesting you could make some more generic version of your code where each attribute consists of a attribute and a corresponding weight. In that way you can create a more generic form of the compareTo-method. But don't optimize prematurely. I would recommend implementing the Comparable interface like this: public Human(int eyeColor, int hairColor, int height) { this.eyeColor = eyeColor; this.hairColor = hairColor; this

Categories : Sorting

how to set different font-weights for characters in the same input box
Input boxes do not support multiple styling. You need to overlay a DIV and use HTML within that DIV to "simulate" what you want to achieve visually and use CSS to make it still look as if it were an input box. You will need to write some JavaScript to make this work.

Categories : Javascript

Create a stacked 2D histogram using different weights
The weights parameter expects an array of the same length as x and y. np.histogram2d. It will not broadcast a constant value, so even though the mass is the same for each call to np.histogram2d, you still must use something like weights=np.ones_like(x)*mass Now, one problem you may run into if you use bin=nbin is that the bin edges, xedges, yedges may change depending on the values of x and y that you pass to np.histogram2d. If you naively add heatmaps together, the final result will accumulate particle density in the wrong places. So if you want to call np.histogram2d more than once and add partial heatmaps together, you must determine in advance where you want the bin edges. For example: import numpy as np import itertools as IT import matplotlib.pyplot as plt N = 50 nbin = 10 x

Categories : Python

mysql add weights on query parameters
The basic query to count the ingredients is: select di.id_dish, count(*) as NumIngredients from dish_ingredient di join ingredient i on i.id = di.id_ingredient group by di.id_dish; You can modify this for ingredients by introducing a case clause into the query: select di.id_dish, count(*) as NumIngredients, sum(case when i.name = 'beef' then 2.0 when i.name = 'salt' then 0.5 . . . end) as SumWeights from dish_ingredient di join ingredient i on i.id = di.id_ingredient group by di.id_dish order by SumWeights desc; The . . . is not part of the SQL syntax. You have to fill in with similar lines where this occurs. An alternative formulation is to put the information in a subquery. The subquery contains the weight for

Categories : PHP

Prim's algorithm when range of Edge weights is known
With this constraint, you can implement a heap that uses O(V) / O(W) respectively space but has O(1) insert and O(1) extract-min operations. Actually you can get O(1) for all operations you require for Prim's algorithm. Since the time complexity of the heap influences the complexity of the main algorithm, you can get better than the default generic implementation.

Categories : Algorithm

Visibility changed programmatically does not match with weights
I finally managed it to work by adding a LinearLayout enclosing the GameView and another enclosing the TextView, and changing the weights of these LinearLayouts: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:id="@+id/layout1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="5"> <GameView android:id="@+id/gameview" android:id="@+id/gameview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="top" /> </LinearLayout> <LinearLayout android:id="@+id/layout2"

Categories : Android

Weighted interval scheduling with variable weights
Alright, I figured it out. The algorithm is (please correct me if I'm wrong): for t in times: if is_first(t): best_candidate = None else: best_candidate = best(t - 1) for interval in intervals if interval.end_time is t: value_i = f(best(interval.start_time) + interval) value_candidate = f(best_candidate) if value_i > value_candidate: best_candidate = best(interval.start_time) + interval best(t) = best_candidate return best(times[-1]) where the collections times, intervals are the potential time stops of the intervals and the intervals themselves and f is the objective function. The constant between iterations is: after the iteration over time t is finished, best(t) is the best schedule that ends with t. Note that

Categories : Algorithm

How to construct a jpeg from a list of grayscale weights
Something like this should get you going (not tested): old_image = Image.open("old.jpg") old_data = old_image.load() new_image = Image.new("RGB", old_image.size) new_data = new_image.load() width, height = old_image.size for x in range(width): for y in range(height): new_data[x, y] = old_data[x, y] new_image.save("new.jpg")

Categories : Python

Scikit-Learn Classification and Regression with Weights
To weigh individual samples, feed a sample_weight array to the estimator's fit method. This should be a 1-d array of length n_samples (i.e. the same dimension as y in most tasks): esimator.fit(X, y, sample_weight=some_array) Not all models support this, check the documentation.

Categories : Python

Obtain instance weights from AdaBoostM1 in Weka
No, Weka's AdaboostM1 does not have such feature. But you could inherit the AdaBoostM1 class, copy the AdaBoostM1#buildClassifierUsingResampling method from the source, and paste it in your subclass and manipulate the double[] weights variable (as seen in line 513).

Categories : Java

Multilayer perceptron implementation: weights go crazy
I do not believe that you should use sum of squares error function for binary classification. Instead you should use the cross entropy error function, which is basically a likelihood function. This way the error will get much more expensive the longer your prediction is from the correct answer. Please read the section about "Network Training" pp. 235 in "Pattern Recognition and Machine Learning" by Christopher Bishop, this will give you a proper overview on how to do supervised learning on a FFNN. The bias units are extremely important, thus they make it possible for the transfer funct. to shift along the x-curve. The weights will change the steepness of the transfer funct. curve. Note this difference between biases and weights, as it will give a good understanding on why they both need

Categories : Python

Algorithm for finding a spanning tree with weights of 1 and 2 only
Prim's algorithm computes a minimum spanning tree when edges have arbitrary weights. Prim's algorithm works by doing a sort of breadth-first search, starting from some arbitrary node, and keeping the edges in a priority queue. It keeps extracting the lowest-weight edge and either discarding it without expanding the search (if the edge leads to a node already in the tree) or adding it to the result, marking its opposite node as in the tree, and expanding the search. Done in the naive way I just explained, Prim's algorithm is dominated by the cost of enqueueing and dequeueing |E| edges into/outof the priority queue. Each enqueue/dequeue takes O(log |E|) time, so the total asymptotic cost is O(|E| log |E|) time or, more properly, O(|E| log |E| + |V|). If we had some way to do those enqueue

Categories : Algorithm

solr - Is it possible to set column weights in the schema (rather than in the query)
You can either define Index time boosts for the individual documents and fields. This might be a little faster but more difficult to debug the scores. However, it would be better to have a request handler defined with the fields and their respective boosts. Much more easy to customize and does not require re-indexing of the data as well.

Categories : Search

networkx: generate JSON tree with weights
The question needs some specificity, but here is an effort at constructing some dummy data with tuples for nodes, extracting an arbitrary path, and dumping to a JSON format. Set up some Dummy Data from random import seed, random, shuffle seed(11405) u = [('a','b','c'), ('d','e','f'), ('g','h','i'), ('j','k','l'), ('m','n','o'), ('p','q','r'), ('s','t','u'), ('v','w','x'), ('y','z','a')] shuffle(u) v = [('a','b','c'), ('d','e','f'), ('g','h','i'), ('j','k','l'), ('m','n','o'), ('p','q','r'), ('s','t','u'), ('v','w','x'), ('y','z','a')] shuffle(v) edges = [ (s,t, {'weight': random()}) for s,t in zip(u,v) if s != t] Create the Graph import networkx as nx from networkx.readwrite import json_graph G = nx.DiGraph() G.add_edges_from(edges) # Extract a Path between

Categories : Python

Text search with weights for individual keywords
Solr allows you to do this. Your query would look like this q=(Johnson)^10 (Software)^5 (Company)^2 Note that the default operator (AND or OR) defined in your schema.xml comes into play here.

Categories : Postgresql

ODP.NET 32 bit on Win 7 64 bit and Win Server 2003 64 bit
IMO There are a few options: Compile for x86 and install the 32 bit Oracle Client on your 64bit server (could run side by side if you change the ORACLE_HOME, TNS_ADMIN, ... system variables); Compile for x86 and pack all DLL's for a 32 bit Oracle Instant Client together with your binaries (make sure the TNS_ADMIN system variable is set otherwise you won't be able to use LDAP or tnsnames); Compile your application for Any CPU but create a different set of dll's for x64 and x86 bit (Oracle.DataAcess.dll is compiled for a specific architecture, there is a version for x64 and one for x86); Oracle is working on a managed Oracle driver, no Oracle client is required anymore, most codebases can converted easily but be aware that it's not feature complete yet and only supports Oracle 11+ database

Categories : C#

How to construct moving time average with different weights for different months?
A weighted average is defined as sum(x .* weights) / sum(weights). If you want to calculate this in a moving average kind of way, I guess you could do (untested): moving_sum = @(n, x) filter(ones(1,n), 1, x); moving_weighted_avg = moving_sum(12, temperature .* days_per_month) ... ./ moving_sum(12, days_per_month); If temperature is a vector of monthly temperatures and days_per_month contains the actual number of days of the corresponding months, this should even work in case of leap years. Edit to answer comment You can reconstruct days_per_month like so: start_year = 2003; start_month = 10; nmonth = 130; month_offset = 0:nmonth - 1; month = mod(start_month + month_offset - 1, 12) + 1; year = start_year + floor((start_month + month_offset - 1) / 12); days_in_month = eomday(year,

Categories : Matlab

Using weights for repeated cases in R (and specifically gam for binary response)
Weights for a binomial response have a natural interpretation: the number of trials corresponding to each observation. If you have n trials of which p are successes, you fit this with glm(p/n ~ x, family=binomial, weights=n) The same works with gam in both the gam and mgcv packages.

Categories : R

scrollable linearlayout with weights bigger than screen in android
The problem here is your use of layout_weight and weightSum is invalid. It's important to remember that android:layout_weight can only use the remaining space available in the view; anything exceeding that boundary is automatically cropped. Therefore, in your example, your first EditText is taking up the entirety of the screen, and your second one is entirely excluded from the view. Because the second EditText is cropped, the LinearLayout has taken the entire screen and there's nothing for the ScrollView to do. I'm not entirely sure what your end goal is; are you trying to have text inputs that grow with user entry, and the ScrollView handles the overflow? If so, this will work: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_p

Categories : Android

How to create a regular, resizable grid without nested weights?
You will need a custom compound control. Check the following link: http://developer.android.com/guide/topics/ui/custom-components.html#compound Make the control fill the available space. Make it to have 12 buttons. Calculate the size and position of them based on their position and the available space. Depending on your needs you might also need to override onMeasure() and onLayout() defined earlier in the above document, in the "Fully Customized Components" section.

Categories : Android

if edge weights uniformly distributed between 0 and 1 prims or kruskals
This is something you have to benchmark. You can use fancy data structures (van Emde Boas trees) and sorting algorithms (some counting sort variant) to drop the theoretical expected complexity of both algorithms to something closer to linear. However, it's unclear that any such trick can improve the practical performance of either algorithm. Shenanigans for improving memory locality will probably make a bigger difference.

Categories : Algorithm

Classification Algorithm which can take predefined weights for attributes as input
Why not just use the weights as the features, instead of binary presence indicator? You can code the lack of presence as a 0 on the continuous scale. EDIT: The classifier you choose to use will learn optimal weights on the features in training to separate the classes... thus I don't believe there's any better you can do if you do not have access to test weights. Essentially a linear classifier is learning a rule of the form: c_i = sgn(w . x_i) You're saying you have access to weights, but without an example of what the data look like, and an explanation of where the weights come from, I'd have to say I don't see how you'd use them (or even why you'd want to---is standard classification with binary features not working well enough?)

Categories : Machine Learning

Connect to Sharepoint 2003 in C# WPF
There are 2 ways: a. Using Sharepoint web services Suppose your sharepoint server URL is as follows https://MyDomain/MySite/default.aspx Then replace default.aspx with /_vti_bin/lists.asmx to get list of web services expose by sharepoint. https://MyDomain/MySite/_vti_bin/lists.asmx This will provide you with list of all operations exposed by service. You can use GetList to get calendar list and check if you get desired result. b. Uisng Sharepoint object model and Microsoft.Sharepoint.dll (WPF application can run on same server where sharepoint is installed)

Categories : C#

IFERROR in Excel 2003
The Excel 2003 equivalent of =IFERROR(A1,"") is =IF(ISERROR(A1),""). See =IS. But neither version of that formula is very useful. A little more useful would be something like =IF(ISERROR(A1),0) where an error in A1, perhaps resulting from dividing by zero, is elsewhere (ie in the cell with the formula) displayed as 0. The trouble with the single comma is that if ISERROR() is false (ie A1 is not an error) this returns FALSE - not particularly helpful but relatively confusing! So these formulae are normally used with another formula instead of A1. That is, one formula is wrapped around another. The later Excel version might have =IFERROR(A1/B1,""). Thus, if A1 contained 1 and B1 2, the result would be 0.5 whereas if A1 then were changed to become #REF! the result would be blank (nothing

Categories : Excel

How to use InStr function in VBA 2003?
Start index of InStr function is 1-based => 0 is invalid value. See Exceptions section of http://msdn.microsoft.com/en-us/library/8460tsh1%28v=vs.80%29.aspx

Categories : Excel

What is the Best way to see a dataset contents in Vs 2003 IDE
Grab the XML Visualizer 1.0 for Visual Studio 2003 from Google Drive while it's still there. Maybe someone else will also find this link useful in the future.

Categories : C#

Apply Dijkstra's algorithm in a undirected graph with negative weights
Seed the traversal list with source node A, and it's cost with 0. Add an infinite cost for every other node: {}, [A=0, B=inf, C=inf, D=inf, E=inf, F=inf] Then take the lowest current cost item (I'll call it L) and "accept" it into the final cost set (the first pass case has L=source node (A), with a cost of 0). Check each edge from L calculating the total cost to follow that edge. If that total cost is less than the traversal list current cost, update the traversal list with the new lower cost. {A=0}, [B=0+3, C=0+2, D=0+4, E=inf, F=inf] C is now the lowest cost node in the traversal list, so accept C with a cost of 2: {A=0, C=2}, [B=2-2=0, D=4, E=2+5=7, F=inf] It's really easy to detect the problem at this point because I just put a cost in the traversal list that is less less

Categories : Algorithm

Visualize weighted graph (with weights as distances between vertices) in 2D space
In general, the answer is no, you cannot plot a general graph in 2d while precisely preserving distances. The reason is that in order to be able to embed a graph without distortion of distances, the distances must have very special properties. For example, they must fulfill the triangle inequality, amongst other things. To see this, consider a graph with 3 vertices A,B,C and distances d(A,B)=1 d(B,C)=2 d(A,C)=5. You can easily see that this will not work. In fact, you won't be able to embed this in ANY Euclidean space, regardless of the dimension! What you can do is the following: Try to reduce the dimensionality (embed the graph in a 2d space) by using an algorithm like PCA. PCA is widely used and you can easily find implementations in any programming language you prefer. It will give

Categories : Python



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