Missing routes.php File in New Laravel Project

I downloaded Composer, installed Laravel, and started my first Laravel project to begin learning Laravel using the lessons on laracast (great lessons). Lesson two covers routes. My new project does not have a routes.php file.
I deleted composer and started again. Same thing. Tried two different computers. Same thing. I was using NetBeans so I tried using PHP Storm. Same thing. I tried making my own routes.php file but it doesn't seem to work right because I know nothing about Laravel at this point. I tried creating and saving the project in htdocs, and then PHPStorm project folder, again - no routes.php file.
Composer is saved here- C:\Users\myName\AppData\Roaming\Composer\vendor\bin. I used composer global require "laravel/installer" in command prompt to install laravel. Any ideas?
---Answer----
1.
I downloaded Composer, installed Laravel, and started my first Laravel project to begin learning Laravel using the lessons on laracast (great lessons). Lesson two covers routes. My new project does not have a routes.php file.
I deleted composer and started again. Same thing. Tried two different computers. Same thing. I was using NetBeans so I tried using PHP Storm. Same thing. I tried making my own routes.php file but it doesn't seem to work right because I know nothing about Laravel at this point. I tried creating and saving the project in htdocs, and then PHPStorm project folder, again - no routes.php file.
Composer is saved here- C:\Users\myName\AppData\Roaming\Composer\vendor\bin. I used composer global require "laravel/installer" in command prompt to install laravel. Any ideas?
2.
If you want to install laravel you should install it by composer command like this:
composer create-project --prefer-dist laravel/laravel your-project-name
laravel documentation: laravel installation
and if your composer is not installed perfectly you should go to composer installation and install your composer from here.
and routes.php file is located under app\Http\routes.php.
enter image description here


Localise App display name that have append suffix

I have a issue with getting app display name to include the appending suffix when adding localisation to InfoStrings.plist.
I have add different scheme and User-Defined attribute. So in my info.plist, i have App Name $(BUNDLE_DISPLAY_NAME_SUFFIX) in my CFBundleDisplayName. It will append a -S to my app name when running on development scheme and normal app name on release scheme that i created. Everything is working well.
However, when I try to translate the app name, it does not work anymore. So in my infoPlist.strings, I tried the following:
"CFBundleDisplayName" = "App Name ";
"CFBundleDisplayName" = "App Name $(BUNDLE_DISPLAY_NAME_SUFFIX)";
Both does not append the -S anymore when I run on development scheme. Does anyone know how I could still do that? Like maybe how to get the $(Bundle_DISPLAY_NAME_SUFFIX) to be read in the infoPlist.strings.
More specifically, how do I include a preprocessor in InfoPlist.strings?
-----Answer-----
Follow following steps as mentioned in attached screenshots.
enter image description here
enter image description here
enter image description here
enter image description here

Couchbase Admin Console Settings Notification

On my local instance of Couchbase (4.1.0) a notification icon has appeared on the settings tab inside of Admin Console. When clicking on the Settings tab and navigating to the sub tabs there doesn't appear to be any new information and the icon remains. What is the icon notification used to 
indicate/ additionally how do I get rid of the notification
Notification icon top right of fhe scree,  
 -----Answer-----
This is just a notification to upgrade couchbase to 4.5. Not sure why it never appeared before since 4.5 has been out for a while 

How do I subtract two date columns and two time columns in sql

I have 4 columns that are
Startdate, 
enddate, 
starttime, 
endtime.  
I need to get subtractions from the enddate and endtime - startdate and starttime. I will need that answer from the four columns in sql.
so far I have this I found but dont think this will work right.
SELECT DATEDIFF (day, enddate, startdate) as NumberOfDays  
DATEDIFF(hour,endtime,starttime) AS NumberOfHours 
DATEDIFF(minute,endtime,starttime) AS NumberOfMinutes 
from table;
Thanks for your help
----Answer----
1.
Assuming you have data like this, you can add the StartDate to the StartTime to get the StartDateTime, same for the EndDateTime
StartDate                StartTime                EndDate                  EndTime              
-----------------------  -----------------------  -----------------------  -----------------------
2014-05-01 00:00:00.000  1900-01-01 10:53:28.290  2014-05-07 00:00:00.000  1900-01-01 11:55:28.290
Once you've done that you can get the Days, Hours and Minutes like this:
select 
DATEDIFF(minute, StartDate + StartTime, EndDate + EndTime) / (24*60) 'Days',
(DATEDIFF(minute, StartDate + StartTime, EndDate + EndTime) / 60) % 24 'Hours',
DATEDIFF(minute, StartDate + StartTime, EndDate + EndTime) % 60 'Minutess'
  from YourTable
We have work in minutes the whole time in order to prevent problems with partial days crossing midnight and partial hours crossing an hour mark.
2.
EDIT - Now that I realize that the question is for SQL Server 2000, this proposed answer may not work.
The SQL Server 2000 documentation can be found at https://www.microsoft.com/en-us/download/details.aspx?id=18819. Once installed, look for tsqlref.chm in your installed path, and in that help file you can find information specific to DATEDIFF.

Based on the wording of the original question, I'm assuming that the start/end time columns are of type TIME, meaning there is no date portion. With that in mind, the following would answer your question.
However, note that depending on your data, you will lose precision in regards to the seconds and milliseconds.
More about DATEDIFF: https://msdn.microsoft.com/en-us/library/ms189794.aspx

DECLARE @mytable AS TABLE 
    (
        startdate DATETIME,
        enddate DATETIME,
        starttime TIME,
        endtime TIME
    )


INSERT INTO @mytable (startdate, enddate, starttime, endtime)
VALUES      (GETDATE() - 376, GETDATE(), '00:00:00', '23:59')

SELECT      *
FROM        @mytable

SELECT      DATEDIFF(HOUR, startdate, enddate) AS [NumHours],
            DATEDIFF(MINUTE, starttime, endtime) AS [NumMinutes]
FROM        @mytable
This would yield output similar to:
enter image description here


What does this code in Swift do?

I'm following a raywenderlich.com tutorial on using the Google Maps iOS SDK. I came across this piece of code which is halfway down this link here: https://www.raywenderlich.com/109888/google-maps-ios-sdk-tutorial.
I am familiar with Swift but I do not get what the piece of code after geocoder.reverseGeocodeCoordinate(coordinate) does; specifically, how can you just place the curly brackets right after the method call and what does it accomplish? I am asking this in terms of Swift syntax.
func reverseGeocodeCoordinate(coordinate: CLLocationCoordinate2D) {

  // 1
  let geocoder = GMSGeocoder()

  // 2
  geocoder.reverseGeocodeCoordinate(coordinate) { response, error in
    if let address = response?.firstResult() {

      // 3
      let lines = address.lines as! [String]
      self.addressLabel.text = lines.joinWithSeparator("\n")

      // 4
      UIView.animateWithDuration(0.25) {
        self.view.layoutIfNeeded()
      }
    }
  }
}
-----Answer-----------
1.
This is called a "trailing closure" or "trailing closure syntax". It's described in Apple's docs here:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html#//apple_ref/doc/uid/TP40014097-CH11-ID102
In summary, if the last parameter of a method or function is a closure, you can provide it immediately after the closing ) of the function call and the previous arguments. Example:
func sendMessage(text:String, withCallback:(Bool)->()) {
    // Implementation
}

let message = "hello"
sendMessage(message) { 
    let result = $0 ? "Suceeded" : "Failed"
    print(result)
}
If a function take only one parameter and that parameter is a closure, then you don't need to use () at all and can just pass the closure immediately after the function name. For example see how this filter method is called:
let boolArray = [true, true, false, true, false]
let filtered = boolArray.filter { $0 == false }  // Only the falses
2. 
It is called a trailing closure. A trailing closure is a closure expression that is written outside of the parentheses of the function call.
The only requirement here is that the closure must be function's final argument.
Given the following function, these two calls are identical:
func someAPICall(url: String, completion: (Bool -> Void)) {
  // make some HTTP request
  completion(result.isSuccess)
}

someAPICall("http://httpbin.org/get") { success in
  print("Success", success)
}

someAPICall("http://httpbin.org/get", completion: { success in
  print("Success", success)
})
 
 

What is the difference between PowerMock, EasyMock and Mockito frameworks ?

I am very new to mocking framework, and my work needs mocking framework to finish unit testing. When I try to use mock methods, variables of a class using junit which one of the above frameworks should I prefer? 

------Answer--------

Differences

  • No record/replay modes - no need for them. There only 2 things you can do with Mockito mocks - verify or stub. Stubbing goes before execution and verification afterwards.
  • All mocks are nice (even somehow nicer, because collection-returning methods return empty collections instead of nulls). Even though mocks are nice, you can verify them as strictly as you want and detect any unwanted interaction.
  • Explicit language for better readability: verify() and when() VS the mixture of expect(mock.foo()) and mock.foo() (plain method call without expect). I'm sure some of you will find this argument subjective :)
  • Simplified stubbing model - stubbed methods replay all the time with stubbed value no matter how many times they are called. Works exactly like EasyMock's andStubReturn(), andStubThrow(). Also, you can stub with different return values for different arguments (like in EasyMock).
  • Verification of stubbed methods is optional because usually it's more important to test if the stubbed value is used correctly rather than where's it come from.
  • Verification is explicit - verification errors point at line of code showing what interaction failed.
  • Verification in order is flexible and doesn't require to verify every single interaction.
  • Custom argument matchers use hamcrest matchers, so you can use your existing hamcrest matchers. (EasyMock can also integrate with Hamcrest though it is not a part of EasyMock but Hamcrest. See the documentation of Hamcrest).
PowerMock is an extension of other Mocking frameworks like Mockito or EasyMock that comes with more powerful capabilities. It means that you can combine Mockito/EasyMock and PowerMock into the same unit test.
I personally use Mockito for unit testing big part of my code and PowerMock only in code that needs its extra features as testing static methods.

 

Popular Posts

Powered by Blogger.