c#-4.0

How to query Facebook comments plugin comments information using C#?

放肆的年华 提交于 2020-01-06 16:00:16
问题 I am trying to fetch comment information from this page (scroll down to **Comments Plugin Code Generator* section) I am using FacebookClient class from Facebook Nuget package to fetch the data. My code is the following: string oauthUrl = $"https://graph.facebook.com/oauth/access_token?type=client_cred&client_id={appId}&client_secret={appSecret}"; string accessToken = client.DownloadString(oauthUrl).Split('=')[1]; // this is included as a sanity check that the client can fetch data (correct

how to convert formcollection to model in mvc

こ雲淡風輕ζ 提交于 2020-01-06 15:52:30
问题 Is it possible to convert formcollection to a 'model' known? [HttpPost] public ActionResult Settings(FormCollection fc) { var model=(Student)fc; // Error: Can't convert type 'FormCollection' to 'Student' } NOTE : for some reasons i can't use ViewModel instead. Here is my code VIEW: Settings.cshtml @model MediaLibrarySetting @{ ViewBag.Title = "Library Settings"; var extensions = (IQueryable<MediaLibrarySetting>)(ViewBag.Data); } @helper EntriForm(MediaLibrarySetting cmodel) { <form action='

c# Regex- Remove string which developed only combination of special charter

試著忘記壹切 提交于 2020-01-06 14:03:40
问题 I am looking for regular expression by which I can ignore strings which is only combination of All special charters . Example List<string> liststr = new List<string>() { "a b", "c%d", " ", "% % % %" ,"''","&","''","'"}; etc... I need result of this one { "a b", "c%d"} 回答1: Use this one : .*[A-Za-z0-9].* It matches at least one alphanumeric character. Doing this, it will take any string that is not only symbols/special chars. It does the output you want, see here : demo 回答2: You can use this,

ON DELETE CASCADE not working in c#

£可爱£侵袭症+ 提交于 2020-01-06 12:54:49
问题 When I delete a primary key with ExecuteNonQuery() in C# from the first table it doesn't affect the second table. But when I do the same with SQLiteStudio it does affect the second table. Here is my SQLite code: CREATE TABLE Zdravila( ID INTEGER PRIMARY KEY, NACIONALNA_SIFRA INTEGER UNIQUE NOT NULL, IME_ZDRAVILA TEXT, POIMENOVANJE_IZDELKA TEXT NOT NULL, SIFRA_REZIM_IZDAJE INTEGER NOT NULL, ATC_OZNAKA TEXT NOT NULL, NAZIV_POTI_UPORABE TEXT NOT NULL, FOREIGN KEY(NACIONALNA_SIFRA) REFERENCES

ON DELETE CASCADE not working in c#

拈花ヽ惹草 提交于 2020-01-06 12:53:42
问题 When I delete a primary key with ExecuteNonQuery() in C# from the first table it doesn't affect the second table. But when I do the same with SQLiteStudio it does affect the second table. Here is my SQLite code: CREATE TABLE Zdravila( ID INTEGER PRIMARY KEY, NACIONALNA_SIFRA INTEGER UNIQUE NOT NULL, IME_ZDRAVILA TEXT, POIMENOVANJE_IZDELKA TEXT NOT NULL, SIFRA_REZIM_IZDAJE INTEGER NOT NULL, ATC_OZNAKA TEXT NOT NULL, NAZIV_POTI_UPORABE TEXT NOT NULL, FOREIGN KEY(NACIONALNA_SIFRA) REFERENCES

Regex match all url except youtube ones

霸气de小男生 提交于 2020-01-06 08:45:10
问题 I am sure this is a trivial questions for you genii here. I seem to be stuck I have a couple of links to process and I want to convert all links to hyperlinks and youtube links to youtube videos. I have everything working. I just need to figure out how to regex out all links EXCEPT youtube ones. Here is an example of my regex: http://gskinner.com/RegExr/?2u7g4 thanks. Help please. 回答1: I would use the regex: /(http:\/\/)?(www\.)?youtube.com\S*/ to match youtube links. Or did you mean you

Removing extra files after uninstalling a clickonce application

孤街醉人 提交于 2020-01-06 08:42:27
问题 I have a project that uses clickonce to generate the setup.exe. During the run time my program create some extra files like "Log" and "Attachments" inside the User Folder. However, those folders are not removed when I perform an uninstall of the clickonce application from the ARP. These remaining files are interfering the next install. I know that click once does not support for adding custom action to install or uninstall. I am wondering if is there is a way that I can remove those extra

Removing extra files after uninstalling a clickonce application

烂漫一生 提交于 2020-01-06 08:41:34
问题 I have a project that uses clickonce to generate the setup.exe. During the run time my program create some extra files like "Log" and "Attachments" inside the User Folder. However, those folders are not removed when I perform an uninstall of the clickonce application from the ARP. These remaining files are interfering the next install. I know that click once does not support for adding custom action to install or uninstall. I am wondering if is there is a way that I can remove those extra

System.Linq.Queryable is not an attribute class error?

自闭症网瘾萝莉.ら 提交于 2020-01-06 08:33:27
问题 I am getting an error when adding [Queryable] the error is similar like this 'System.Linq.Queryable' is not an attribute class when I tried to add namespace before [System.Web.Http.Queryable] I got another error The type System.Web.Http.QueryableAttribute exists in both System.Web.Http.OData.dll and System.Web.Http.dll How to resolve this? 回答1: As Soner Gönül said. Most probably you have two using directives in your cs file: using System.Web; using System.Web.Http; both define the attribute.

altering QueryString parameters / values

寵の児 提交于 2020-01-06 08:11:38
问题 I would like to better understand the issue of setting new parameters to a url and retrieve it via var ParaValue = Request.QueryString["parameterName"]; so if I have a URL : "http://www.myWebsite.aspx?UserName=Alice" I will retrieve it via example above string uName = Request.QueryString["UserName"].ToString(); but what if I want to alter value e.g. make UserName = "Ralf" Re Edit when a button is pressed , there is a parameter "state" that holds a reference to wich button was pressed the