w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
After new partition gets created insert partition info in another table through trigger
You can do it with DDL Trigers. Check out this link One important note from the author you should consider adding a partition is not DDL if Oracle decides to do it internally, it’s only DDL if it’s an end-user statement Implicit partition creation is a new feature of 11g and it reffers to the interval partition option.

Categories : Oracle

Hoare partition : is this implementation more/less efficient than the standard partition algorithm?
I always prefer the standard Hoare's implementation. If you look at it, it is not very intuitive, but it has a visible advantage: Less number of swaps. While your implementation effectively always does exactly N comparisons and N swaps, the Hoare's implementation does only N comparisons, but it does not swap anything if it is not needed. The difference is significant in some scenarios. At first in a case you use environment where swaps or assignment of variables/objects is a costy operation. For example if you use C/C++ with arrays of objects. Another typical examples where Hoare's partition implementation performs better if when many of the items in your array are of the same value or when the array is almost sorted and needs just to swap a few items. In that cases Hoare's version perfor

Categories : Matlab

MySQL table Partition with FLOOR function (partition function not allowed)?
MySQL documents the partitioning functions here. The floor() function appears to have some special considerations. In this case, I think the issue might be that the division is returning a float/double result rather than a decimal result. This is easily fixed in your case because you do not need to do the division: CREATE TABLE `fact_events` ( `event_key` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `event_type_key` tinyint(3) unsigned NOT NULL, `analytic_file_id` bigint(20) unsigned NOT NULL, `sdk_session_id` bigint(20) unsigned NOT NULL, `virtual_button_create_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`event_key`), KEY `idx_events_event_type` (`event_type_key`) ) PARTITION BY RANGE(event_key) ( PARTITION p0 VALUES LESS THAN (0), PARTITION

Categories : Mysql

How to Rename fileName using Win32_ShortcutFile - WMI schema method rename and Jacob
Finally I got it.... :) Minor mistake while renaming the file, it should be as shown below: String newName = "D:\jacobtest.docx"; if (file.equals("filename")) { os = new ActiveXComponent((en.nextElement).getDispatch()); os.invoke("Rename", newName); }

Categories : Java

SUM OVER PARTITION BY
remove partition by and add group by clause, SELECT BrandId ,SUM(ICount) totalSum FROM Table WHERE DateId = 20130618 GROUP BY BrandId

Categories : SQL

How should I partition this table?
I suggest Sharding the database. More information can be found here importance of sharding and approaches towards MySQL sharding. Hope this helps.

Categories : Mysql

Only get the partition label
As far as I know, Get-PSDrive doesn't know the difference betwee network and local drive. You can use Get-WMIObject Win32_LogicalDisk, which supports filtering drives by type. Filtering example: Get-WmiObject Win32_LogicalDisk | select-object DeviceID, DriveType, @{Name="Type";Expression={[IO.DriveType]$_.DriveType}} | ? {$_.Type -eq 'Fixed'} or Get-WmiObject Win32_LogicalDisk | ? {$_.DriveType -eq 3}

Categories : Powershell

how do I give partition in the
Here is mark-up for the layout you describe (without all the style - just the layout)... <ul class="menu"> <li><a href="/home">Home</a></li> <li><a href="/about">About</a></li> <li><a href="/songs">Songlist</a></li> </ul> And the CSS ul.menu { margin: 0; padding: 0; text-align: center; } ul.menu li { display: inline-block; width: 33%; } ul.menu a { display: block; width: 100%; padding: 0.2em 0; }

Categories : HTML

Why only one active partition in MBR
Wikipedia has a nice article on MBR with a lot of useful links. "Only one active partition" seems to be a design choice from the early IBM/DOS bootloader, and has remained that way since. Basically they defined multiple active partitions as an error, and checked for this error at boot. It kind of makes sense because you can only boot one operating system at a time anyway, and a forced single active partition will prevent ambiguity. If I recall correctly LILO and possibly GRUB (linux bootloaders) don't mind if there are multiple active partitions, so I think this is a DOS/Windows issue mostly. As for your questions. An "active" partition only means that the first byte is different from an "inactive" partition. There's no advantage or disadvantage, it's just a flag. Partition information

Categories : Misc

Array Partition with pointer
A pointer to a pointer is not the same as an array of arrays. You can however use a pointer to an array instead: const char (*pointer)[20]; You of course need to update the printGrid function to match the type. As for the reason why a pointer-to-pointer and an array-of-array (also often called a matrix) see e.g. this old answer of mine that shows the memory layout of the two.

Categories : C++

SQL "over" partition WHERE date between two values
row_number() operates after where. You'll always get a row 1. For example: declare @t table (id int) insert @t values (3), (1), (4) select row_number() over (order by id) from @t where id > 1 This prints: 1 2

Categories : SQL

Partition an array with this algorithm
Say you start with an array a with length l. Then you should create two arrays lesser and greater with l-1 length (since all values could be smaller or larger than the pivot). double[] lesser = new double[a.length() - 1]; double[] greater = new double[a.length() - 1]; After that, it is simply (as in your exercise) copying the data to these arrays. Keep track of the length of both arrays like lesserlength = 0; greaterlength = 0; and incrementing that each time you insert a value. That way you know where you can insert the next value in lesser and greater. Eventually you can copy lesser into a new array of length l. double[] result = new int[a.length()]; You know that lesserlength + 1 + greaterlength == a.length() You can use System.arraycopy(source, srcpos, dest, dstpos, len) to

Categories : Java

Find partition size using df and awk
You can use sed instead of awk again: df -h | grep "/partition" | awk '{print $3}' | sed -e 's,[A-Z]$,,' Keep in mind that this (and your one-liner) does not print the size of the partition, but the size used.

Categories : Linux

Assigning a letter to OEM Partition
Partitions are storage units used to divide physical disks into smaller, independent parts. Basically they're containers for filesystems. Volumes are storage units with a filesystem. A volume can be inside a partition, but it's also possible for a volume to span multiple partitions. As for assigning a drive letter to that particular partition: you need to determine the type of the filesystem inside that partition first. GParted might prove helpful there. Windows can only mount FAT(32) and NTFS volumes. For other filesystems (like Ext2/3/4 or XFS) you're going to need 3rd party tools.

Categories : Powershell

Cassandra: choosing a Partition Key
Indexing in the documentation you wrote up refers to secondary indexes. In cassandra there is a difference between the primary and secondary indexes. For a secondary index it would indeed be bad to have very unique values, however for the components in a primary key this depends on what component we are focusing on. In the primary key we have these components: PRIMARY KEY(partitioning key, clustering key_1 ... clustering key_n) The partitioning key is used to distribute data across different nodes, and if you want your nodes to be balanced (i.e. well distributed data across each node) then you want your partitioning key to be as random as possible. That is why the example you have uses UUIDs. The clustering key is used for ordering so that querying columns with a particular clusteri

Categories : Cassandra

SQL Server Switch more than one Partition at once
Not that I'm aware of. What I'd typically do is place the switch inside the loop. Something like this: DECLARE @Partitions TABLE (PartitionId int PRIMARY KEY CLUSTERED); DECLARE @PartitionId INT; INSERT @Partitions(PartitionId) SELECT prv.boundary_id PartitionId FROM sys.partition_functions AS pf INNER JOIN sys.partition_range_values prv ON prv.function_id=pf.function_id WHERE (pf.name=N'PartitionFunctionName'); WHILE EXISTS (SELECT NULL FROM @Partitions) BEGIN SELECT TOP 1 @PartitionId = PartitionId FROM @Partitions; ALTER TABLE MS_PROD SWITCH PARTITION @PartitionId TO MS_Stage PARTITION @PartitionId; RAISERROR('Switched PartitionId %d to Stage',0,1,@PartitionId) WITH NOWAIT; DELETE @Partitions WHERE PartitionId = @Parti

Categories : Sql Server

Add sub partition on another column in oracle
No alter query for adding subpartitions as far as i know. To get the desired result performe the folowing steps Create the table in the structure you want using create as select with the partitions and the sub partitions. switch the names of the two tables. you can also explore the use of dbms_Redefinition but if you have a luxury of a littel downtime it's not worth it.

Categories : Oracle

using different storage engines per partition
I would suggest having two separate tables, one for your archives and one for your working set. I don't think MySQL views are smart enough to optimize this. It would also give you complete control over the schema but puts the burden on your application.

Categories : Mysql

Pig Latin Partition By clause
What is the use of "Partition By" clause in Pig Latin? This allows you to set the Partitioner of your choice. Pig uses the default one i'e HashPartitioner except for order and skew join. But sometimes you might wanna have your own implementation to enhance the performance. Partition By helps there. Also please provide an example usage. DATA = LOAD '/inputs/demo.txt' using PigStorage(' ') as (no:int, name:chararray); PARTITIONED = GROUP DATA by name PARTITION BY org.apache.pig.test.utils.SimpleCustomPartitioner parallel 2; Does it allow only custom partition or allows partition by column? It is just to specify custom partitioners and not to partition directly based on some field. See PIG-282 for more details.

Categories : Hadoop

Parallelizing std::nth_element and std::partition
Cuda THRUST has partition function implemented (http://docs.nvidia.com/cuda/thrust/index.html#reordering). The main idea should be following: Using prefix sums to calculate position of element it the array and then rearrange the array.

Categories : C++

Inconsistent SUM when using OVER PARTITION in MSSQL
For floating point arithmetic the order that numbers are added in can affect the result. But in this case you are using Decimal(12,2) which is precise. The issue is that with duplicate values for nGroup, nUser, dTransaction the ROW_NUMBER is not deterministic so different runs can return different results. To get deterministic behaviour you can add guaranteed unique column(s) into the end of the ORDER BY to act as a tie breaker.

Categories : Sql Server

PARTITION BY doesn't work in H2 db
I don't think H2 supports window functions (aka analytic functions). However, you can do the query in the link using standard SQL: SELECT t.* FROM yourtable t join (select vendorname, max(incidentdate) as maxdate from yourtable yt group by vendorname ) vn on vn.vendorname = yt.vendorname ORDER BY vn.maxDate DESC, t.VendorName ASC, t.IncidentDate DESC; Although this should run in both environments, the over form probably performs better in SQL.

Categories : Oracle

Partition by consecutive values
You need to group rows by sets of operation. One method is to use a running total that increases when it reaches a new "set", as in: SQL> SELECT mat, op, dt, 2 SUM(change_set) over (PARTITION BY mat ORDER BY dt) set_group 3 FROM (SELECT mat, op, dt, 4 CASE WHEN op != lag(op) over (PARTITION BY mat 5 ORDER BY dt) 6 THEN 1 7 END change_set 8 FROM DATA); MAT OP DT SET_GROUP ----- ---------- ----------- ---------- M1004 100 25/08/2013 M1004 100 25/08/2013 M1004 100 29/08/2013 M1004 600 29/08/2013 1 M1004 600 30/08/2013 1 M1004 600 30/08/2013 1 M1004

Categories : SQL

Partition using Lead in Oracle
As one of the approaches, we can do the following: with cte(key, book, prd_key, direction, trdtime, price, grp) as( select t.* , dense_rank() over(order by t.trdtime desc) from trd t ) select q.key , q.book , q.prd_key , q.direction , q.trdtime , q.price , grp , (select max(c.price) from cte c where q.direction <> c.direction and c.grp = (select min(grp) from cte l where l.direction <> q.direction and l.grp > q.grp ) ) as next_price from cte q Result: Key Book Prd_Key Direction Trdtime Price Next_Price ------------------------------------------------------

Categories : Oracle

How to partition a list in Haskell?
Here's one option: partition :: Int -> [a] -> [[a]] partition _ [] = [] partition n xs = (take n xs) : (partition n (drop n xs)) And here's a tail recursive version of that function: partition :: Int -> [a] -> [[a]] partition n xs = partition' n xs [] where partition' _ [] acc = reverse acc partition' n xs acc = partition' n (drop n xs) ((take n xs) : acc)

Categories : Haskell

How to partition an Excel file into two columns?
Copy your list to ColumnA in a blank sheet. Filter the copy by colour. Put =A2 in B2 (or adjust as necessary) and copy down. Copy the entire column, Paste Special Values next to your source data (move one row if required). Filter your source data on the added column to select non blanks. Blank out the cells in your original column. Unfilter.

Categories : Excel

Good practice to code partition
Validation normally belongs to the service layer, as there is no need to tie it to a specific view implementation. So in your case try to put it in the EJB. If you have to implement another application which is to use another view implementation like Swing for example, it will benefit from the validation as well. It's normally easier to write tests against the service layer; and this way you can test the validation without having to mock the view layer. Using JSF, if you have two use cases using different managed beans, and both use cases create a user, chances are that you end up with writing the validation code twice.

Categories : Java

How can I select a bunch of rows with the partition name in each row?
INTRO In order to solve this problem you can make use of the INFORMATION_SCHEMA.PARTITIONS table. Especially useful for you will be the PARTITION_DESCRIPTION and the PARTITION_NAME fields. From: http://dev.mysql.com/doc/refman/5.1/en/partitions-table.html PARTITION_DESCRIPTION: This column is used for RANGE and LIST partitions. For a RANGE partition, it contains the value set in the partition's VALUES LESS THAN clause, which can be either an integer or MAXVALUE. For a LIST partition, this column contains the values defined in the partition's VALUES IN clause, which is a comma-separated list of integer values. For partitions whose PARTITION_METHOD is other than RANGE or LIST, this column is always NULL. Finally, and very importantly - the exact SQL solution also dep

Categories : Mysql

Linq2SQL Help Converting row_number and partition
You can get the same results with following LINQ query: from o in Orders group o by o.clientId into g select g.OrderByDescending(x => x.purchasedate).FirstOrDefault(); but it will not generate the same SQL. It will use CROSS APPLY instead.

Categories : C#

python equivalent of scala partition
Scala val (inGroup,outGroup) = items.partition(filter) Python - Using List Comprehension inGroup = [e for e in items if _filter(e)] outGroup = [e for e in items if not _filter(e)]

Categories : Python

PostgreSQL cannot drop index on partition
Could be related to your search_path. Try dropping the index prefixed by the schema. Eg. SELECT schemaname,tablename,indexname FROM pg_indexes WHERE indexname = 'my_index_name' Using the results of that query, drop the index: DROP INDEX some_schema.your_index_name;

Categories : Postgresql

How do I partition in hive by a specific column?
In Hive each partition corresponds to a folder in HDFS. You can reload the data from your unpartitioned Hive table into a new partitioned HIve table using a create-table-as-select (CTAS) statement. See https://cwiki.apache.org/Hive/languagemanual-ddl.html#LanguageManualDDL-CreateTable for more details.

Categories : Hadoop

The buffer partition of numpy array
They do different things. One makes an Nx1 array; the other makes a 1xN array. Neither is "better". (In fact, the memory layout will be identical for both arrays, even if you specify column-major storage.) To answer the question about storage layout, though, numpy defaults to row-major layout, a.k.a. C-contiguous. You can see this clearly reflected in the docs.

Categories : Python

Query - Sum with Conditions in Partition Clause?
Try this: Sum(case when ColB = 1 and ColC > 0 then ColC else 0 end) over(partition by ColA) My answer assumes that the conditional sum for rows 7 to 9 is supposed to be 400.

Categories : SQL

How to write a quicksort partition function
Here's one problem: int pivot = numbers[(rhs - lhs) / 2]; Suppose lhs = 100 and rhs = 120. The above will choose element (120 - 100) / 2 = 10 as the pivot! I think you want something like int pivot = numbers[(rhs + lhs) / 2]; which will at least choose a pivot from within the range you're trying to partition!

Categories : Java

Azure Table Storage Partition Key
Answering #1: There is no concept of a server that a particular table entity lives on. There are no particular servers to choose from, as Table Storage is a massive-scale multi-tenant storage system. So... there's no way to retrieve a server ID for a given table entity. Answering #2: Choose a partition key that makes sense to your application. just remember that it's partition+row to access a given entity. If you do that, you'll have a fast, direct read. If you attempt to do a table- or partition-scan, your performance will certainly take a hit.

Categories : Azure

query partition table name for a specific value
A partition in Greenplum is treated like any other table. If you have psql access you should be able to use the 'd' command to see all the tables you have have access to in your search_path. Each partiton of a larger table will display in that. Unless you explicity name the partitions, greenplum will just name them based on the parent table name with autoincrementing partition numbers: gpadmin=# create table testtab (testcol varchar(10), gpadmin(# test_time timestamptz) gpadmin-# distributed by (testcol) gpadmin-# partition by range (test_time) gpadmin-# ( START (date '2013-10-01') INCLUSIVE gpadmin(# END (date '2013-11-25') EXCLUSIVE gpadmin(# EVERY (INTERVAL '1 week')); NOTICE: CREATE TABLE will create partition "testtab_1_prt_1" for table "testtab" NOTICE: CREATE TABLE will c

Categories : Misc

How does oracle manage a hash partition
A hash is not random, it divides the data in a repeatable (but perhaps difficult-to-predict) fashion so that the same ID will always map to the same partition. Oracle uses a hash algorithm that should usually spread the data evenly between partitions.

Categories : Oracle

MySQL Partitioning: why it's not taking appropriate partition
The HASH partitioning scheme means MySQL translates your arbitrary numerical value into its own hash value. You have defined 366 partitions. What do you think would happen if your query were: EXPLAIN PARTITIONS SELECT * FROM temp where PartitionID = 400 ? Your PartitionID cannot mean in this case the real partition's ID/name, since there is no partition 400. Now, just between the two of us, you might be interested to learn that MySQL's HASHing function is a simple modulus. Thus, 0 maps to partition p0, 1 maps to partition p1, and 400 maps to partition 34 (== 400-366). Generally speaking you should not be too interested in the identify of the particular partition being used. You should be more interested to know that there is a good balance of partitions. If the balance doesn't seem ri

Categories : Mysql

C# Upload Files on another partition of the server
Based on the documentation from http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.saveas.aspx, the String filename is the full path name of the location to save. Meaning you should be able to do so e.g: FileUpload.SaveAs("D:where_you_want_to_save") By the way what have you tried and what error did you get?

Categories : C#



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