我有一个受保护的目录,只有.htpasswd上的用户才能访问,但有时它需要用户更改密码或用户名,编辑一个特定的用户名密码到他的用户名他自己
sample users
kevien : kka
mike : mike
Run Code Online (Sandbox Code Playgroud)
而且我想说我想将kevien改为XYZ
密码同样如此
以下是我在HTML代码中的选项:
<label id="subn">
<select name="subs" id="subs">
<option value="nothing">Choose a Subject</option>
<option value="General Question">General Question</option>
<option value="MemberShip Area">MemberShip Area</option>
<option value="Others">Others</option>
</select>
</label>
Run Code Online (Sandbox Code Playgroud)
我想创建JavaScript代码,检查用户是否选择了第一个以外的选项.
这是我尝试过的:
if (document.getElementsByTagName('option') == "nothing"){
document.getElementById("subn").innerHTML = "Subject is Required!";
document.getElementById("subs").focus();
return false;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试安装JDBC,但我不知道如何,当你只有jar文件时,我将它复制到我的java ext文件夹,但它一直给我一个错误,谁能告诉我如何完成安装驱动程序并使用它?
下面是我使用的代码
import java.sql.*;
public class Test1
{
public static void main (String[] args)
{
String url = "jdbc:mysql://localhost:3306/sabayafr_sabmah";
String username = "root";
String password = "ma";
Connection connection = null;
try {
System.out.println("Connecting database...");
connection = DriverManager.getConnection(url, username, password);
System.out.println("Database connected!");
} catch (SQLException e) {
System.err.println("Cannot connect the database!");
e.printStackTrace();
} finally {
System.out.println("Closing the connection.");
if (connection != null) try { connection.close(); } catch (SQLException ignore) {}
}
}
}
Run Code Online (Sandbox Code Playgroud)
以下是我得到的回应
Cannot connect to database server …Run Code Online (Sandbox Code Playgroud) 使用下面的代码解码json
$categories = json_decode($data);
$categories = $categories->data;
Run Code Online (Sandbox Code Playgroud)
我得到了这个
{"categories":[{"id":1,"name":"Utilities","apps":897,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/uti.jpg"},{"id":2,"name":"Productivity","apps":477,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/pro.jpg"},{"id":3,"name":"Music","apps":466,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/mus.jpg"},{"id":4,"name":"Travel","apps":289,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/tra.jpg"},{"id":5,"name":"Navigation","apps":297,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/nav.jpg"},{"id":6,"name":"Books","apps":271,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/boo.jpg"},{"id":7,"name":"Healthcare & Fitness","apps":250,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/hea.jpg"},{"id":8,"name":"Games","apps":5116,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/gam.jpg"},{"id":9,"name":"Social Networking","apps":272,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/soc.jpg"},{"id":10,"name":"Lifestyle","apps":434,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/lif.jpg"},{"id":11,"name":"Finance","apps":200,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/fin.jpg"},{"id":12,"name":"News","apps":128,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/new.jpg"},{"id":13,"name":"Photography","apps":481,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/pho.jpg"},{"id":14,"name":"Entertainment","apps":1251,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/ent.jpg"},{"id":15,"name":"Business","apps":221,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/bus.jpg"},{"id":16,"name":"Sports","apps":199,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/spo.jpg"},{"id":17,"name":"Education","apps":433,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/edu.jpg"},{"id":18,"name":"Medical","apps":262,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/med.jpg"},{"id":19,"name":"Weather","apps":64,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/wea.jpg"},{"id":20,"name":"Reference","apps":419,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/ref.jpg"}]}
Run Code Online (Sandbox Code Playgroud)
我想转换成这样的数组
Array[0]
{
id => 1
name => Utilities
apps => 897
iconurl => http:\/\/static.apptrackr.org\/caticons\/uti.jpg
}
Run Code Online (Sandbox Code Playgroud)
等等
我已经构建了一个NSMutableArray,这是一个例子
({Account = A; Type = Electricity;},{Account = B; Type = Water;},{Account = C; Type = Mobile;})
当我尝试使用删除帐户B.
[data removeObject:@"B"];
什么都没发生
[[NSUserDefaults standardUserDefaults] synchronize];
NSArray *archivedArray = [NSKeyedUnarchiver unarchiveObjectWithFile:[self dataFilePath]];
if (archivedArray == nil) {
data = [[NSMutableArray alloc] init];
} else {
data = [[NSMutableArray alloc] initWithArray:archivedArray];
}
Run Code Online (Sandbox Code Playgroud) 我有一个NSMutableArray,其结构如下:
{
{
AccountNumber:Test1
Type: Electricity
}
{
AccountNumber:Test2
Type: Water
}
{
AccountNumber:Test3
Type: Water
}
}
Run Code Online (Sandbox Code Playgroud)
如何打印出Water类型的帐号?
我试过的如下:
- (NSUInteger)indexOfObjectIdenticalTo:(id)data{ return data; }
Run Code Online (Sandbox Code Playgroud)
但我不明白该怎么做.
我有这个NSMutableArray
sections = [[NSMutableArray alloc] init];
[sections addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Electricity",@"Type",@"0",@"Count", nil]];
[sections addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Water",@"Type",@"0",@"Count", nil]];
[sections addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Mobile",@"Type",@"0",@"Count", nil]];
[sections addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Internet",@"Type",@"0",@"Count", nil]];
[sections addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Fixed Line",@"Type",@"0",@"Count", nil]];
Run Code Online (Sandbox Code Playgroud)
并且让我们说用户选择将水数从0改为10如何做到这一点?
ios ×3
objective-c ×3
xcode ×3
iphone ×2
.htaccess ×1
apache ×1
arrays ×1
html ×1
html-select ×1
java ×1
javascript ×1
jdbc ×1
object ×1
php ×1