I am using this example: http://gmaps-samples-v3.googlecode.com/svn/trunk/transit/transit.html but when I modified the code with the info related to my location, the departure code is not working. I only changed the origin and the destination.
This is the page with my code: http://goo.gl/fgmB9e
Any advice or suggestion?
I replaced the line:
var tzOffset = (now.getTimezoneOffset() + 60) * 60 * 1000;
with:
var tzOffset = now.getTimezoneOffset();
and it looks like working properly.
Related
I'm struggling with setting "document.cookie" value via Selenium. I want to achieve something like this. Generally, when I'm on a real browser like Chrome, I open the console and type
document.cookie='my_secret_cookie=1;path=/'
And everything works like a charm.
How can I achieve this via Selenium? Currently, I've done something like this, but it doesn't seem to work for me:
Date today = new Date();
Date tomorrow = new Date(today.getTime() + (1000 * 60 * 60 * 24));
Cookie newCookie = new Cookie.Builder("myCookie","my_secret_cookie=1")
.domain("my.site") // declared in my local.properties file
.path("/")
.expiresOn(tomorrow)
.isSecure(true)
.build();
driver.manage().addCookie(newCookie);
Any advice?
I want to test BigQuery DataTransfer API in local but I encounter problems with library :
client = bigquery_datatransfer_v1.DataTransferServiceClient()
projectid = 'MyProjectID'
transferid = 'MyTransferID'
parent = client.transfer_config_path(projectid, transferid)
start_time = bigquery_datatransfer_v1.types.Timestamp(seconds=int(time.time() + 10))
response = client.start_manual_transfer_runs(parent, requested_run_time=start_time)
print(response)
Here are the problems encountered :
Module 'google.cloud.bigquery_datatransfer_v1.types' has no 'Timestamp'
And :
Unexpected keyword argument 'requested_run_time' in method call
In order to further contribute to the community, I am posting my suggestion as an answer. Once, you mentioned it worked for you.
As per the documentation, you should import the Timestamp package as follows,
from google.protobuf.timestamp_pb2 import Timestamp
After that, you will be able to use it as google.protobuf.timestamp_pb2.Timestamp or as you wrote in your code. Both errors won't happen after you import the correct package.
I'm building an app using React Native.
I'm fetching an array of values fetched from a database in order to provide users a line chart which refresh every X seconds ( 3s atm ).
This works fine on iOS simulator but when it comes to deploy to TestFlight, and run the app on a device, the curves are not displayed, nothing happens.
Since I can use some other feature that requires to fetch data from the DB, I figured out that the issue was not from the API requests.
I currently use react-native-chart-kit, but I tried with react-native-svg-charts as well, the issue remains the same.
Any hint ?
The issue is the same when I display the array of the fetched values, a new value appears on the simulator every 3 seconds but it does not show anything on the device.
I finally found the issue.
The issue were spotted at the API request.
My request takes 2 timestamp params : start time / end time
I always debug the app using the browser and launch ios sim from the RN project.
This time I tried to Run a the project from Xcode and edit the Scheme as release instead of debug .
When I checked the console from Xcode I noticed that my Start time timestamp when considered as 'NaN'.. Not the End time timestamp.
Back to the RN project and to the browser console, the timestamp is alright.
I made some random changes and now it works fine .
Here's what I had before solving the issue:
function formatDate(rawStamp) {
const now = new Date(rawStamp);
var convertToStr =
now.getFullYear() +
"-" +
("00" + (now.getMonth() + 1)).slice(-2) +
"-" +
("00" + now.getDate()).slice(-2) +
" " +
("00" + now.getHours()).slice(-2) +
":" +
("00" + now.getMinutes()).slice(-2) +
":" +
("00" + now.getSeconds()).slice(-2);
return convertToStr
}
const nowStr = formatDate(Date.now() - 7200000)
const gameStampMinusX = Date.parse(nowStr) - (300000)
const gameStampMinusXToStr = formatDate(gameStampMinusX)
Here's what solved the issue:
const nowStr = formatDate(Date.now() - 7200000)
const gameStampMinusX = Date.now() - 7200000 - 300000
const gameStampMinusXToStr = formatDate(gameStampMinusX)
I'm a newbie so I cannot explain this behavior, but seems that this little change makes Xcode recognize the timestamp, and proceed the the API request correctly.
If anyone can explain, feel free !
Hi I've been working at this for a while without success. I'm trying to send a simple notification to the live tile for my Native Windows 8 game. To get used to it I tried to use the example mentioned in the docs:
var expiryTime;
expiryTime = date_current_datetime();
expiryTime = date_inc_minute(expiryTime, 5);
win8_livetile_notification_begin("TileSquarePeekImageAndText01");
win8_livetile_notification_expiry(expiryTime);
win8_livetile_notification_tag("tag0");
win8_livetile_notification_text_add("Current Score = " + score);
win8_livetile_notification_image_add("ms-appx:///" + working_directory + "ScoreTile.png");
win8_livetile_notification_end();
Now this code crashes my app. Can someone tell me how to post a tile notification and where we should put the images. Right now I have the images inside of the Included Files folder.
score is a real value, not a string, so you must write:
win8_livetile_notification_text_add("Current Score = " + string(score));
There's no typecasting in GameMaker and never was.
1) Earlier this week I was able to create defects and testcases using the Create method, which took 2 arguments at the time (a string and the DynamicJsonObject). However now, it needs three. I understand that one of these is now the workspace reference. How do I go about getting the workspace reference? For creating defects and testcases, I am using an empty string, and this seems to be working correctly for me. Is this to be expected?
2) For creating test case results, I am having a bit of trouble.
DynamicJsonObject newTCResult = new DynamicJsonObject();
newTCResult["Date"] = DateTime.Now.ToString("yyyyMMdd");
newTCResult["TestCase"] = "/testcase/11271454106";
newTCResult["Notes"] = "test";
newTCResult["Build"] = "13.1.0.90";
newTCResult["Verdict"] = "Pass";
CreateResult cr = restApi.Create(" ", "TestCaseResult", newTCResult);
As of right now, absolutely nothing is happening when I run this. I was able to do this successfully earlier this week (when I was able to use the Create method with two arguments). I feel that the problem is because I don't have a valid workspace reference. I followed the suggestion of another user in a similar question prior to this which worked for earlier, however now I am having this problem.
I was finally able to resolve this. It appears that the date field needs to be converted to UTC, so my code now looks something like this
newTCResult["Date"] = DateTime.UtcNow.ToString("o");
After making that small change results were working correctly.
It's somewhat surprising that Creates on Stories or Defects work with an empty string for a Workspace ref, although I suspect that on the server-side, the Webservices API is just using Default Workspace for the User of concern.
Either way, here's how you can get a ref to the Workspace of interest:
String myWorkspaceName = "My Workspace";
// Get a Reference to Target Workspace
Request workspaceRequest = new Request("workspace");
workspaceRequest.Fetch = new List<string>()
{
"Name",
"ObjectID"
};
workspaceRequest.Query = new Query("Name", Query.Operator.Equals, myWorkspaceName);
QueryResult workspaceQueryResults = restApi.Query(workspaceRequest);
var targetWorkspace = workspaceQueryResults.Results.First();
Console.WriteLine("Found Target Workspace: " + targetWorkspace["Name"]);
String workspaceRef = targetWorkspace["_ref"];
You can then use workspaceRef in your call to restApi.Create().