我正在研究MVC3 asp.net.这是我在控制器中的sr = tatement: -
ViewBag.rawMaterialRequired = (from x in db.RawMaterial
join y in db.ProductFormulation on x.ID equals y.RawMaterialID
where y.ProductID == p select new { x.Description, y.Quantity });
Run Code Online (Sandbox Code Playgroud)
这是我在View中的代码: -
@foreach(var album in ViewBag.rawMaterialRequired)
{
@album<br />
}
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的输出: -
{ Description = Polymer 26500, Quantity = 10 }
{ Description = Polymer LD-M50, Quantity = 10 }
{ Description = Titanium R-104, Quantity = 20 }
Run Code Online (Sandbox Code Playgroud)
这是我想要的输出: -
我正在使用android,我想在运行时制作水平滚动视图,意味着我想通过java代码制作这个水平视图.
这是我的java类代码
package com.pericent;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;
public class HelloTabWidget extends TabActivity {
private String TAG="HelloTabWidget";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
for(int i=0;i<10;i++)
{
// Create an Intent to launch an Activity for the …
Run Code Online (Sandbox Code Playgroud) 我正在研究android.我想从服务器访问该文件.如果我这样写我的网址:
URL sourceUrl = new URL("http://192.168.1.214/MusicApplication/searchsongxml.php?");
Run Code Online (Sandbox Code Playgroud)
然后它正常工作.
但是如果我在strings.xml中声明服务器名称,如下所示:
<resources>
<string name="SERVER_NAME">http://192.168.1.214/</string>
</resources>
Run Code Online (Sandbox Code Playgroud)
并尝试访问这样的网址:
URL sourceUrl = new (getString(R.string.SERVER_NAME)+"MusicApplication/searchsongxml.php");
Run Code Online (Sandbox Code Playgroud)
然后这会创建一个异常,我的应用程序停止.
请告诉我我做了什么错.
我在android工作.我的项目有两个活动.我在一个活动中声明了一个公共静态变量,如下所示:
public static String name="KUNTAL";
Run Code Online (Sandbox Code Playgroud)
在我的第二个活动中,我试图使用此变量,然后生成此名称变量不存在的错误.
如果它被声明为公共,我可以在我的项目中的任何地方使用变量吗?
请告诉我我做了什么错误.
先感谢您...
我在android工作.我想在我的活动中显示简单的谷歌地图.
这是我的main.xml
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="mykey"
/>
Run Code Online (Sandbox Code Playgroud)
这是我的活动: -
package com.quepplin;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapView;
public class GooglemapActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mMapView;
mMapView = (MapView) findViewById(R.id.mapview);
mMapView.setBuiltInZoomControls(true);
}
Run Code Online (Sandbox Code Playgroud)
}
我已成功创建了Google密钥.但每当我运行我的应用程序然后它崩溃.并在logcat中显示以下错误: -
java.lang.RuntimeException: Unable to start activity
android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.maps.MapView
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.maps.MapView
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
Run Code Online (Sandbox Code Playgroud)
请帮我解决我做错了什么.我是一个非常新的创建谷歌地图.我在等待建议.
先感谢您.
我在php工作.
我想找出与地理纬度和经度相距给定距离的地方.
我在一个名为places的mysql数据库中有一个表,其中有三列placeId
,latitude
和longitude
.
用户提供latitude
,longitude
一个地方的和distance
,然后通过使用下面的公式:
d = 2*asin(sqrt((sin((lat1-lat2)/ 2))^ 2 + cos(lat1)cos(lat2)(sin((lon1-lon2)/ 2))^ 2));
我可以检查这些地方是否与用户给出的距离有关.
我想知道如何编写查询和函数来实现此功能.