w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to get the Intersection of Multiple sets but Ignore Sets that Don't Intersect
You'll want something like this: var results = from x in X from y in Y where x == y || X.All(item => !Y.Contain(item)) select x; The basic idea is: include the intersection if any intersection exists OR all items if no intersection exists.

Categories : SQL

Find all crtical node sets in a graph
What you are trying to find is graph partitioning. It is a NP Hard problem. See this for more understanding of graph partitioning. there are Nearly-Linear Time Algorithms for Graph Partitioning available if you google for it.

Categories : Algorithm

(Set of) List of sets (Cartesian product(s)) from graph corresponding to set of lists
If I understand your question correctly, you're after (A) and only want (C) as an intermediate step. Generate the shortest paths through the graph using e.g. Dijkstra's algorithm - this will generate the set of lists (A). If you still need the Cartesian product at this point (i.e. if you weren't just generating the Cartesian product as an intermediate step to generating (A)) then it's much easier to generate it from (A) than from (B).

Categories : Algorithm

How to use boost::graph algorithms with listS, setS as vertex/edge containers?
The error message tells that you need to provide a vertex_index map; see the same problem answered here. Various ways to add the vertex_index map to adjacency_list are discussed here; in fact their problem is almost identical to yours.

Categories : C++

Exporting Data From Multiple DataGridViews on a Form to Multiple Excel Sheets in a Single Excel File
Maybe you need to add more sheets before you can access Sheet at index 2 int count = workbook.Worksheets.Count; Excel.Worksheet addedSheet = workbook.Worksheets.Add(Type.Missing, workbook.Worksheets[count], Type.Missing, Type.Missing);

Categories : C#

Excel copy-paste to SQL Server sets BIT type to null
Apparently the BIT values need to be True and False to parse correctly: http://connect.microsoft.com/SQLServer/feedback/details/330293/1-and-0-not-recognised-as-boolean It does seem not very consistent or user friendly that the values display as 1 / 0 but will only parse from True / False.

Categories : Excel

Excel VBA Outlook / Mail functions requires recalculation or sets all formulas to #Value
If you're using RangeToHTML from Ron de Bruin's website, that's what's causing your problem. That utility is fine if you need perfect fidelity and have a heavily formatted bu otherwise fairly simple range. But if your range has a bunch of dependencies, you'll have problems. It's putting the range into its own workbook, so any formulas that refer to data outside the range get funky. If you need perfect fidelity, then you're stuck because the only way it will be perfect is by saving the range as HTML and reading that back. But if you don't have a bunch of heavy formatting or you just need a nice looking table, then I suggest you write your own RangeToHTML function that produces the HTML strings. David McRitchie has some functions that do a pretty good job if you don't want to roll your own

Categories : Performance

Get data from an excel chart/graph
Just follow the following steps: Step1: Copy following code into a VBA module: Sub GetChartValues() Dim NumberOfRows As Integer Dim X As Object Dim Counter as Integer Counter = 2 ' Calculate the number of rows of data. NumberOfRows = UBound(ActiveChart.SeriesCollection(1).Values) Worksheets("ChartData").Cells(1, 1) = "X Values" ' Write x-axis values to worksheet. With Worksheets("ChartData") .Range(.Cells(2, 1), _ .Cells(NumberOfRows + 1, 1)) = _ Application.Transpose(ActiveChart.SeriesCollection(1).XValues) End With ' Loop through all series in the chart and write their values to ' the worksheet. For Each X In ActiveChart.SeriesCollection Worksheets("ChartData").Cells(1, Counter) = X.Name With Worksheets("ChartData") .Range(.Cells(2,

Categories : Excel

Excel VBA - Graph Update Loop
You should avoid activating/selecting where you can. Untested: Sub Tester() Dim i As Integer Dim sht As Worksheet For i = 31 To ActiveWorkbook.Worksheets.Count Set sht = ActiveWorkbook.Sheets(i) With sht.ChartObjects("Chart 2").Chart.SeriesCollection(1) .Values = sht.Range("$DL$5:$IU$5") .XValues = sht.Range("$DL$3:$IU$3") End With With sht.ChartObjects("Chart 6").Chart .SeriesCollection(1).Values = sht.Range("$DL$14:$IU$14") .SeriesCollection(2).Values = sht.Range("$DL$15:$IU$15") .SeriesCollection(3).Values = sht.Range("$DL$16:$IU$16") .SeriesCollection(3).XValues = sht.Range("$DL$3:$IU$3") End With With sht.ChartObjects("Chart 1").Chart.SeriesCollection(1).P

Categories : Excel

Ignore cells on Excel line graph
if the data is the result of a formula, then it will never be empty (even if you set it to ""), as having a formula is not the same as an empty cell There are 2 methods, depending on how static the data is. The easiest fix is to clear the cells that return empty strings, but that means you will have to fix things if data changes the other fix involves a little editing of the formula, so instead of setting it equal to "", you set it equal to NA(). For example, if you have =IF(A1=0,"",B1/A1), you would change that to =IF(A1=0,NA(),B1/A1). This will create the gaps you desire, and will also reflect updates to the data so you don't have to keep fixing it every time

Categories : Excel

Excel - Display certain information when interacting with a graph
Yes it is possible using Chart Events. Events are enabled for chart sheets by default, but for an embedded chart you can study this Microsoft article. The same page includes this link for Chart Object Events. This requires programming using Excel VBA.

Categories : Excel

SQL: How to refer to multiple data sets with only one id?
The situation you describe is best solved with a foreign key between the Order and OrderItems table that uses the ORDER_ID column. There is no way to use the ORDER_ID as the primary key for each ORDER_ITEM since the key would not be unique. DDL create table `order`( order_id int NOT NULL, customer_name varchar(50), primary key(order_id) ); create table order_item( order_item_id int NOT NULL, order_id int, item_name varchar(50), primary key(order_item_id), foreign key(order_id) references `order`(order_id) ); Once you have this DDL setup you can easily reference an order using one key by joining the two tables. select * from `order` o join order_item oi on o.order_id = oi.order_id where o.order_id = 5;

Categories : Mysql

How to get rid of multiple sets of parentheses in an array
Try like.. Access the Objectforkey of Parameter Value and store into a dicitonary and then access the objectforkey of Smith and store the value into a string. NSError *e = nil; NSMutableArray *JSON = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutableContainers error: &e]; NSDictionary *value = [JSON objectforkey:@"parameter_value"]; You will get the expected values.

Categories : IOS

SQLite selecting multiple sets of rows
Please learn Aggregate function for SQL Lite select max(RowID) as RowID,User,Event from Table1 group by User order by max(RowID) SQL FIDDLE

Categories : SQL

nonlinear regression in R with multiple data sets
If you want identical parameters, you should just pool your data: df2 <- data.frame(Y=c(df$B,df$C), X=rep(df$A, 2)) p <- nls(Y ~ k1/X + k2, data = df2, start = list(k1=10, k2=10), lower = c(0, 0), algorithm = "port") summary(p) # Formula: Y ~ k1/X + k2 # # Parameters: # Estimate Std. Error t value Pr(>|t|) # k1 124.819 18.078 6.904 0.000124 *** # k2 1.199 9.781 0.123 0.905439 # --- # Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # # Residual standard error: 16.59 on 8 degrees of freedom # # Algorithm "port", convergence message: both X-convergence and relative convergence (5) Edit: If you want one parameter to be equal and one to vary, you could use a mix

Categories : R

Using multiple alternatives of hashCode() and equals() for sets
You can get that effect by using a TreeSet when providing a custom Comparator that only inspects the fields you're interested in. Note, however, that strictly speaking such a TreeSet no longer is a "correct" Set because it effectively ignores the equal() method of your objects: Note that the ordering maintained by a set (whether or not an explicit comparator is provided) must be consistent with equals if it is to correctly implement the Set interface. (See Comparable or Comparator for a precise definition of consistent with equals.) This is so because the Set interface is defined in terms of the equals operation, but a TreeSet instance performs all element comparisons using its compareTo (or compare) method, so two elements that are deemed equal by this method are, from the standpoint

Categories : Java

Multiple result sets excluding column
Need to clean up the query and your thought process If you want to debug dEndDate then include it in the output All values where dEndDate is null and dEndDate <= GETDATE() is always false. A value cannot be null and have a value. In the default configuration a comparison to null is always false. null <= 1/1/2000 is false null >= 1/1/2000 is false null = null is false If you want null OR dEndDate <= GETDATE() then: where dEndDate is null or dEndDate <= GETDATE() Why would you expect this not to return one row? dEndDate <= GETDATE()

Categories : Sql Server

TAdoDataSet, TAdoStoredProc multiple result sets
It is an inherent limitation to server side cursors. As stated in following MSDN link: Server cursors cannot be used with statements that generate more than one recordset. This restriction applies to all statements described in Generating Multiple Recordsets. For more information, see Generating Multiple Recordsets. If a server cursor is used with any statement that generates multiple recordsets, an application can return one of the following errors: Cannot open a cursor on a stored procedure that has anything other than a single SELECT statement in it. sp_cursoropen. The statement parameter can only be a single SELECT statement or stored procedure.

Categories : Sql Server

How to search through multiple sets with one linq statement
You can use SelectMany to flatten list of list, add collectionA and collectionA to listOfLists first: listOfLists.AddRange(new[] {collectionA, collectionB}); if (listOfLists.SelectMany(x => x).Any(y => y == "Item5")) { } With you new edit which does not prefer to change the existing collections, nor create the new one, you can do: if (listOfLists.Any(x => x.Any(y => y == "Item5")) || collectionA.Any(x => x == "Item5") || collectionB.Any(x => x == "Item5")) { }

Categories : C#

Plot multiple moving average on multiple data-set in one graph
First problem - in the zoo() function time and A should be placed in opposite order. temp.zoo<-zoo(df$A,df$time) temp2.zoo<-zoo(df$B,df$time) Next, for rollmean() function you should add argument fill=list(NA,NULL,NA) to fill start and end with NA values to get the same length vector as original data. m.av<-rollmean(temp.zoo,10,fill=list(NA,NULL,NA)) df$A.av=coredata(m.av) m2.av<-rollmean(temp2.zoo,10,fill=list(NA,NULL,NA)) df$B.av=coredata(m2.av) Now you can melt the original data frame before plotting. So for plotting you will need only one geom_line() call. df.long<-melt(df, id.vars="time") ggplot(data=df.long, aes(time,value,color=variable))+geom_line()

Categories : R

How to represent a group of C++ dynamically allocated objects as a BGL (Boost Graph Library) graph in order to obtain their dependency graph?
The integers are indices to the vertices and edges of the graph. So, in your example, the first vertex is a and the second vertex is b while the first edge connects vertices 1 and 2 ( a and b ) Each vertex has properties. So, in your example, the first vertex is named a and has a pointer to a. The graph algorithms use the integer indices to manipulate the graph, and your code can use the indices to get back to the properties that you are interested in, such as names and pointers. Here is how I would code the example you posted: /** Bundled properties for graph vertices Simply contains a pointer to the associated MyObject */ class cVertex { public: MyObject * pObject; }; class cEdge { }; class cGraphProps { }; .... // The BGL graph typedef boost::adjacency_list <

Categories : C++

Generate graph automatically based on a set of data table in excel using VBA
I don't think you need a macro. All you need is some dynamic named ranges: Microsoft Support And set your data range to those named ranges.

Categories : Arrays

Excel Macro Graph Removing Blank Legend Keys
Here you have a corrected version of your sub: Sub FixPlott(PlotName As String) Dim n As Long With ActiveSheet.Shapes(PlotName).Chart For n = .SeriesCollection.Count To 1 Step -1 With .SeriesCollection(n) If .Name = "" Then ActiveSheet.Shapes(PlotName).Chart.Legend.LegendEntries(n).Delete End If End With Next n End With End Sub I am not sure about the exact trigger you want to use. So I have included a simple string trigger; if the given SeriesCollection is called like trigger, the legend will be deleted.

Categories : Excel

SQLite - multiple random result sets with unions
Actually I think I've solved this now. I don't actually know how this site works but I've done it by doing something like this: select * from ( select colA, colB, colC from tableA order by random() limit 10 ) union all select * from ( select colA, colB, colC from tableB order by random() limit 10 )

Categories : SQL

Validating Multiple sets of POST data in Cakephp
Figured out how to do it on my own... in /app/Model i created 'ShippingAddress.php' and 'BillingAddress.php', Both Extend "Address" //ShippingAddress.php <?php App::uses('Address', 'Model'); class ShippingAddress extends Address { } //BillingAddress.php <?php App::uses('Address', 'Model'); class BillingAddress extends Address { } To prevent the new models from using tables named after them, we edit the parent Address.php and set $useTable so that both extended models use Addresses Table //Address.php ... public $useTable = 'addresses'; ... then its just a matter of inserting the two instances of the input fields into the view... no renaming models, no modifying validationErrors, it just works :)

Categories : Cakephp

Is it possible to iterate multiple data sets async BeginExecuteReader?
You are mixing concepts. A procedure returning multiple results is not related in any way to MARS. A procedure returning multiple results can be invoked asynchronously, note that your async call will complete as soon as the first fragment of the result has returned from the server and from there on you read the results just like in the sync code.

Categories : C#

How do I replace a multiple sets of characters with a single character
you can try this. R+ will replace one or more R String str = "i want hello RRRRRRRRRRRR My name RRR is RRRRRRRR arvind RR"; System.out.println(str.replaceAll("R+","A"));

Categories : Java

What is the best way to show multiple sets information with the same layout in android
The way to display multiple product is to use list view. There are various forms of list view available, you can use expandable listview or can also use simple listview and follow master-detail format. Even play store also uses listview to display their apps(products). If you are trying to load large amount of data then you can use lazy loading technique along with caching.

Categories : Android

Reading excel data from multiple related excel sheets and dumping in java classes
You can use a combination of getSheetIndex(name) and getSheetAt(index) using the HSSFWorkbook class http://poi.apache.org/apidocs/index.html

Categories : Java

Excel 2010 VBA Copy Data from Multiple Excel Files
You could try wrapping all this in a DO...LOOP. If you don't know how many .csv files you'll be working with, just put in an error handler to quit once no more files are found. You can use string concatenation to make the filenames change: for example, using a variable called filenum, if filenum = 1 then filenum & ".csv" would be "1.csv," if filenum = 2 then filenum & ".csv" would be "2.csv," etc. For example: Public Sub testr() Dim filenum As Integer filenum = 1 On Error GoTo my_handler Do Windows(filenum & ".CSV").Activate 'rest of code goes here filenum = filenum + 1 Loop my_handler: MsgBox "All done." Exit Sub

Categories : Excel

Want to copy first row of each sheet of multiple Excel files to another Excel file
Here is few things you might need; Dim wb As Workbook Dim rowCopy As Range For Each sFilename In listOfFiles Set wb = Workbooks.Open(sFilename) Set rowCopy = wb.Range([rangewheretocopy]) rowCopy.Copy shWhereYouCopyItAll.Range([targetrange]).PasteSpecial Next Assuming hypothetical list of files listOfFiles which you can foreach for string sFilename in order to open the Workbooks. Then set Range object rowCopy to the range where that one row is, then call your local sheet Range PasteSpecial function. You might need to learn more and above piece of code will not do the work youre asking for. I am expecting you to put some effort into programming this aswell.

Categories : Excel

How to plot a graph in excel work sheet using c++ in windows mobile platform?
You can not automate excel on windows mobile cause it does not expose an excel obejct as on desktop PC. There are alternative third party tools. Why use excel? Such imple graph can be created with simple drawing commands or in javascript on a web page.

Categories : C++

Is it better to use multiple databases when you are managing independent sets of things in MongoDB?
I am making plenty of assumptions about your needs. But, generally, there are 3 paths to multi-tenant apps in MongoDB: Single collection per customer; never, ever do this. Single database per customer. Good. You will trade off free space if your product is on the freemium model. Either way, you will want to run with "smallfiles" option. As stated, you will build the routing system for your environment. Thus, you will want to connect to the proper database for the proper customer. customer_id key per document + path slug. Good. The trade off here is recovery of free space. Traditionally, MongoDB does not recover space used by deleted documents. Thus customers creating and deleting blog posts would create unused space. By using 'usePowerOf2Sizes' collections, you will recover d

Categories : Mongodb

how to convert multiple mysql result sets into json array
try this $query = "SELECT post_title, guid FROM testwp_posts WHERE post_author = $user_id AND post_status = 'publish' ORDER BY ID DESC LIMIT $number_of_posts"; $result = mysql_query($query) or die('Errant query: '.$query); /* create one master array of the records */ $posts = array(); if(mysql_num_rows($result)) { while($post = mysql_fetch_assoc($result)) { $posts[] = array('post'=>$post); } } header('Content-type: application/json'); echo json_encode(array('posts'=>$posts));

Categories : PHP

I want to egrep regular expression for multiple sets of numbers without union
try a regex like d[-0-9]+ a dash or 0-9 one or more times Edit or if it must start and end with a number (or have just one digit d[-0-9]*d|d Edit or it is always three digits d{3}|d-d{2}|d{2}-d

Categories : Regex

MVC - How to submit two sets of multiple check boxes to controller action?
To do this, you have to render a collection. I will assume you have two collections in your model, one called Courses, and one called Tracks. @for(int i = 0; i < collection.Count(); i++ { // Boolean property indicating value is selected on your Courses view model submodel Html.CheckBoxFor(model => model.Courses[i].CourseSelected); Html.Raw(Model.Courses[i].CourseName); } Then do the same for your Tracks. EDIT; Assuming you have a ViewModel with a List<Course> where Course looks like this: public class Course { public bool CourseSelected {get;set;} public string CourseName {get;set;} } You will have to lookup the course based on the index of the checkbox collection. Thus, if Course[0] is set, you need to get the first course based on position. Y

Categories : HTML

Condition give the effect of having multiple wait-sets per object?
For a bounded DataStructure for example, you can have the Conditions "notEmpty" and "notFull" and wait for them. Just one example. Have a look at the example here.

Categories : Java

using multiple sets of radio buttons, how can I unhide and hide images
If your radio boxes have the same name attribute they will behave as radio buttons i.e only one selection can be active in the group, but if each button have their own name they can all be selected. So if u have a collection of radios like this: <form> <input type="radio" name="1"> <input type="radio" name="2"> <input type="radio" name="3"> </form> U can get them to behave like check boxes with a lil javascript: // This will allow the radio boxes to toggle on of. $("input[type=radio]").click(function(){ $(this).attr("checked", !$(this).attr("checked")); }); Edit: I did a js fiddler with a working example, maybe it will give some answers. http://jsfiddle.net/uPp82/1/

Categories : Javascript

Symfony2 Doctrine Raw SQL Stored Procedure Loop through multiple result sets
You can try and itterate over each set 1 by one. But really fetchAll should do the same as below, cant hurt to try though... $em = $this->get('doctrine')->getManager(); $stmt = $em ->getConnection() ->prepare('EXEC someSP :id,null,:uid'); $stmt->bindValue('id', '629674'); $stmt->bindValue('uid', '217'); $stmt->execute(); do{ $results[] = $stmt->fetchAll() } while($stmt->nextRowset());

Categories : Symfony2

Zend Framework 2 - Form Validation from multiple input filters sets?
Fieldsets (Form Collections) are what you are looking for. Official documentation is here: https://zf2.readthedocs.org/en/latest/modules/zend.form.collections.html

Categories : PHP



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