w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
git - dual boot ubuntu and windows with separate data partition
I'm guessing there's an issue with line endings. You probably have commited your code with windows line endings and when you checked out the code in ubuntu git converted those to unix style line endings. Take a look at this page Dealing with line endings

Categories : Windows

how to edit initramfs to add a new partition after boot in CentOs
I'm gonna go on a guess here. If I understand what you want to do correctly, what you want to do is to make another ext3 partition visible in CentOS. If so, you want to make sure that the partition exists. Maybe you have a disk called /dev/sda it might have 2 partiotions sda1 ext3 mounted at /boot and sda2 ext3 mounted at / To view this use "sudo blkid" fdisk-l or similar. These partitions are loaded at boot from the list found in /etc/fstab say you still have space left on the disk. use fdisk/gparted to create a new ext3 partition sda3. add a line for that disk in /etc/fstab now it should be accessible after a reboot or after "sudo mount -a" I might have completely misunderstood your question. Edit: I think I understand what you want to do now, and you probably want to edit

Categories : Linux

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

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

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

SVNKit to find diff between two files stored at separate locations with separate revision numbers
Your code looks correct. But prefer using the new API: final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); try { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final SvnDiffGenerator diffGenerator = new SvnDiffGenerator(); diffGenerator.setBasePath(new File("")); final SvnDiff diff = svnOperationFactory.createDiff(); diff.setSources(SvnTarget.fromURL(url1, svnRevision1), SvnTarget.fromURL(url2, svnRevision1)); diff.setDiffGenerator(diffGenerator); diff.setOutput(byteArrayOutputStream); diff.run(); } finally { svnOperationFactory.dispose(); }

Categories : Java

Data-centric application: separate database tables for separate organizations a good idea?
I was wondering whether rather than have a single set of tables, it would be much safer to have a separate set of tables for each client, all running within the same database. If you want to do this, you have a separate set of tables for each client, running in different logical databases. It's easier for the DBAs to manage. You're basically admitting that you can't depend on your application code to keep the firms separate when sharing the same database tables. Since each firm will have around 20-40 tables, will the number of tables tend to explode in magnitude with number of users, thus slowing down the database altogether? You're either going to have 20 - 40 tables for each firm, or 20 - 40 large tables for all the firms. The amount of storage will be about the same either

Categories : Database

What is the most stable and Pythonic cross-platform way to separate a string of path,filename,ext into three separate variables?
I tend to use os.path module, which has several versions depending on the OS that you're running. But importing os.path should always give you the right one. If you can you could check the OS you're using manually: import platform platform.platform() and then import the appropriate path toolkit from os. But it sure is a lot easier to just go import os.path. So what would be of interest to you is: os.path.basename(path) # To get the name of the file with extension. os.path.basename(path).split('.')[0] # To get just the name. os.path.dirname(path) # To get the directory leading to the file. Hope this helps. CAVEAT: I give no guarantee this is THE best way to do it.

Categories : Python

Can you host a sub-domain on a separate server with a separate hosting account?
Of course, it's possible. All you have to do is to create a DNS record IN A pointing to the IP of your new server. See here, for example: http://content.websitegear.com/article/subdomain_setup.htm

Categories : Ruby On Rails

how to set separate link styles in separate divs in HTML
Add classes to your div's View_1 .view_1 a:link { color: #CB4C2F; text-decoration: none; } .view_1 a:visited { color: #CB4C2F; } .view_1 a:active, .view_1 a:hover { color: #B60A00; } View_2 .view_2 a:link { color: #B5B5B5; text-decoration: none; } .view_2 a:visited { color: #808080; } .view_2 a:active, .view_2 a:hover { color: #FFFFFF; }

Categories : CSS

How to check for specific application installed in machine or can we get list of installed application in gwt ?
Browser and OS detected via Window.Navigator are not fail proof. They only observe pattern in the way a browser does stuff and classify into OS and Browser groups. Browser run Javascript ( i.e GWT Code ) do not have privilege to query OS regarding installed software or hardware details!!!!! There is no possible solution in GWT/Javascript for this.

Categories : Gwt

Compairing two separate columns on two separate sheets
code 1 Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False If Target.Column <> 8 Then Exit Sub Dim lastRow As Long Dim rng As Range, cell As Range lastRow = Range("H" & Rows.Count).End(xlUp).Row If lastRow < 2 Then lastRow = 2 Set rng = Range("H2:H" & lastRow) For Each cell In rng With Sheets("data") a = Application.VLookup(cell.Value, .Range("H2:H" & .Range("H" & Rows.Count).End(xlUp).Row), 1, 0) If IsError(a) Then cell.Interior.Color = vbYellow Else cell.Interior.Color = xlNone End If End With Next Application.EnableEvents = True End Sub code 2 Private Sub Worksheet_Change(ByVal

Categories : Excel

Separate check box value to separate text area
It doesn't have to be so messy as you describe. Besides, I don't know how it is working for you as the structure of html is clearly broken in the current state. Following is a bit of updated code, which I believe is equivalent to what you are trying to achieve with your snippet. DEMO JS: var itemsAdded = Array(); function moveNumbers() { var text = this.value; var i = itemsAdded.indexOf(text) if (i >= 0) itemsAdded.splice(i, 1); else itemsAdded.push(text); document.getElementById("result1").value = itemsAdded.join(" "); if (i < 0) itemsAdded.push(text); document.getElementById("result2").value = itemsAdded.join(" "); } $(function () { for (i = 0; i < 10; i++) $("<div>Checkbox" + i + "</div>").appendTo(document.body) .

Categories : Javascript

Separate check box out put value to separate textbox
I don't know what you are trying to achieve but when wanting to get the value of checkboxes you can get their values simply for example: <html> <head> <script> function check(id) { if ( document.getElementById(id).checked){ var vl=document.getElementById(id).value; document.getElementById("txt1").value += vl; } } </script> </head> <input type="checkbox" id='1' onClick='check(1)' value="5*7-">5*7 <input type="checkbox" id='2' onClick='check(2)' value="5*8-">5*8 <input type="textbox" id="txt1" name=one> </html>

Categories : PHP

How do I separate the posts in a custom post type WP query into groups of 3, and then separate those groups of 3 into sets of 2?
Try to make increment on inside the while loop , <?php $args = array( 'post_type' => 'portfolio' ); $loop = new WP_Query( $args ); $i = 0; echo'<div id="wrap_6_posts">' . " " . '<div id="wrap_3_posts" class="top-row">' . " "; while ( $loop->have_posts() ) : $loop->the_post(); if ($i % 6 == 0 && $i > 0) { echo '</div>' . " " . '</div>' . " " . '<div id="wrap_6_posts">' . " " . '<div id="wrap_3_posts" class="top-row">' . " "; } else if ($i % 3 == 0 && $i > 0) { echo '</div>' . " " . '<div id="wrap_3_posts" class="bottom-row">' . " "; } echo '<article class="portfolio-post' . ($i % 3 == 0 ? ' first' : '') . '">' . " "; ?> <h2 class="headline portfolio-headlines

Categories : PHP

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

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

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

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

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

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

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

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++

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

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

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

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

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

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 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

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

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

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

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

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

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

Partition and Composition (combinatorics) implementation in C++
Recursive version Here is a recursive solution. You have a sequence a where you keep track of the numbers you already have set. Each recursive call will assign valid numbers to one of these elements in a loop, before recursively calling that function for the remainder of the list. void recurse(std::vector<int>& a, int pos, int remaining) { if (remaining == 0) { print(a); return; } if (pos == a.size()) { return; } for (int i = remaining; i >= 0; --i) { a[pos] = i; recurse(a, pos + 1, remaining - i); } } void print_partitions(int sum_val, int n) { std::vector<int> a(n); recurse(a, 0, sum_val); } Proof of concept run visible at http://ideone.com/oJNvmu. Iterative version Your comment below indicates a performance problem. While it seems very likel

Categories : C++

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

Aggregation over order-dependent partition?
You didn't specify engine or dialect or version so I assumed SQL Server 2012. Example that you can run to see the solution: http://sqlfiddle.com/#!6/f5d38/21 You solve it by creating correct partitions in your set. Code looks like this. WITH groupLimits as ( SELECT [Key] AS groupend ,COALESCE(LAG([Key]) OVER (order by [Key]),0)+1 AS groupstart FROM sourceData WHERE F1 = 'Y' ) SELECT MIN(sourceData.F2) FROM groupLimits INNER JOIN sourceData ON sourceData.[Key] BETWEEN groupLimits.groupstart and groupLimits.groupend GROUP BY groupLimits.groupstart ORDER BY groupLimits.groupstart

Categories : SQL

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



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