我已经陷入纠结的混乱中.
我试图做一个看起来像这样的查询
$myQuery = 'SELECT col1 , col2 from my_table WHERE col_value LIKE '%$my_string_variable%';
Run Code Online (Sandbox Code Playgroud)
但是这个查询显然会出错.这个的正确语法是什么?我试过弄乱双引号,但这也不起作用.
我要求从桌面鸟类(基本上所有的鸟类)中选择所有值,然后加入另一个跟踪谁喜欢那只鸟的桌子.
所以我希望查询返回所有鸟类,以及人们喜欢那只鸟的记录ID.如果没有人喜欢这只鸟的记录,那么该字段应该为空.
我当前的查询没有得到空值.这里是:
select bird_name, member_id
from birds
right join bird_likes on birds.bird_id = bird_likes.bird_id
where member_id = 2 ;
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能确保bird表中的每一行都显示一次?
谢谢,亚历克斯
我很迷惑.我认为这些都是Google销售或免费提供的托管解决方案.两者有什么区别?
谢谢,亚历克斯
是否有命令查看是否可能安装了RVM?我刚刚完成了RVM的设置过程,并希望对其进行测试.
另外,既然我已经(或者最终会有)RVM,我是否应该再使用apt-get来下载库/ gems并且总是通过RVM做到这一点?
我刚刚完成了RVM安装.
我做了这个命令:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
Run Code Online (Sandbox Code Playgroud)
一切都很好.然后在我的用户主目录中,在.bash_profile中我添加了
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Run Code Online (Sandbox Code Playgroud)
然后我开始一个新的shell只是为了确定.然后我试了一下
rvm
Run Code Online (Sandbox Code Playgroud)
并得到了错误
No command 'rvm' found
Run Code Online (Sandbox Code Playgroud)
任何想法为什么会发生?
我刚刚执行此命令来安装Rails:
gem install rails
Run Code Online (Sandbox Code Playgroud)
它似乎运行良好并安装了东西.
然后,当我按照本教程:http://guides.rubyonrails.org/getting_started.html它说要执行此命令:
rails new blog
Run Code Online (Sandbox Code Playgroud)
我做了什么,它给了我这个错误:
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Run Code Online (Sandbox Code Playgroud)
知道为什么会这样吗?我认为rails应该自动开始工作:)
我做了这个命令:
rvm gemdir
Run Code Online (Sandbox Code Playgroud)
它给了我这个结果:
RubyGems Environment:
- RUBYGEMS VERSION: 1.6.2
- RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [i686-linux]
- INSTALLATION DIRECTORY: /home/agenadinik/.rvm/gems/ruby-1.9.2-p180
- RUBY EXECUTABLE: /home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
- EXECUTABLE DIRECTORY: /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/agenadinik/.rvm/gems/ruby-1.9.2-p180
- /home/agenadinik/.rvm/gems/ruby-1.9.2-p180@global
Run Code Online (Sandbox Code Playgroud)
应该是这样的:
EXECUTABLE DIRECTORY: /usr/bin
Run Code Online (Sandbox Code Playgroud) 我有点奇怪的问题.当一个活动开始时,我会显示一个对话框,说明某些项目正在加载如下:
Dialog dialog;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.topic_edit);
dialog = new Dialog (this);
dialog.setContentView(R.layout.please_wait);
dialog.setTitle("Loading The Comment.");
TextView text = (TextView) dialog.findViewById(R.id.please_wait_text);
text.setText("Please wait while the comment loads...");
dialog.show();
Run Code Online (Sandbox Code Playgroud)
我在类声明之前声明了Dialog对话框,然后每当我尝试用dialog.dismiss();它关闭它时它都不会关闭.
这是please_wait.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/please_wait_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
有人会知道为什么对话框没有关闭dialog.dismiss()...我在调用返回后尝试在异步调用中解除.但是我做了检查,并且dialog.dismiss()执行了该行,仅仅由于某种原因没有关闭对话框.
这是我尝试解除对话框的方式:
@Override
protected void onPostExecute(String result)
{
dialog.dismiss();
}
Run Code Online (Sandbox Code Playgroud) 我有一些代码在98%的时间内工作,100%在我自己的测试中,所以除了让用户设备遇到这个问题之外,我无法真正重现问题.
我在onPostExecute()中做的是设置一个这样的参数:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences( AddProblemActivity.this);
prefs.edit().putString("recent_problem_id", result ).commit();
Run Code Online (Sandbox Code Playgroud)
然后转到下一个活动:
Intent myIntent = new Intent(AddProblemActivity.this, ProblemActivity.class);
AddProblemActivity.this.startActivity(myIntent);
Run Code Online (Sandbox Code Playgroud)
然后尝试像这样获取该参数:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(
ProblemActivity.this);
// display a loading message before problem loads.
String recent_problem_id = prefs.getString( "recent_problem_id" , null );
if ( recent_problem_id == null )
{
// Sometimes it is null!
}
Run Code Online (Sandbox Code Playgroud)
谁会知道为什么会这样?
谢谢!
我有这个命令,用户在点击webview中的链接后仍然保持用户在应用程序内部.但我失去了它,似乎无法找到它是什么.
有人可以提醒我这个命令是什么吗?谢谢!
这是我的代码:
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
WebView webview = new WebView(this);
webview.getSettings().setAppCacheEnabled(false);
webview.getSettings().setJavaScriptEnabled(true);
webview.setInitialScale(1);
webview.getSettings().setPluginState(PluginState.ON);
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setAllowContentAccess(true);
webSettings.setEnableSmoothTransition(true);
webSettings.setLoadsImagesAutomatically(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setSupportZoom(true);
webSettings.setUseWideViewPort(true);
setContentView(webview);
webview.loadUrl("http://www.stitcher.com/podcast/entrepreneuronfirecom/entrepreneur-on-fire-tim-ferriss-other-incredible-entrepreneurs");
Run Code Online (Sandbox Code Playgroud) 我认为类似按钮应该显示每页的许多喜欢,而不是每个网站.我对么?
我在我的网站http://www.hikingsanfrancisco.com上放了类似按钮,如果您查看网站的不同页面,它们都会显示相同数量的喜欢,就像它是整个网站的通用号码一样.
我喜欢按钮代码在标题div中,我怀疑重复可能因此而发生.
任何想法/想法?
谢谢!