我正在使用CodeIgniter 2.2.
每次访问页面时,我都必须使用+1更新数据库.代码有效,但每次增加+2.
示例:如果total views=2,单击页面total views应该是3,但数据库中的值是4.
我确信我add_one_to_view_image只在控制器中调用一次模型.
调节器
function view(){
$view_id = $this->uri->segment(3);
if($view_id){
$this->property->add_one_to_view_image($view_id);
$prop['prop_detail'] = $this->property->get_single_property_for_view($view_id);
$prop['prop_imgs'] = $this->property->get_single_property_images($view_id);
$prop['amenities'] = $this->property->get_single_property_amenities($view_id);
$prop['latest'] = $this->home->get_latest_properties();
$size = sizeof($prop['latest']);
for($k=0; $k< $size; $k++){
$Image_name = $this->property->get_property_first_image($prop['latest'][$k]->property_id);
if($Image_name){
$prop['latest'][$k]->image=$Image_name[0]->name;
}else {
$prop['latest'][$k]->image="";
}
}
$this->load->view('property_view', $prop);
}
}
Run Code Online (Sandbox Code Playgroud)
模型
function add_one_to_view_image($id){
echo "We in add one to views";
$this->db->where('property_id', $id);
$this->db->set('views', 'views+1', FALSE);
$this->db->update('property_views');
}
Run Code Online (Sandbox Code Playgroud)
我在模型中添加了一个echo语句.它只打印一次..
视图
<!DOCTYPE html>
<html …Run Code Online (Sandbox Code Playgroud) 我正在开发一个简单的应用程序,它使用https协议从服务器发布和获取数据.我在互联网上搜索但是资源很少,我尝试了大部分资源但是无法成功完成.
我尝试使用HttpClient它是成功的,但我想用HttpsURLconnection来做
我是否需要从设备中获取公共RSA密钥,如果是这样,我该怎么做呢.
有人能告诉我如何才能实现这一目标httpsURLconnection.
protected String doInBackground(String... arg0) {
try {
ByteArrayInputStream derInputStream = new ByteArrayInputStream(app.certificateString.getBytes());
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509","BC");
X509Certificate cert = (X509Certificate) certificateFactory.generateCertificate(derInputStream);
String alias = "alias";//cert.getSubjectX500Principal().getName();
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(null);
trustStore.setCertificateEntry(alias, cert);
KeyManagerFactory kmf = KeyManagerFactory.getInstance("X509");
kmf.init(trustStore, null);
KeyManager[] keyManagers = kmf.getKeyManagers();
TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
tmf.init(trustStore);
TrustManager[] trustManagers = tmf.getTrustManagers();
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagers, trustManagers, null);
URL url = new URL("MY HTTPS URL");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(); …Run Code Online (Sandbox Code Playgroud) 当我尝试编译我的Android项目时,我收到以下错误.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.android.support:appcompat-v7:21.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.jar
Required by:
SriLankaTemples:app:unspecified
Could not find com.android.support:recyclerview-v7:21.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.pom
https://jcenter.bintray.com/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/android/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.jar
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.pom
file:/home/baman/Android/Sdk/extras/google/m2repository/com/android/support/recyclerview-v7/21.0.1/recyclerview-v7-21.0.1.jar
Required by:
SriLankaTemples:app:unspecified
Run Code Online (Sandbox Code Playgroud)
这是我的Gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "lk.lankahomes.baman.srilankatemples"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled …Run Code Online (Sandbox Code Playgroud) android android-appcompat gradle build.gradle android-recyclerview
我创建了一个Recyclerview,包括itemobjects,Adapter,viewholder和activity.
Recyclerview工作正常.
我的问题是当从Recyclerview点击某个项目时,我想将用户定向到TicketDetails活动.
我有代码来获取被点击的项目及其在视图持有者中的位置,但是当我尝试在视图持有者内部创建新活动时
startActivity(new Intent(getActivity(), TicketDetails.class));
Run Code Online (Sandbox Code Playgroud)
我无法解决getActivity()
ViewHolder
public class TicketsRecyclerViewHolders extends RecyclerView.ViewHolder implements View.OnClickListener{
public ImageView priority;
public TextView sts_open;
public TextView sts_overdue;
public TextView tkt_from;
public TextView tkt_subject;
public TextView tkt_assignedto;
public TextView tkt_created_date;
public TextView txt_ticket_id;
private SparseBooleanArray selectedItems = new SparseBooleanArray();
public TicketsRecyclerViewHolders(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
priority = (ImageView) itemView.findViewById(R.id.priority_status_icon);
sts_open= (TextView) itemView.findViewById(R.id.tv_Tk_opn_status);
sts_overdue = (TextView) itemView.findViewById(R.id.tv_Tk_overdue);
tkt_from = (TextView) itemView.findViewById(R.id.tv_Tk_from);
tkt_subject = (TextView) itemView.findViewById(R.id.tv_Tk_subject);
tkt_assignedto = (TextView) itemView.findViewById(R.id.tv_Tk_Assignedto);
tkt_created_date = (TextView) itemView.findViewById(R.id.tv_Tk_Created_date);
txt_ticket_id …Run Code Online (Sandbox Code Playgroud) 您好,我想创建一个包含 20 多个项目的动态 UISegmented 视图。我尝试了一下,但输出是这样的。
文本被切片,不完全可见。我希望它向左和向右滚动并显示全文。有人可以帮我解决这个问题吗?tnx
视图控制器
override func viewDidLoad() {
super.viewDidLoad()
let items = ["All Fruits", "Orange", "Grapes", "Banana", "Mango", "papaya", "coconut", "django"]
let filtersSegment = UISegmentedControl(items: items)
filtersSegment.frame = CGRect.init(x: 10, y: 60, width: 300, height: 50)
filtersSegment.selectedSegmentIndex = 0
filtersSegment.tintColor = UIColor.black
filtersSegment.addTarget(self, action: #selector(self.filterApply), for: UIControlEvents.valueChanged)
self.view.addSubview(filtersSegment)
}
@objc private func filterApply(segment:UISegmentedControl) -> Void {
print("Selected Index : \(segment.selectedSegmentIndex)")
}
Run Code Online (Sandbox Code Playgroud) 我想在codeigniter中使用php上传文件到谷歌驱动器.首先,我正在尝试将google api客户端集成到codiginator.
我已将所有文件上传到我的third_party文件夹中.它看起来像这样
我google.php在我的libraries文件夹中创建了一个文件
google.php文件
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path());
require_once APPPATH . 'third_party/Google/Client.php';
class Google extends Google_Client {
function __construct($params = array()) {
parent::__construct();
}
}
?>
Run Code Online (Sandbox Code Playgroud)
然后我像这样在我的家庭控制器中加载了库
function __construct() {
parent::__construct();
//session, url, satabase is set in auto load in the config
$this->load->model('Home_model', 'home');
$this->load->library('pagination');
$this->load->library('google');
}
Run Code Online (Sandbox Code Playgroud)
加载谷歌库后,家庭控制器内的所有功能都无法正常工作.每件事只显示一个空白页面.
在家庭控制器内部我有一个'test_lib'功能
function test_lib(){
echo $this->google->getLibraryVersion();
}
Run Code Online (Sandbox Code Playgroud)
当我加载页面.我得到一个黑页没有错误或显示.
有人可以帮助我将google api客户端库添加到codeigniter.TNX.
我正在使用 Twilio API 发送和接收来自客户的短信。
每次我的手机短信发送到我的客户,我店像精密组件to,body在我的数据库。
我已经实现了用于发送消息的 API,该 API 工作正常,并且只是将字段保存到我的数据库中。
我的问题
当我收到客户发送到我的 twilio 号码的短信时。我想获得像from number和这样的字段body并保存到我的数据库中。
我看了这里的文档
https://www.twilio.com/docs/api/twiml
但这仅显示了如何在收到消息时向客户发送响应。
我想将收到的短信保存到我的数据库中。
有人可以帮助我得到最高的from number和message body 收到短信时。tnx..
我正在尝试在我的 swift 应用程序中实现 MQTT。我能够连接到 Mqtt 服务器
[3536:248813] [MOSQUITTO] DEBUG Client iOS_test_mqtt sending PINGREQ
[3536:248813] [MOSQUITTO] DEBUG Client iOS_test_mqtt received PINGRESP
Run Code Online (Sandbox Code Playgroud)
我也订阅了主题,这也有效。但我的问题是没有收到从服务器到 VC 的任何消息
应用程序删除
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UINavigationBar.appearance().isTranslucent = true
StartMQTT()
return true
}
func StartMQTT() -> Void {
moscapsule_init()
//set MQTT client configuration
let mqttConfig = MQTTConfig(clientId: "iOS_test_mqtt", host: "192.168.00.00", port: 1883, keepAlive: 60)
mqttConfig.mqttAuthOpts = MQTTAuthOpts(username: "vqsm", password: "test123#")
mqttConfig.onPublishCallback = { messageId in
print("published (msg id=\(messageId)))")
}
mqttConfig.onMessageCallback = …Run Code Online (Sandbox Code Playgroud) 使用jQuery我想在发生点击事件时追加整个div.我试过了,但它不起作用.
当用户点击Add another image我想要将整个div标签附加其所有元素时.
这是我的代码:
<form method="post" id="form_property" enctype="multipart/form-data">
<div class="row">
<div class="span4" id="image">
<h3><strong>4.</strong> <span>Add Images to your Property</span></h3>
<div class="fileupload fileupload-new control-group" data-provides="fileupload">
<label class="control-label" for="inputPropertyPrice">Image files</label>
<div class="input-append">
<div class="uneditable-input"> <i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"></span>
</div> <span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="files1" accept="image/*" />
</span>
</div>
</div>
</div>
<!-- /.span4 -->
</div>
<!-- /.row -->
<br/> <a id="another_image" class="btn btn-primary btn-small list-your-property" href="#">Add Another Image</a>
<br/>
<br/>
<input type="submit" name="submit" …Run Code Online (Sandbox Code Playgroud) 我是目标c和IOS的新手,我正在尝试将一些值发布到网址并尝试获取响应.
但我无法编译我的项目因为,我有这个错误
/ Users/Desktop/MyIOSApps/Chat System/Chat System/SignInVC.m:92:14:'AFHTTPSessionManager'没有可见的@interface声明选择器'POST:parameters:progress:success:failure:'
进口
#import "SignInVC.h"
#import <QuartzCore/QuartzCore.h>
#import "ApplicationEnvironmentURL.h"
#import "Reachability.h"
#import "AFNetworking/AFNetworking.h"
#import "MBProgressHUD/MBProgressHUD.h"
#import "AppDelegate.h"
Run Code Online (Sandbox Code Playgroud)
Objective-c代码
- (void)submitLoginRequest:(NSString *)email password:(NSString *)password {
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setValue:email forKey:@"Email"];
[dict setValue:password forKey:@"Password"];
NSLog(@"Login dicxtionary : %@", dict);
MBProgressHUD *hud;
hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.label.text = @"Please wait. Logging in...";
[hud showAnimated:YES];
// send user login data to hosting via AFHTTP …Run Code Online (Sandbox Code Playgroud) android ×3
ios ×3
php ×3
swift ×2
build.gradle ×1
codeigniter ×1
gradle ×1
html ×1
java ×1
javascript ×1
jquery ×1
mqtt ×1
objective-c ×1
sms-gateway ×1
sockets ×1
twilio ×1
twilio-php ×1