Search results for

column

2,047 results found

Post

Replies

Boosts

Views

Activity

Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
the sparseMatrix function with comments: extension Array where Element == [Double] { // A sparse matrix is a mattrix where all zero's are ommitted. // Normal matrix: Sparse matrix: // 0 1 0 1 // 1 3 0 1 3 // 4 0 2 4 2 // Find the sparse matrix of this matrix. Returns an array of doubles containing the values of the sparse matrix (omitting all zero's) and a SparseMatrixStructure containing information about where the columns start and where the rows start. The values array of the sparse matrix above would be [1, 4, 1, 3, 2]. func sparseMatrix() -> (structure: SparseMatrixStructure, values: [Double]) { let columns = self.transpose() // Get the row indices of the matrix. The row indices of the sparse matrix above would be // [1, 2 column 0 // 0, 1, column 1 // 2] column 2 var rowIndices: [Int32] = columns.map { column in column.indices.compactMap { indexInColumn in if column[indexInColumn] != 0 { return Int32(indexInColumn) } return nil } }.reduce
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’24
Swiftui Table statement conditional table columns
Is it possible to have conditional table columns for a swifui Table statement? Like for this code TableColumn(Image) { artPiece in if let imageData = artPiece.artImage.first, let image = UIImage(data: imageData!) { Image(uiImage: image) .resizable() .frame(width: 50, height: 50) } else { Image(systemName: photo) .resizable() .frame(width: 50, height: 50) } } .customizationID(Image) TableColumn(Name, value: .artName) .customizationID(Name) TableColumn (Art ID, value: .artPieceID) { artPiece in Text(String(artPiece.artPieceID)) } .customizationID(Art ID) have a conditional TableColumn for this part of my SWIFTDATA model var artDefinedFields: [ArtDefinedFields] = [] or if I change the variable string array to this var artDefinedFields: [ArtDefinedFields] = Array(repeating: ArtDefinedFields(), count: 10), initialize the array with None and only create a TableColumn when there is aArtDeginedFields value other than None
3
0
623
Aug ’24
Two column SplitViewController side-by-side in regular size class
Hello, I configured a SplitViewController in Storyboard. Master and detail controller are each connected to a separate NavigationController that each has a separate TableViewController as root view controller. The master view controller is connected to the detail view controller to show detail in the segue. In code i set preferredDisplayMode = .allVisible to always show master and detail view controller side-by-side in regular size class. That worked well in iOS 13. Now, using latest iOS 14 beta the initial view shows the detail view controller instead of master even in regular size class only one view controller is shown at the same time. In Storyboard Two Columns is selected and i set One Column Beside as Display Mode and Tile as Behavior. Unfortunately that didn't help to restore the behavior as in iOS 13.
1
0
776
Aug ’20
Reply to NSPersistentCloudKitContainer - how to reset CoreData+CloudKit after failed automatic migration (while still in development environment)
Additional info to my questions above: even if I delete the app from the test device reset the Development Environment in the CloudKit dashboard for my apps container then reinstall the app out of Xcode the same skipping migration error shows up in the console. This does not make sense to me. Why after all CoreData DBs on test device(s) have been cleared and newly compiled code has been installed on device. Shouldn't Xcode use the current NSManagedObjectModel as the new zero generation model, and thus not need any migration!? What do I miss here? Or is this a CoreData bug? P.S. the log shows these lines: Skipping migration for 'ANSCKMETADATAENTRY' because it already has a column named 'ZDATEVALUE' Skipping migration for 'ANSCKRECORDMETADATA' because it already has a column named 'ZNEEDSUPLOAD' Skipping migration for 'ANSCKRECORDMETADATA' because it already has a column named 'ZNEEDSLOCALDELETE' Skipping migration for 'ANSCKRECORDMETADATA' because it already has a column nam
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Help Loading an External CSV File on iOS in Swift
I was able to load a CSV into a TabularData based SwiftUI app -- loading and displaying was no issue ... but, HOW to update a value in a column. I created a bindable textfield for the columns in the table, and it displays the value for the rows/columns, and while the code to update the column compiles, it never updates the value in the DataFrame. Is a DataFrame read only ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’24
Reply to Sorting NSTableView
Setting the sort descriptor prototype of a table column allows the column to inform the table view of how it should be sorted when the user clicks that column's header. (Again, the table view isn't able to sort itself, but it informs the data source or, if so bound, its array controller, which sorts the data.)It also allows the table view to show an indicator in the header of the primary-sorting column.If your table doesn't have headers or will only ever have one column or isn't otherwise user-sortable, then you don't need to set the column's sort descriptor prototype.
Topic: UI Frameworks SubTopic: AppKit Tags:
Oct ’15
Reply to Converting json to html table
Try to avoid things like NSArray if you're writing new Swift code. Be explicit about your types whenever possible.print(<table><thead>) if let columns = json[columns] as? [[String : String]] { for column in columns { let label = column[label]! print(<th>(label)</th>) } } print(</thead><tbody>) if let rows = json[rows] as? [[String : [String]]] { for row in rows { print(<tr>) for value in row[values]! { print( <td>(value)</td>, terminator: ) } print(</tr>) } } print(</tbody></table>)
Oct ’15
Reply to Create array of arrays by two properties
That's pretty similar to what I was already doing. I ended up finalizing on this, which will be easier to understand in the future. var prevColumn = sorted[0].column var startIndex = 0 var byColumnAndRow: [[Match]] = [] for (index, match) in sorted.enumerate() { guard prevColumn != match.column else { continue } let column = Array(sorted[startIndex ..< index]) byColumnAndRow.append(column) startIndex = index prevColumn = match.column } // The previous enumeration won't grab the very last column worth of matches because the // loop ends before the column changes again. byColumnAndRow.append(Array(sorted[startIndex ..< sorted.count]))
Feb ’16
Random "duplicate column name" crashes using SwiftData
Hello everyone, I am experiencing a very weird issue. I have a simple relationship between 2 models, that occasionally starts crashing the app, with the following error: error: : Attempting recovery from error encountered during addPersistentStore: 0x282523c60 Error Domain=NSCocoaErrorDomain Code=134110 An error occurred during persistent store migration. UserInfo={sourceURL=file:///private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application%20Support/default.store, reason=Cannot migrate store in-place: I/O error for database at /private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application Support/default.store. SQLite error code:1, 'duplicate column name: Z1POSITIONS', destinationURL=file:///private/var/mobile/Containers/Shared/AppGroup/F8286D67-AC8C-4441-A151-13B5AAA509F3/Library/Application%20Support/default.store, NSUnderlyingError=0x2825c6700 {Error Domain=NSCocoaErrorDomain Code=134110 An error occurred during
1
0
1k
Oct ’23
Matrix - Buffer, row - column representation problem
Greeting,I represent my matrix buffer with the following data on the GPU:Address: Data:0x00 0 1 2 30x01 4 5 6 70x02 8 9 10 110x03 12 13 14 15With the following shading code:float4 (out) = float4x4 (m) * float4 (in)According to apple's documentationfloat3 u = m * v;is equivalent to:u = v.x * m[0];u += v.y * m[1];u += v.z * m[2];My question is does m[0] refer to <0, 1, 2, 3> or <0, 4, 8, 12>?As my experiment shows the GPU does compute the matrix as m[0] = <0, 1, 2, 3>But common sense tell us m[0] should be the column <0, 4, 8, 12> otherwise it's very hard to read and debugIf m[0] did refer to <0, 1, 2, 3>, is there any way to transpose a matrix in shading file?Or we have to work on transposed matrix all the time?Thanks!
3
0
2.4k
Nov ’15
NSBrowser Column Resizing Causes NSWindowWillStartLiveResizeNotification to be posted even though the window isn't being resized.
I have an NSBrowser inside a window. When I start resizing a column I noticed a peculiar behavior: it causes NSWindowWillStartLiveResizeNotification to get posted for the NSWindow the browser is inside (and did end gets posted when column resizing finishes). The browser is not the NSWindow contentView but a descendant of the contentView. I have my reasons for caring (I'm currently listening for these window resize notifications) but my code naively assumes that NSWindowWillStartLiveResizeNotification - NSWindowDidEndLiveResizeNotification indicates a window resizing session, not a column resizing session for the NSBrowser. This is in contrast to NSOutlineView. When resizing columns in NSOutlineView the window resize notifications do not get posted. NSBrowser deliberately kicks it off: -[NSWindow _startLiveResize]; -[NSBrowser _resizeColumn:withEvent:] () So this seems quite intentional but is it necessary in modern macOS? Should I file a bug? I already did FB20298148
Topic: UI Frameworks SubTopic: AppKit Tags:
0
0
82
3w