I use HttpClient.GetAsync() method. I have a list of categories and want to pass it in query string. var categories = new List<int>() {1,2}; How can I pass List<int>/List<string> in query string? For example, https://example.com/api?categories=1,2 Of course, can use foreach and StringBuilder. But maybe there is a better way to do this? For example, work with .PostAsync() and json content very convenient: var categories = new List<int>() {1,2}; //init List var parametrs = new Dictionary<string, object>(); parametrs.Add("categories", categories); string jsonParams = JsonConvert.SerializeObject(p
Maybe I am using the wrong words to search google for this. But all i come up with is how to use .Net and C# on how to write a webservice. I know there is New-WebServiceProxy but I really would like to offer a service not consume it. There reason I would like to use PowerShell is because I would like to progress as quickly as possible and it's the language i am currently most familiar with. Also the WebService should only offer very basic functions. Any input on this? Thanks in advance
With a simple dictionary like: myDict = {'key1':1, 'key2':2} I can safely use: print myDict.get('key3') and even while 'key3' is not existent no errors will be thrown since .get() still returns None. Now how would I achieve the same simplicity with a nested keys dictionary: myDict={} myDict['key1'] = {'attr1':1,'attr2':2} The following will give a KeyError: print myDict.get('key1')['attr3'] This will go through: print myDict.get('key1').get('attr3') but it will fail with adn AttributeError: 'NoneType' object has no attribute 'get': print myDict.get('key3').get('attr1')
This is my first time trying to use the WEB API in a project and am not having any success with it... I keep getting 404 errors when I try and reach my api route in Fiddler. I tried looking a lot on the web and even here at the following link, but there are so many combinations, that I'm not sure what would work. HTTP 404 Page Not Found in Web Api hosted in IIS 7.5 If somebody can please help me with this to get the right settings I would really appreciate it. Here is my code: Web.config file: <?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET app
Need your help in Selenium Webdriver coding with Java. I have a scenario, where I create a Course name and submit it to the database and then later I need to search for the Course by the name I created it. Simply the work flow would be; 1. Type the course name in text box (Here I'm randomly generating a string so it's not hard coded, I need to retrieve exactly what I typed here) 2. Store the typed name 3. In the search box type that name private void createCurriculum() throws InterruptedException { selenium.open("http://url.com"); driver.findElement(By.id("Text1")).clear(); driver.findElement(
I am new to this stuff but I love it. I made a little REST Api using the Slim Framework. Now I would like to have an ongoing documentation about it. I think swagger is the right choice but I have not found out yet how to integrate it ? Cheers & thanks for your patience :)
Usually when we use input placeholder, the placeholder text will disappear as soon as the user type something. I'm thinking to give user an random example on input so user can mimic using placeholder. The problem is that, when user type something, the example will disappear. Is there any way to keep the placeholder visible when user type the beginning part of the placeholder text? Here's an example The placeholder text is 'Lorem ipsum dolor sit amet'. When user types 'Lorem ipsum', I assume that user will try to type the example so the text will still be visible. But when user types something
Just like the title above: how to concatenate two strings in JQuery? This is my code so far: $(document).ready(function(){ serviceName = '<?=$_GET['services'] . ".php";?>'; serviceID='<?= "#" .$_GET['services'];?>'; serviceClass = '<?=$_GET['services'];?>'; if (serviceName != "") { alert(serviceID); $('.main_content').load(serviceName); $(serviceID).addClass("it"); } }); As you can see in my above code, in variable name serviceID, I am concatenating hashtag and my GET value and I try to put it on ALERT and the result is correct, but when I assign it to .addClass it’s not working. Any alternati
I'm trying to integrate liquibase with our application. I'm executing it using Maven integration approach. When I execute, I see that creation script for databasechangelog invoked twice and get "Table already exist" error. Below are the statements from console. I'm using liquibase-core-3.1.1 jar. INFO 2014-04-28 06:49:liquibase: Successfully acquired change log lock INFO 2014-04-28 06:49:liquibase: Creating database history table with name: databasechangelog INFO 2014-04-28 06:49:liquibase: ChangeSet src/main/resources/sql/postGre/db.changelog-2.0.xml::1::fms ran successfully in 555ms INFO 201
Here is a brief description of what I am doing. The application has the form elements in JSP which redirects to the Controller class after pressing submit. The controller calls the service layer which in turn calls DAO and finally adds the records to the data base. The issue I am having is that in the Controller class, I can receive the request parameters (POST) but the thing is that there is an issue while calling the addStudent() of the service layer. The issue is with the Null Pointer Exception on object. Could you guys review the code and provide me suggestions? Here is the full Stacktrace
I am working on an Android app which needs a camera view in half of the app screen.I was able to do it successfully for an Android 4.0 device but it crashes when I try to run it on my Nexus One,although the minSDK version has been set to 2.2.Here's my camera preview class. package com.example.locationtest; import java.io.IOException; import android.content.Context; import android.hardware.Camera; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback { private static final Str
I've been struggling with this for the last couple of days, I'm trying to get an editable grid view system in asp.net using the fallowing tutorial: Editable Grid View System using BootStrap in ASP.Net I want to be able click "add new record" and the pop up modal should display and let me add a new record, the issue that I'm having is that whenever I clicked on "add new record" the <div class="modal-backdrop fade in"></div> seems to be covering everything. Here are some pictures describing the problem. Before I clicked: And after I clicked: I can't seem to find what's causing this. Please take
Consider the following assembly code: MOV [EAX], EBX [EAX] is memory and EBX is a register (in x86 Intel syntax). What is the difference between [EAX] and EBX? What will happen in the instruction above?
I am using Casperjs 1.1.0-beta3 and trying to fill a form by an 'id' selector. I have successfully have used "input[name='userID']" but using an 'id' as a selector always fails with an error similar to the below. CasperError: Errors encountered while filling form: no field matching css selector "#header-my-account-userid" in form; no field matching css selector "#header-my-account-password" in form Method 1 works fine. Method 2, 3, 4 all fail. I ONLY TRY ONE METHOD AT A TIME AND COMMENT THE OTHERS OUT. I also cut the extra form tags out for this question. I found this stackoverflow question on
I am searching for a simple command to see logged on users on server. I know this one : Get-WmiObject -Class win32_computersystem but this will not provide me the info I need. It returns : domain Manufactureer Model Name (Machine name) PrimaryOwnerName TotalPhysicalMemory I run Powershell 3.0 on a Windows 2012 server. Also Get-WmiObject Win32_LoggedOnUser -ComputerName $Computer | Select Antecedent -Unique gives me not the exact answers I need. I would love to see as well the idle time, or if they are active or away.
I'm new to magento. I've been trying to change from a 3 products per row layout to a 4 products per row layout. I've been searching but I can't find any solution. Here's my closest approach: I changed "app/design/frontend/default/mytemplate/template/catalog/product/list.phtml" and set '$_columnCount=4'. The problem is that I still receive 9 products each time, so I get 2 rows with 4 products each but the last one only has 1 product. Any help would be appreciated. Thanks in advance.
I have a query to search keywords using like, but I also want to search full text so I changed it to full text search query, but it doesn't work. The old query that's working fine: $data = $this->db ->select('content.title,content.id,content.category,content.body,path') ->from('content') ->join('categories','content.category = categories.id') ->like('content.title', $searchterm) ->like('content.body', $searchterm) ->order_by("content.id","DESC") ->get(); and this is my new query for full text search: $data = $this->db ->select('content.title,content.id,content.category,content.body,path') ->fr
I am developing ASP.net application which consumes REST services with ASP.Net Web API. I am trying to use Basic authentication for my website. I plan to use it with SSL once I complete Basic authentication. Currently on Login button click I am sending Auth header using Base64 encoding of username and password as shown below: string responseData = string.Empty; string authToken = string.Empty; string loginInstance = url; // Create request. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(loginInstance); request.Method = "POST"; request.ContentType = "application/json"; request.CookieC
I have some problems with sencha touch. I have this simple code : items: [ { name: "horo", xtype: 'togglefield', label: 'Horodateur ?', labelWidth: '55%', disabled: false, listeners: { beforechange: function (slider, thumb, newValue, oldValue) { if (oldValue == 0 && newValue == 1) { alert("toto"); } }, change: function (slider, thumb, newValue, oldValue) { if (oldValue == 0 && newValue == 1) { alert("titi"); } else if (oldValue == 1 && newValue == 0) alert("tata"); } } }, And I have this error on my console : Uncaught TypeError: Cannot read property 'apply' of undefined. What's the problem ? M
In R I want to merge two dataframes on a range of dates, taking all rows from the second dataframe which fall on and between two columns of dates from the first dataframe. I couldn't find a strictly R function or version of the merge function that could do this, but I know there's a 'between' function in sql and I was thinking of trying the sqldf package (although I'm not well versed in sql). If there's a more R-ish way to do this, that would be preferable. Thank you in advance for your help! df1 <- structure(list(ID = 1:2, PtID = structure(c(1L, 1L), .Label = c("T031", "T040", "T045", "T064",
To prevent CSRF below were the steps i have followed: 1. First time when request comes(to loginfilter) session is null, create a session add token(randome number) to this new session by using setAttribute() and redirect to login.jsp screen using dispatcher.forward. 2. in login.jsp screen use getAttribute() store the token in the hidden filed. 3. on submit of login.jsp first request will come to loginfilter, here compare the token from the request with the token in the session, if matches then proceed with executing the action class. otherwise generate the new token for the same session and red
I want to copy some files from one folder to other folder and before copying or replacing the files I want to take backup from destination folder only those file which are I am trying to copy in to source file to destination file. This is what I want to do but is this possible in pure C-language?.
I am new to yum but I did RTFM and grepped all the available information and I still don't understand something basic. I have some foobar.repo file that yum uses that looks like this: [foobar] name=foobar baseurl=http://server/RPMS enabled=1 This works - I can do yum update foobar and it updates. But now I mv the directory RPMS to RPMS1 and I make the corresponding change in the foobar.repo file. Now surprisingly, update does not work anymore, it says that the file http://server/RPMS1/repodata/repomd.xml is not found. That is not the case, the file is there in the new directoryRPMS1 on the sam
I am developing an c# application in which I need to fetch data from oracle database server. In my application I do not want to make a hard coded connection string because sometimes we have to connect it with different DB (for testing purpose it has same schema). For this I have a plan that I create an xml file and a new form(with admin rights) using this form I update/insert database credentials in xml file or use app.config, but the problem is i don't have any idea how to read and write xml file in predefined manner (in same manner as a connection string should be). Can you please help me ou
I'm trying to recover from a PCA done with scikit-learn, which features are selected as relevant. A classic example with the Iris data set: import pandas as pd import pylab as pl from sklearn import datasets from sklearn.decomposition import PCA # Load data set iris = datasets.load_iris() df = pd.DataFrame(iris.data, columns=iris.feature_names) # Normalize data df_norm = (df - df.mean()) / df.std() # PCA pca = PCA(n_components=2) pca.fit_transform(df_norm.values) print pca.explained_variance_ratio_ This returns In [42]: pca.explained_variance_ratio_ Out[42]: array([ 0.72770452, 0.23030523]) Ho
I'm trying to recover from a PCA done with scikit-learn, which features are selected as relevant. A classic example with the Iris data set. import pandas as pd import pylab as pl from sklearn import datasets from sklearn.decomposition import PCA # Load data set iris = datasets.load_iris() df = pd.DataFrame(iris.data, columns=iris.feature_names) # Normalize data df_norm = (df - df.mean()) / df.std() # PCA pca = PCA(n_components=2) pca.fit_transform(df_norm.values) print pca.explained_variance_ratio_ This returns In [42]: pca.explained_variance_ratio_ Out[42]: array([ 0.72770452, 0.23030523]) Ho
I've created a table that has two columns: both varchars for numbers. My text file also has two columns, separated by commas. Here's the command I'm using (italics used to distinguish from syntax): COPY *table_name* FROM '*/C:/Users/username/Desktop/filename.txt*' DELIMITER ',' CSV; I'm getting this error: ERROR: "COPY FROM 'filename'..." not currently supported Everywhere I read says that I need to use the COPY FROM command, yet the error says it's not supported. I've tried changing forward slashes to backslashes and double backslashes as well.
I need to send the values to this pop up. this is open with in the same window. when am trying with the normal driver.findelement, its getting error message saying xpath cannot found This is my code import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class Homepage_login { public static void main(String[] args) { // TODO Auto-generated method stub FirefoxDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //driver.get("http://se.rdms
im trying to do a heap bottom up construction from Psuedo code from my text book however the output im getting is not a correct heap im getting out 2 9 8 6 5 7 anyone know where im going wrong(pseudo code is from a text book, and heap needs to be array) here is the PsuedoCode bottom up im working with //constructs a heap from elements of a given array by bottom up algorithm //input an array H[1...n] of orderable items //output a heap H[1...n] for i<- [n/2] downto 1 do k<-i; v<-H[k]; heap<-False while not heap and 2*k <= n do j<-2*k if(j<n) //there are two children if H[j] < H[j+1] j<- j+1 if v