Can I rename an Xively stream ID - xively

Is there a way to rename a Xively stream ID. Because my feeds were created in cosm, they just have IDs like 0, 1 etc. But in Xively, it would make more sense for them to be named. Can I change the stream ID in xively?

You will need to create a new datastream and transfer the data, if that's necessary, then delete the old datastream. You will also need to reprogrammed your device that sends data to this feed. May be it's best to actually create a new development device instead of the legacy feed you have.

Related

Add file name as column in data factory pipeline destination

I am new to DF. i am loading bunch of csv files into a table and i would like to capture the name of the csv file as a new column in the destination table.
Can someone please help how i can achieve this ? thanks in advance
If you use a Mapping data flow, there is an option under source settings to hold the File name being used. And later in it can be mapped to column in Sink.
If your destination is azure table storage, you could put your filename into partition key column. Otherwise, I think there is no native way to do this with ADF. You may need custom activity or stored procedure.
A post said the could use data bricks to handle this.
Data Factory - append fields to JSON sink
Another post said they are using USQL to hanlde this.
use adf pipeline parameters as source to sink columns while mapping
For stored procedure, please reference this post. Azure Data Factory mapping 2 columns in one column

Firebase Database Unity differentiating between old and new data

I am building a chat engine using firebase in unity. I want to differentiate between the existing data and all the new data that gets added into the database. There is method once in web sdk of firebase which helps in differentiating between old and new data, is anyone aware if we have something similar on unity
There is no direct way to do this, one way that is a workaround is to add a timestamp value in all the entries maintained in the database and each time one subscribes for the new data we make use of the OrderByValue|OrderByKey and StartAt to do the same.
In the beginning value for StartAt will be 0 but post that whenever a child gets added we can update the StartAt value to that so that the next time client subscribes for the childAdded, it will only receive data post the last child.

How to not generate unique ID when using push method in Firebase?

I'm trying to push new data into Firebase but it keeps generating an unique ID and an extra child node for me. How can I stop generating the ID and extra node or is there another way to push data into Firbase? My dataset is given and I just need to dump the dataset into the db. (But I'm slowly updating this given dataset.)
Firease always generates the unique id when using the push method. You can use it as a key or as a parent node. This post describes push in more detail.
https://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html
You should use set to publish new data to firebase if push doesn't fit your use case. There is also an update method as set will overwrite any data in the given path.
https://firebase.google.com/docs/database/web/save-data
I generally use set for new data, or if I change how I have my data structured, or if I am appending new data in a path, update to make changes to fields for a dataset, and push for sets of data that I want organized in a list by time( i.e. Chat message log ).

Image Comparison in ASP.NET

I'm developing a web application, Computerized Voting System using ASP.NET. i want to compare thumb impression from database. I'm using disconnected data access. is it possible to compare an input thumb impression with a thumb print already saved in SQL database? if yes then then how?
please describe some details of the application.
The images that are saved in the database, are they uploaded with the same application ? If so, you should add a new column where you will store the hash of the image.
You will have a table like this: |ID|ImageData|Hash|
This is how you can compute the hash:
string hash;
using(SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider())
{
hash = Convert.ToBase64String(sha1.ComputeHash(byteArray));
}
Then, when you want to check if an uploaded image already exists in the database, you should compute the hash for it and send a query like:
string.Format("SELECT ID FROM Images WHERE Hash={0}", hash);
This will tell you if the exact same bytes are already in the database. If the image is similar, it will not work. It must be identical.
NOTE: you will have to convert your image into a byte array. This should not be a problem if you already do this when saving images in the database.
You might want to look in Computer Vision and Principal Component Analysis if you want to look for similarities between images.

Photos and Database

I am working on a website, where user can upload photos of product they want to advertise.
I am saving photos in a folder on the web. In the table where I keep reference of photos, there is a key field photoid which is Identity field(primary key).
My repository has following methods
Photo photo = rep.NewPhoto();
photo.Title="Some Title";
rep.InsertPhoto(photo);
rep.SaveAll();
rep.SavePhoto(photo,uploadedPhoto);
rep.SaveAll();
I am using Linq to SQL for my data model.
Now my problem is, if I want to save my files
with a name which is coming from photoid, I have to Call the rep.SaveAll()
method to get the new created photoid and then save the photo with new id
and then I have to Call SaveAll() method to update it again with the changes
happend in SavePhoto() method.
Other option is I save the file with some random file number first and then Save the photo record in one step.
This is second approach.
Photo photo = rep.NewPhoto();
photo.Title="Some Title";
string filename = rep.SavePhoto(uploadedPhoto);
photo.FileName=filename;
rep.InsertPhoto(photo);
rep.SaveAll();
Saving files with photoid has one good point, photos can be easily loaded using its id.
What is a good approach to achieve this kind of functionality.
Help will be appritiate.
Cheers
Parminder
Second approach is definitely more efficient; other option could be to create a unique in your application layer(you can use guids ) and then use this as key DB record and same as file name.
If you are using the latest SQL Server, you might want to look into the new FILESTREAM field type:
http://technet.microsoft.com/en-us/library/bb933993.aspx
It's for exactly this kind of thing -- trying to get large blobs out of the table structure and onto the filesystem.
Other than that, I think you have the right idea with either way you go -- if you need two saves, you might want to consider a transaction if you care about what happens if the second save or SavePhoto fails.
A couple of things:
1) Consider storing the photos as VARBINARY(MAX) in the database. It will be much easier for people to manage as far as backups and restores go, and it's better for your database's integrity.
2) Consider using the partial methods of your L2SQL Photo class in order to achieve what you want. You should be able to change your Photo class's Update method to save your photo as well. Hope this helps.

Resources