w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to programmatically retrieve UUID of root disk partition in OS X?
Use DADiskCreateFromVolumePath instead of DADiskCreateFromBSDName: char *mountPoint = "/"; CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, (const UInt8 *)mountPoint, strlen(mountPoint), TRUE); disk = DADiskCreateFromVolumePath(NULL, session, url); CFRelease(url);

Categories : C++

How do I move a spreadsheet from the root to my active folder?
You can use DocsList service to move your file after its creation, try like this : ... var ssOut = SpreadsheetApp.create(output_name); // Create a new spreadsheet, output_name. var root = DocsList.getRootFolder(); var folder = DocsList.getFolderById('your folder Id');// or use getFolderByName if you want var ssOutId = ssOut.getId(); var newFile = DocsList.getFileById(ssOutId); // begin the 'move to folder process' newFile.addToFolder(folder); newFile.removeFromFolder(root);// had to do it in 2 separate steps }

Categories : Google Apps Script

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

Linux skip /root/.gvfs when executing df command with non-root user
I got the solution for my own question :) In df command you can pass the file system types which you would like to exclude, in this case it is 'fuse.gvfs-fuse-daemon'. So when I execute the below the command I no more get this message "df: `/root/.gvfs': Permission denied" df -x fuse.gvfs-fuse-daemon For more details one can look into df --help option.

Categories : Linux

Root immediate child nodes icons not visible when hiding root
JTree#setShowsRootHandles(boolean newValue) controls the state of the handles for root elements. Normally, this is false. Try changing to true

Categories : Java

Is sudo-ing tomcat's startup with a non-root user the same as running it as root?
Do be aware that the recommended solution to run tomcat on port 80 is to use mod-jk with the Apache web server, not to have tomcat listen on port 80 directly.

Categories : Unix

Read and Write root folder wihout root
You can use run-as on some devices to execute commands as a particular package. Google have fixed this on Jelly Bean so it no longer works: adb shell run-as app.package.name cp /data/data/package.name/file.txt /sdcard/ exit adb pull /sdcard/file.txt ~/ Here is a good article explaining file access in Android without root permissions, including a one-liner for the above script. It details how to use the new backup command: backup -f ~/data.ab -noapk app.package.name And how to extract the contents of the resulting .ab file: dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf - You will most likely need the android.permission.BACKUP permission.

Categories : Android

Reset MAMP Pro username and password to root/root
Assuming you still know the password, you can change the password back to root using /Applications/MAMP/Library/bin/mysqladmin -u root -p password root It'll prompt you to enter a password again, after which it'll be reset to root

Categories : Mysql

SVN (svnserve) virtual root --root= not recognized
svn+ssh handles the whole transaction including writing and reading the files so it ignores the --root parameter in svnserve. Here is how to fix it over at serverfault -- Basically you just make svnserve into a script that calls svnserve with the proper variables.

Categories : Svn

Document root element "hibernate-configuration", must match DOCTYPE root "hibernate-mapping"
DOCTYPE for <hibernate-configuration> should be: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

Categories : Hibernate

Using CSS3 hover effect, how can I move the text left 5 pixels and move it back?
With just a little javascript, everything is smooth (the css below is the bare necessities): a { display: inline-block; /* this just has to be block-level */ -webkit-animation: moveAndBack 1s ease-in-out; } a.not-ready { -webkit-animation-duration: 0; } a:hover { -webkit-animation-direction: alternate; -webkit-animation-iteration-count: 2; -webkit-animation-fill-mode: forwards; } @-webkit-keyframes moveAndBack { 0% { -webkit-transform: translate(0); } 25% { -webkit-transform: translateX(5px); } 100% { -webkit-transform: translateX(5px); } } See it here And the only thing the javascript is doing is stopping the animation from running on load. Latest edit and update to fiddle takes care of an issue that would only happen if you hovered on the link lo

Categories : CSS

Why does the UIButton move the title label all the way to the right when I set content insets to move it to the bottom?
You just wrongly calculated edgeInSets.They are not there the way you think they are. Here's my test code.It did cost me a while to put image and title in the right place. UIButton *tmp_testBtn = [[UIButton alloc] initWithFrame:CGRectMake(50, 200, 60, 40)]; tmp_testBtn.backgroundColor = [UIColor grayColor]; [tmp_testBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 20, 0)]; [tmp_testBtn setImage:[UIImage imageNamed:@"France"] forState:UIControlStateNormal]; [tmp_testBtn setTitleEdgeInsets:UIEdgeInsetsMake(20, -258, 0, 0)]; [tmp_testBtn setTitle:@"testbutton" forState:UIControlStateNormal]; CGRect contentRect = [tmp_testBtn contentRectForBounds:tmp_testBtn.bounds]; NSLog(@"contenRect:%f,%f,%f,%f",contentRect.origin.x,contentRect.origin.y,contentRect.size.width,contentRect.size.height); CGRect

Categories : IOS

How to get event touch move of UIView when move finger from outside view
Best approach is create a uiview with necessary size(which is larger than uiimageview). Place the uiimageview inside it. Add gesture recognizer to uiview instead of uiimageview. In the delegate method of geature, move the image view.

Categories : IOS

I'm building a car game I want to move a car through the keyevent , the algorithm is okay, but the car doesn't move
use this: @Override public boolean onKeyDown(View view, Editable arg1, int keyCode, KeyEvent event) { instead of this: public boolean onKey(View view, int keyCode, KeyEvent event) {

Categories : Java

Can the PowerShell commandlet move-item move a currently open file?
This is the classic producer-consumer problem, which is a well researched topic. Some solutions you might try are checking the file's last write time. If it is well enough in the past, it can be moved without issues. Another one would be trying to open the file with exclusive access. If it fails, the file is still being used by the producer process. Othervise, close the file and move it. Some examples are like so, # List files that were modified at least five minutes ago gci | ? { $_.lastwritetime -le (get-date).addminutes(-5) } # Try to open a file with exclusive mode try { $f1 = [IO.File]::Open("c: empfoo.txt", [IO.Filemode]::Open, [IO.FileAccess]::Read, [IO.FileShare]::None) # If that didn't fail, close and move the file to new location $f1.Close() $f1.Dispose()

Categories : Powershell

Implementing Move Constructor by Calling Move Assignment Operator
I don't think you're going to notice significant performance difference. I consider it good practice to use the move assignment operator from the move constructor. However I would rather use std::forward instead of std::move because it's more logical: *this = std::forward<MemoryBlock>(other);

Categories : C++

is there any method to draw a tree with a root , the root's previous nodes and successor nodes?
Couple of ideas you might find useful: You can use the tree layout to place the nodes in the canvas, create link objects pointing back and forth, then bind the link objects to a diagonal. http://www.durablejs.org/examples/flowchart/1/admin.html You can also use place the nodes using a pack layout, create the link objects pointing back and forth, and bind the links to a Bezier curve. http://www.durablejs.org/examples/statechart/1/admin.html You can find the code for the graphs above: https://github.com/jruizgit/durable/tree/master/lib/durabjevisual.js

Categories : D3 Js

Mongodb balancer move failed: chunk too big to move. But it's not
Looks like as known old bug https://jira.mongodb.org/browse/SERVER-9365 I have 30MB chunks about 280K docs. And mongo can not move it becouse it contain more then 250001 docs and fill error "chunk too big to move". We have situation that chuk not to big to split, and "not to small" to move. I reproduced that localy. I created collection of 1 chunk with 36b docs (8.58MiB per chunk). If docs is 250001 or less chunk moved manualy as expected. If docs 250002 or more I got a error "chunk too big to move". Chunk size in settings 64MB. Work arround: If you planed use collection with small docs - pre-split collection so that the documents were less then 250K.

Categories : Mongodb

Make background image move when you move the page
background-attachment? Mozilla docs: https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment

Categories : HTML

How to move a character over a display so that it appear to move with same velocity on all devices
You can get the width of the device and then just divide that by something (like divide by 10 for 10% or 100 for 100%) and then have movement happen in relation to size of the screen. The character will still move differently, but it won't be as different as a set amount. To get the width of the screen you can do this: Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; Then do something like: x=x+(width*.01); to add 1% of the screen

Categories : Android

How do I move a shared_ptr object between containers with move semantics?
You're not invoking the move constructor. Nothing about the emplace_back call makes it clear v1 is no longer needed. You probably need a std::move in there. You probably want: v2.emplace_back(std::move(v1.back())); v1.pop_back();

Categories : C++

How can I remove the root node and make the first child the new root node with XSLT?
Add a rule to the identity transform that adds nothing to the result tree for your document element other than the processing of its children: <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/*"> <xsl:apply-templates select="*[1]"/> </xsl:template> <xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> (edited to be agnostic to the name of the document element) (edited again to only preserve the first child element of the document element)

Categories : Xml

Including from child theme root or else include from parent theme root
To answer your question directly based on your sample, i would not check to see if the file has been placed in the child theme. If a child-theme developer has customized the file, they can simply declare the function and include their own file (wherever they place it). There is no risk of code duplication because your sample function is simple enough. Even if you simplified your code for the purposes of placing it here....you can always keep includes wrapped in a very simple function that can be declared by a child theme. This will keep PHP running efficient and not having to check for files all the time.

Categories : Wordpress

Is a private move constructor to prevent move?
But will the following code then compile (in C++11/14): No, it will not. The presence of a user-declared copy constructor should inhibit the implicit generation of a move constructor. Per paragraph 12.8/9 of the C++11 Standard: If the definition of a class X does not explicitly declare a move constructor, one will be implicitly declared as defaulted if and only if — X does not have a user-declared copy constructor, — X does not have a user-declared copy assignment operator, — X does not have a user-declared move assignment operator, — X does not have a user-declared destructor, and — the move constructor would not be implicitly defined as deleted.

Categories : C++

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

Defining root of HTML in a folder within the site root folder
You need to set the base tag. If you add the tag in your page <head> like this: <base href="http://yoursite.tld/folder/"> it should display images and with sources relative to this base path.

Categories : HTML

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

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

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

I want to set authenticated users' root to a nested resource, their dashboard, instead of the home#index page non-authenticated users use as root
Option 1: In your dashboards controller, change to: @user = current_user @dashboard = current_user.dashboard This will also prevent users from seeing other user's dashboards. Option 2: Now, if users can see other user's dashboard fine, then change your route: root :to => "dashboards#find", as: :authenticated_root and in your dashboards controller: def find redirect_to user_dashboard_path(current_user, current_user.dashboard) end

Categories : Ruby On Rails

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

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

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

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

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

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

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



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