This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)getCacheOf:(NSString*) documentID withProyectName: (NSString *)proyect { | |
//Get the proyect also, because is using the default one... | |
MSIPreferencesStore * store = [MSIPreferencesStore preferencesStore]; | |
MSIDevicePreferences *devicePreferences = [store preferencesCopy]; | |
WebServerList *webServerList = [devicePreferences getWebServers]; | |
MSIProjectConfiguration *project = [webServerList getProjectConfigurationByProjectName:proyect]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Compilation: javac Quadratic.java | |
* Execution: java Quadatic b c | |
* | |
* Given b and c, solves for the roots of x*x + b*x + c. | |
* Assumes both roots are real valued. | |
* | |
* % java Quadratic -3.0 2.0 | |
* 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Compilation: javac Distance.java | |
* Execution: java Distance x y | |
* | |
* Prints the distance from (x, y) to the origin, where x and y | |
* are integers. | |
* | |
* % java Distance 45 -2 | |
* distance from (3, 4) to (0, 0) = 45.044422518220834 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MARK: - We use it to know when the microstrategy VC is created or to handle the error. | |
extension NavigationManager: MSTRVCRetrieverDelegate { | |
/** | |
This method is called when the VCRetriever encountered an Error while fetching the VC | |
*/ | |
func retriever(retriever: MSTRVCRetriever!, didFailWithError error: MSTRError!) { | |
//ERROR is always nil. We should be able to know if the password is not correct, or why the user can't access. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Block { | |
let timestamp: Date | |
let data: String | |
let previousBlockHash: Int | |
let hash: Int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Block { | |
init(timestamp: Date, data: String, previousBlockHash: Int) { | |
self.timestamp = timestamp | |
self.data = data | |
self.previousBlockHash = previousBlockHash | |
// For now lets just get some fields, concatenate them, and calculate a hash | |
let basicHash = String(previousBlockHash) + data + String(timestamp.timeIntervalSince1970) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Blockchain { | |
var blocks: [Block] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Blockchain { | |
var blocks = [Block]() | |
mutating func addBlock(_ data: String) { | |
guard let lastBlock = blocks.last else { fatalError("Failed to find genesis block.") } | |
let newBlock = Block(timestamp: Date(), data: data, previousBlockHash: lastBlock.hash) | |
blocks.append(newBlock) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func NewGenesisBlock() -> Block { | |
return Block(timestamp: Date(), data: "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks", previousBlockHash: 0) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct Block { | |
init(timestamp: Date, data: String, previousBlockHash: Int) { | |
self.timestamp = timestamp | |
self.data = data | |
self.previousBlockHash = previousBlockHash | |
OlderNewer