Integrating OpenFeint with Cocos2D-iPhone Applications
OpenFeint is a service that enables your iPhone/iPod Touch application the ability to provide online score tracking. The service is free and can easily be incorporated into your applications. This tutorial will cover the integration of OpenFeint 2.4.3 with the Cocos2D-iPhone framework. Before getting started, it is assumed that you already have familiarity with:
Objective-C
XCode
Cocos2D-iPhone framework
The expectation is that you already have a working Cocos2D based application to which you’d like to enable leaderboard functionality. If you’re new to Cocos2D-iPhone, then you should visit http://www.cocos2d-iphone.org/ to review the available documentation and download the latest framework. You do not have to be a seasoned veteran to use Cocos2D, and the framework makes it very easy to create high quality games. At the time of this writing, version 8.2 of the Cocos2D-iPhone framework was the most stable version, and hence it provides the basis for this tutorial.
There are several features available within OpenFeint in terms of score and event management. Beyond just tracking high scores, the developer can establish goals such that the player can earn achievements or even initiate online challenges. For this tutorial, the focus will be to simply enable an online leaderboard. The player will be able to track their own progress as well as compare their scores against other players via a global leaderboard.
There is also the ability to enable a chat function between players. While I have not tried it, I have been told by other developers that by enabling this feature you’re required to assign a mature rating. The mentality is that unrestricted chat within a game could expose minors to unscrupulous users and content.
Specifically, the OpenFeint capabilities consist of the following features:
Access to the OpenFeint code is done through the OpenFeint developer portal, and there is no charge to enroll in the developer program. Visit http://www.openfeint.com// to sign-up for access.
Once authenticated with the portal, you’ll have access to the developer home page and will be able to download the OpenFeint SDK.
When enabling an application to use the OpenFeint service, you register it within the developer portal. Selecting the green plus button at the top of the page allows you to start this process. In this example we’ll add a test application, My Crazy App, so that you can see the various screens. Yet, the specific code examples shown later on will reflect the integration process with one of my OpenFeint enabled games, Balloon-Boy.
The following screen capture shows the entry of the application details to register the application.
After selecting submit, the application is given a Client Application ID, Product Key, and Product Secret. As we’ll later see, these values are needed when initializing OpenFeint within our application. Keep them handy as we’ll need them when it comes time to add the respective OpenFeint code to the application.
The following shows a closer look at the application’s specific product key and secret. They are unique for each registered application and are used to identify the specific application when communicating with the OpenFeint servers.
The following shows the creation of the game’s leaderboard. It’s a straight forward process initiated by selecting ‘Basic Features’ and then Leaderboards.
After selecting submit, we see that our leaderboard has been created. It is important to note the leaderboard ID as we’ll need this value later on when attempting to post user’s scores to the board. The value identifies the specific leaderboard and is a required element for the code that is executed when we initiate onlinescore updates.
Now that we’ve enrolled in the OpenFeint program, downloaded the SDK, and created an entry for our application, it is time to start the integrating process within our Cocos2D-iPhone application.
There are some preliminary steps before inclusion of code within your class files. If you’re upgrading from a prior version, the process is relatively straight forward. You simply delete the old OpenFeint folder from your XCode project and need to ensure that you add some additional frameworks, which will be detailed in the following section. Note: it is also important that you go into your project’s directory and also delete both the OpenFeint and build directories.
Let’s review the the OpenFeint README.txt for information on integration of the application.
If you’ve downloaded and extracted the OpenFeint SDK, you’re ready to begin the process. For step 4 of the README file, we’re to drop the unzipped OpenFeint folder into our XCode project. And since the game is landscape only, we’ll remove the Portrait folder found under the Resources directory as suggested for step 5. The following shows the inclusion of the OpenFeint folder within our XCode project.
Continuing on with Step 6, we right click on our project icon within XCode and select Get Info. In looking at the build tab, we added the Linker Flags the value -ObjC as well as selected ‘Call C++ Default Ctors/Dtors in Objective-C’. These are shown in the following screen capture.
For step 7, the README.txt notes the following frameworks that must be included within the project. And if you’re like me, I can never remember the all too convenient path so here it is for reference. Right click on frameworks and add existing framework. Navigate to:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulatorx.y.z.sdk/System/Library/Frameworks/
Here are the frameworks you’ll need to ensure you’ve included in your XCode project.
Foundation
UIKit
CoreGraphics
QuartzCore
Security
SystemConfiguration
libsql3.0.dylib (located in (iPhoneSDK Folder)/usr/lib/)
CFNetwork
CoreLocation
MapKit (if building with SDK 3.0 or newer)
And here we see the frameworks that have been added to the XCode project.
For the latest release of OpenFeint, if you have set your ‘iPhoneOS Deployment Target’ to any version before 3.0 you must weak link some libraries. Select ‘Targets’ in the Groups & Files pane.
Right click your target and select Get Info.
Select the ‘General’ tab.
Under ‘Linked Libraries’ change the following libraries from ‘Required’ to ‘Weak’
UIKit
MapKit
For my project I’m not building for lesser versions, which from what I’ve heard though does exclude a sizable base of users.
Finally, in step 9 of the README.txt, we need to add the following line to our prefix header:
view source
print ?
1
#import "OpenFeintPrefix.pch"
The following screen capture shows the quick update of the project’s prefix header.
At this point we now have the SDK integrated within our XCode project along with some necessary support requirements. Again, this tutorial covers the specific integration of OpenFeint with a Cocs2D-iPhone v8.2 based application. As with most application architectures, there will be various class files such as the application delegate, game scene, and menu scene.
Let’s now add the required OpenFeint code to our project’s AppDelegate.
Within the AppDelegate’s main file we’ll add various code elements ranging from importing other class headers to specific code needed within existing methods. For example, there’s specific OpenFeint code that should be added to applicationWillResignActive, applicationDidBecomeActive, and applicationWillTerminate. These methods can already be found in your Cocos2D application delegate, and we’ll be adding a line here or there to support integration with OpenFeint. The OpenFeint developer documentation details these requirements as it’s expected that you’re taking action based upon the application’s state, such as it shutting down.
Add the following import statements to your AppDelegate’s main file:
view source
print ?
1
#import "OpenFeint.h"
2
#import "SampleOFDelegate.h"
Now locate the respective methods within your AppDelegate’s main file, and add the lines identified for OpenFeint.
view source
print ?
01
- (void)applicationWillResignActive:(UIApplication *)application {
02
[[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
03
[[Director sharedDirector] pause];
04
[OpenFeint applicationWillResignActive]; // Add for OpenFeint
05
}
06
07
- (void)applicationDidBecomeActive:(UIApplication *)application {
08
[[Director sharedDirector] resume];
09
[OpenFeint applicationDidBecomeActive]; // Add for OpenFeint
10
}
11
- (void)applicationWillTerminate:(UIApplication *)application {
12
[[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
13
[[Director sharedDirector] end];
14
[[NSUserDefaults standardUserDefaults] synchronize]; // Add for OpenFeint
15
}
Next we’ll create a class that will handle some crucial tasks whenever we call the OpenFeint leaderboard. At the time, I had based this on the included SampleOFDelegate files. Pay particular attention to the dashboardDidAppear and dashboardDidDisappear methods. You’ll see that we’re momentarily pausing the Cocos2D director and then re-enabling it once the dashboard disappears. This is a critical step cause otherwise it’s possible that input will be inconsistent or even not captured when the dashboard is displayed. But by pausing the director, we’re ensured that all user input is captured by the dashboard.
Create the following files within your XCode project.
SampleOFDelegate.h
view source
print ?
01
//
02
// SampleOFDelegate.h
03
// Balloon-Boy
04
//
05
// Created by Tim Sills on 12/4/09.
06
//
07
#import "OpenFeintDelegate.h"
08
@interface SampleOFDelegate : NSObject< OpenFeintDelegate >
09
- (void)dashboardWillAppear;
10
- (void)dashboardDidAppear;
11
- (void)dashboardWillDisappear;
12
- (void)dashboardDidDisappear;
13
- (void)userLoggedIn:(NSString*)userId;
14
- (BOOL)showCustomOpenFeintApprovalScreen;
15
@end
SampleOFDelegate.m
view source
print ?
01
// SampleOFDelegate.m
02
// Balloon-Boy
03
//
04
// Created by Tim Sills on 12/4/09.
05
//
06
#import "OpenFeint.h"
07
#import "SampleOFDelegate.h"
08
#import "cocos2d.h"
09
@implementation SampleOFDelegate
10
11
- (void)dashboardWillAppear
12
{
13
}
14
15
- (void)dashboardDidAppear
16
{
17
[[Director sharedDirector] pause];
18
[[Director sharedDirector] stopAnimation];
19
}
20
21
- (void)dashboardWillDisappear
22
{
23
}
24
25
- (void)dashboardDidDisappear
26
{
27
[[Director sharedDirector] resume];
28
[[Director sharedDirector] startAnimation];
29
}
30
31
- (void)userLoggedIn:(NSString*)userId
32
{
33
OFLog(@"New user logged in! Hello %@", [OpenFeint lastLoggedInUserName]);
34
}
35
36
- (BOOL)showCustomOpenFeintApprovalScreen
37
{
38
return NO;
39
}
40
41
@end
For my particular Cocos2D application, I have a splash scene that quickly shows the company logo, the Cocos2D logo, and then transitions to the game’s main menu. I initialize OpenFeint during this process just before loading the main menu. With that said, the header file for the splash scene class has the following code. We’re including the SampleOFDelegate class as well as declaring the ofDelegate variable. I’ve streamlined the content to only include the references to the OpenFeint code. I’ve left the reference to the menuScene method though as that’s where I perform the initialization.
view source
print ?
01
// SplashScene.h
02
// Balloon-Boy
03
//
04
// Created by Tim Sills on 12/1/09.
05
//
06
#import
07
#import "cocos2d.h"
08
@class SampleOFDelegate; // Add for OpenFeint
09
@interface SplashScene : Scene {
10
SampleOFDelegate *ofDelegate; // Add for OpenFeint
11
}
12
-(void)menuScene;
13
@end
For the main file of the splash scene class, we import the following header files:
view source
print ?
1
#import "OpenFeint.h"
2
#import "SampleOFDelegate.h"
Within my method that is called before transitioning to the main menu (menuScene), I initialize OpenFeint. It is here where we can set the orientation, disable chat, and provide our application specific values such as the product key. You might recall that these were provided when first registering the application within OpenFeint’s developer portal as shown in the following:
For the initialization process, we declare a dictionary that will include the details specific to our application. Where ever it is you want to perform the initialization within your application, add the following code.
view source
print ?
1
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation, [NSNumber numberWithBool:YES],
2
OpenFeintSettingDisableUserGeneratedContent, nil];
3
ofDelegate = [SampleOFDelegate new];
4
OFDelegatesContainer* delegates = [OFDelegatesContainer containerWithOpenFeintDelegate:ofDelegate];
5
[OpenFeint initializeWithProductKey:@"zGMPDEYldUia4j86uV1mA"
6
andSecret:@"QMjb1n9dV4MVO09U05R56MUCeJf7VZHnKlQIvRKtk"
7
andDisplayName:@"My Crazy App"
8
andSettings:settings // see OpenFeintSettings.h
9
andDelegates:delegates]; // see OFDelegatesContainer.h
For my particular application, once the initialization has been done, it then transitions to the main menu. If you’re already a registered user you’ll get the welcome back screen or if you’re a new user (or perhaps using a new device), you’ll have the opportunity to either login or register for a new account.
The following shows the OpenFeint screen that is seen when a new user or device is detected. The user can enable OpenFeint or alternatively indicate they don’t want these features right now.
Upon enabling OpenFeint, the application will recognize a device already associated with the user’s account and automatically log them in as shown in the following screen capture.
Additional features in the latest OpenFeint release now provide the ability to connect with your Twitter and FaceBook accounts as well as even share your location for geographic based scoring comparisons.
Once logged in, the user can easily review the scores for the various applications that use OpenFeint. In this case, we’re going to review the leaderboard for Balloon-Boy. The following shows the layout of my particular game’s main menu.
When a user selects the Scores option at the main menu, the following line of of code is executed within the called method. Take note of the text passed text value. This is the lD for our leaderboard that was assigned at the time of creation, which in this case is reflecting the value for the test application registered for this tutorial.
view source
print ?
1
[OpenFeint launchDashboardWithHighscorePage:(NSString*)@"181963"];
The code is pretty self explanatory and launches the high score dashboard for our application. You also have the option of defaulting to other screens when initially launching the OpenFeint dashboard, so be sure to check the SDK for such details.
In the following screen capture, we see the various leaderboards tracked via OpenFeint. You might recall that this is what was enabled during the application registration process within OpenFeint’s developer portal. My application is very simplistic and simply tracks the user’s personal score and a global score. The following provides a view of the global leader board for the Balloon-Boy application.
As mentioned earlier, another neat feature available with the more recent OpenFeint version is the ability to share your location to identify other players in your general vicinity.
This all sounds great, but the next question is how do we post these scores to OpenFeint? The process is incredibly simple. For my Balloon-Boy game, after the user’s piloted balloon has had three impacts, the game is over. At this point I give the player the opportunity to play again, but when this method is initially called, I execute the following bit of code to post the user’s score. In particular, I have a variable named currentScore that contains the user’s accumulated score. The currentScore’s value is posted to the OpenFeint leaderboard. It is also important to note the leaderboard ID again. This is the same value given to us when we first created the leaderboard in the developer portal. The leaderboard details are provided again for reference in the following screen capture.
The leaderboard ID is used to identify the specific board for the application that’ll receive the value. The following shows the single line of code used to post the current score to the appropriate leaderboard for our application.
view source
print ?
1
***************** 181963 is for the marathon leaderboard *************************
2
[OFHighScoreService setHighScore:currentScore forLeaderboard:@"181963" onSuccess:OFDelegate() onFailure:OFDelegate()];
The following screen capture shows in my application where the user is presented with the opportunity to either play again or return to the main menu. When this overlay is initially shown, there is a brief confirmation message shown at the bottom of the screen as the score is posted to the OpenFeint leaderboard. This is as a result of executing the single line of code noted above.
The integration process is nearly complete with only some minor additional changes required. In order to compile the OpenFeint C code, we have to change the extension all of our main class files from .m to .mm. Meaning, gameScene.m now becomes gameScene.mm. There’s no impact to the existing Objetive-C code, but if not done then there will be a lot of problems when attempting to compile the code otherwise.
Lastly, if you’re using a physics engine such as Chipmunk, there will also be errors at compile time due to the static void method. In particular, you’ll receive an error like request for member shape in something not structure or union. This is an issue of simply needing to cast the shape data and is solved by adding (Sprite *) as shown in the following.
view source
print ?
01
static void
02
eachShape(void *ptr, void* unused)
03
{
04
cpShape *shape = (cpShape*) ptr;
05
Sprite *sprite = (Sprite *)shape->data;
06
if( sprite ) {
07
cpBody *body = shape->body;
08
[sprite setPosition: cpv( body->p.x, body->p.y)];
09
[sprite setRotation: (float) CC_RADIANS_TO_DEGREES( -body->a )];
10
}
11
}
This concludes the integration of OpenFeint with a Cocos2D-iPhone application tutorial. Hopefully the process went smoothly and you’re now updating scores to an online leaderboard. Feel free to contact me regarding any feedback or content errors. Also be sure to check OpenFeint’s own knowledgebase and support forums for additional information.
[email protected]
February 22nd, 2010 | Category: Programming Tutorials
你可能感兴趣的:([OpenFeint-cocos2d]整合教程~稍后)
CMake 入门教程: 从基础到实践
arong-xu
CMakec++cmake
什么是CMake?CMake(全称为“Cross-PlatformMake”)是一种免费并开源的跨平台构建工具,用于生成构建系统文件(如Makefile和VisualStudio工程文件),从而控制软件的编译和链接过程.为什么选择CMake?CMake为项目工程解决了以下问题:跨平台构建:支持为多种平台生成配置文件,如Linux上的Makefile和Windows上的VisualStudio工程.
Dockerfile for C++ Dev Containers
arong-xu
开发环境配置c++vscode容器
本文提供一个可用于C++开发环境的Dockerfile,作为开发容器(devcontainer)使用.是一个进阶版的教程,需要读者了解devcontainer.devcontainer的基本使用教程可以参考我的博客:VSCodeDevContainers教程:从基础到进阶配置本文提供了两个版本的Dockerfile,分别是基于Fedora和Ubuntu24.04的镜像.Ubuntu的用户基数比较大
Coze使用教程:不会编程也能快速上手构建开发出你的第一个AI应用
文章目录**一、构建你的第一个AIAgent:赞美机器人1.创建AIAgent2.编写提示词(Prompts)3.(可选)为Agent添加技能4.调试Agent5.发布Agent二、使用模版创建AIAgent1.访问模板页面2.选择模板3.体验模板4.复制模板5.命名并选择工作区6.自定义配置7.测试与发布三、使用自然语言构建AIAgent1.创建AIAgent2.编辑和调试AIAgent3.发布
十二、Redis Cluster(集群)详解:原理、搭建、数据分片与读写分离
伯牙碎琴
#Redisredis数据库缓存
RedisCluster(集群)详解:原理、搭建、数据分片与读写分离RedisCluster是Redis官方提供的分布式存储方案,通过数据分片(Sharding)实现水平扩展(scalability),并提供高可用性(HA)和故障自动转移(failover)能力,解决了单机Redis内存受限、主从复制故障恢复较慢等问题。本教程将全面讲解RedisCluster的核心原理、搭建步骤、数据分片策略、读
【AI爬虫干货】Crawl4AI+DeepSeek:从安装配置到 DeepSeek 集成,掌握 AI 爬虫核心技术「喂饭教程」
blues_C
AI测试:从入门到进阶Python爬虫实战人工智能爬虫deepseekpythonAI爬虫
【AI爬虫干货】Crawl4AI+DeepSeek:从安装配置到DeepSeek集成,掌握AI爬虫核心技术「喂饭教程」Crawl4AI简介一、安装二、异步爬取网页内容三、批量抓取四、保存结果到文件五、与DeepSeek模型结合使用总结Crawl4AI简介Crawl4AI是一个开源的、专为大型语言模型(LLM)设计的网页爬虫与抓取工具;它的设计理念是提供一个高效、灵活且易于使用的解决方案,用于从网页
学习Flink:一场大数据世界的奇妙冒险
狮歌~资深攻城狮
大数据
学习Flink:一场大数据世界的奇妙冒险嘿,朋友们!今天咱们来聊聊怎么学习Flink这个在大数据界超火的玩意儿相信很多小伙伴都听说过它,但不知道从哪儿开始下手,别愁,听我慢慢唠唠~一、学习Flink前的“装备”准备想象一下,你要去攀登一座高峰学习Flink也得先做好准备工作呀。首先,你得熟悉一门编程语言,Java或者Scala比较好。Java就像是你出门的常用交通工具大家都比较熟悉,找资料、学教程
Connector for Python
ZHIHAN__
PythonMySQL-mysql-connector驱动MySQL是最流行的关系型数据库管理系统,如果你不不熟悉MySQL,可以阅读MySQL教程。介绍使用mysql-connector来连接使用MySQL,mysql-connector是MySQL官方提供的驱动器。我们可以使用pip命令来安装mysql-connector:python-mpipinstallmysql-connector使用
北京大学DeepSeek课程1《DeepSeek与AIGC应用》
daly520
AIGC人工智能aipython深度学习机器学习
北京大学发布的《DeepSeek与AIGC应用》报告及配套教程,系统介绍了DeepSeek技术特性、AIGC应用场景及实践方法,主要包含以下核心内容:PDF完整版下载北京大学DeepSeek课程《DeepSeek与AIGC应用》下载https://ollama.net.cn/deepseek/14.html一、DeepSeek-R1模型的技术解析1.模型特性与优势DeepSeek-R1是一款专注于
黄昏时间户外街拍人像Lr调色教程,手机滤镜PS+Lightroom预设下载!
调了个寂寞
电影预设lr调色摄影后期lr预设胶片预设照片调色
调色介绍黄昏时分有着独特而迷人的光线,使此时拍摄的人像自带一种浪漫、朦胧的氛围。通过Lr调色,可以进一步强化这种特质并根据不同的风格需求进行创作。Lr(Lightroom)作为专业的图像后期处理软件,提供了丰富的调色工具和功能模块,比如基本面板中的曝光、对比度、色温、色调等基础参数调节,HSL(色相、饱和度、明亮度)面板针对不同色彩单独调整的功能,以及曲线工具对影调细致控制等。运用这些工具能实现对
低空经济中 建立统一的数据共享平台,促进信息透明和协同决策。
小赖同学啊
低空经济人工智能低空经济无人机人工智能
在低空经济中,建立一个统一的数据共享平台是实现信息透明和协同决策的关键。通过整合多源数据(如飞行器状态、空域信息、气象数据等),平台可以为政府、企业、研究机构等提供实时、准确的数据支持,从而优化空域管理、提升运营效率并推动行业创新。以下是构建统一数据共享平台的详细方案:一、平台的核心功能1.数据采集与整合采集多源数据,包括:飞行器数据(如位置、速度、高度)。空域信息(如禁飞区、临时空域限制)。气象
springboot接入emqx的mqtt
renkai721
JAVAspringbootmqttemqx
需求背景物联网设备需要通过mqtt协议传输,这里记录一下,注意,这篇文章不能接入阿里云的mqtt,本人已经试过,会报错。开发教程1、EMQX安装部署--1安装必要的依赖sudoyuminstall-yyum-utilsdevice-mapper-persistent-datalvm2--2设置repo库sudoyum-config-manager--add-repohttps://repos.em
如何在Spring Boot中读取JAR包内resources目录下文件
嘵奇
提升自己springbootjar
精心整理了最新的面试资料和简历模板,有需要的可以自行获取点击前往百度网盘获取点击前往夸克网盘获取以下是如何在SpringBoot中读取JAR包内resources目录下文件的教程,分为多种方法及详细说明:方法1:使用ClassPathResource(Spring框架推荐)适用于Spring环境,能自动处理类路径资源。importorg.springframework.core.io.ClassP
RAG组件:向量数据库(Milvus)
CITY_OF_MO_GY
milvus人工智能
在当前大模型盛行的时代,大模型的垂类微调、优化成为产业落地、行业应用的关键;RAG技术应运而生,主要解决大模型对专业知识、实效性知识欠缺的问题;RAG的核心工作逻辑是将专业知识、实效知识等大模型欠缺的知识进行收集、打包、保存为一个知识库,在用到该部分知识的时候,可以通过检索关键信息,将知识库內对应知识片段进行返回,再整合为一个结构化的prompt(提示词)输入给大模型,这样以来,大模型就可以结合这
「第五届金蝶云苍穹开发者大赛」助力数字化转型,引发全国高校热潮
活动金蝶开发者大赛低代码开发者
由金蝶主办的「第五届金蝶云苍穹开发者大赛」正如火如荼地进行中,吸引了来自全国各地企业、高校和社区开发爱好者的热情参与和关注。作为推动数字化转型、促进创新和发展的关键活动之一,这次大赛以“一起向未来”为主题,立足于企业实际需求,基于金蝶云苍穹开放平台,聚焦业务创新,整合金蝶优质资源,培养卓越的开发人才,孵化出更多行业解决方案等创新作品,助力企业加速数字化转型。自报名通道开启以来,大赛迅速吸引到来自各
AntV | 蚂蚁数据可视化 G2Plot 通用 API
一个平凡de人
web开发vue.js前端javascript
AntV|G2PlotAPIAntV|G2Plot教程1、通用APIG2Plot的核心技术架构非常简单,所有的Plot图表都继承于一个基类,基类为所有的图表提供的了通用的API方法,而每个具体的可视化图表仅仅处理自己不同的配置项。所以API部分,所有图表基本都是一样,除了部分图表(比如:仪表盘、水波图)在changeDataAPI上有细微的区别。创建图表实例(new)通用API所有图表的创建,都是
探索WebGL基本水体教程:创造沉浸式3D水域体验
孔岱怀
探索WebGL基本水体教程:创造沉浸式3D水域体验项目地址:https://gitcode.com/gh_mirrors/we/webgl-water-tutorial在这个开源的世界里,我们经常发现令人惊艳的创新项目,今天我们要介绍的就是一个名为"WebGLBasicWaterTutorial"的绝佳资源,它由经验丰富的开发者ChineduFn打造。这个教程旨在帮助你利用WebGL技术构建逼真的
美业行业的数据困境:如何用管理中心8破解员工数据分析难题?
S18151700486
数据分析大数据数据挖掘经验分享笔记
在美业行业,门店的运营效率直接关系到企业的生存与发展。然而,许多美业门店在管理过程中面临一个共同的痛点:难以有效分析员工数据。无论是员工的业绩表现、客户反馈,还是工作习惯,这些数据往往分散在各个系统中,缺乏统一的整合与分析工具。这不仅导致管理效率低下,还使得门店难以制定科学的运营策略。美业行业的痛点:员工数据分析为何如此困难?数据分散,难以整合美业门店的员工数据通常分散在多个系统中,例如预约系统、
Python从0到100(十八):面向对象编程应用
是Dream呀
python开发语言
前言:零基础学Python:Python从0到100最新最全教程。想做这件事情很久了,这次我更新了自己所写过的所有博客,汇集成了Python从0到100,共一百节课,帮助大家一个月时间里从零基础到学习Python基础语法、Python爬虫、Web开发、计算机视觉、机器学习、神经网络以及人工智能相关知识,成为学习学习和学业的先行者!欢迎大家订阅专栏:零基础学Python:Python从0到100最新
Spring Boot整合Thymeleaf模板引擎实战——从静态页面到动态表单处理全流程解析
Sendingab
零基础7天精通SpringBootSpringboot从入门到精通springboot后端javatomcatspringspringcloudxml
https://example.com/thymeleaf-spring-demo前言在前后端不分离的传统Web项目中,Thymeleaf凭借自然的HTML语法与强大的表达式功能成为SpringBoot官方推荐的模板引擎。本文将带你从零实现用户注册功能,涵盖表单验证、页面碎片化、国际化等核心场景,并分享性能调优实战经验。一、快速整合Thymeleaf1.1添加基础依赖 xmlorg.springf
MySQL 教程(超详细,零基础可学、第一篇)
AA-老高(接毕设)
开发资料mysql数据库
目录一、MySQL数据库概述二、MySQL连接1、使用MySQL二进制方式连接2、使用PHP脚本连接MySQL三、MySQL创建数据库1、使用mysqladmin创建数据库2、使用PHP脚本创建数据库四、MySQL删除数据库1、使用mysqladmin删除数据库2、使用PHP脚本删除数据库五、MySQL选择数据库1、从命令提示窗口中选择MySQL数据库2、使用PHP脚本选择MySQL数据库六、My
七个合法学习黑客技术的平台,让你从萌新成为大佬
黑客白帽子黑爷
学习php开发语言web安全网络
1、HackThisSite提供在线IRC聊天和论坛,让用户交流更加方便。网站涵盖多种主题,包括密码破解、网络侦察、漏洞利用、社会工程学等。非常适用于个人提高网络安全技能2、HackaDay涵盖多个领域,包括黑客技术、科技、工程和DIY等内容,站内提供大量有趣的文章、视频、教程和新闻,帮助用户掌握黑客技术和DIY精神。3、OffensiveSecurity一个专门提供网络安全培训和认证的公司,课程
Python爬虫利器Scrapy:小白也能轻松入门的保姆级教程
Serendipity_Carl
爬虫进阶python爬虫pycharmscrapy
Scrapy是纯Python开发的一个高效,结构化的抓取框架异步协程cpu为什么选择Scrapy?框架优势:高性能、模块化设计、内置数据管道(Pipeline)、自动重试机制等。适用场景:大规模数据抓取、结构化数据提取、自动化测试等。对比其他工具:相比Requests+BeautifulSoup,Scrapy更适合工程化项目Scrapy的工作原理图:引擎驱动调度器管理请求队列,下载器获取页面后由S
Go-Gin Web 框架完整教程
m0_74825656
面试学习路线阿里巴巴golanggin前端
1.环境准备1.1Go环境安装Go语言(或称Golang)是一个开源的编程语言,由Google开发。在开始使用Gin框架之前,我们需要先安装Go环境。安装步骤:访问Go官网下载页面:https://golang.org/dl/根据你的操作系统选择相应的安装包Windows:下载.msi安装包,双击运行安装程序Mac:下载.pkg安装包,双击运行安装程序Linux:下载tar.gz包,解压并配置环境
Openresty最佳案例 | 第9篇:Openresty实现的网关权限控制
公众号:方志朋
数据库jwtshiroweblinux
简介采用openresty开发出的api网关有很多,比如比较流行的kong、orange等。这些API网关通过提供插件的形式,提供了非常多的功能。这些组件化的功能往往能够满足大部分的需求,如果要想达到特定场景的需求,可能需要二次开发,比如RBAC权限系统。本小节通过整合前面的知识点,来构建一个RBAC权限认证系统。技术栈本小节采用了以下的技术栈:Openresty(lua+nginx)mysqlr
linux下qt的sqlite数据库教程,在Qt中使用SQLite数据库
weixin_39632728
前言SQLite(sql)是一款开源轻量级的数据库软件,不需要server,可以集成在其他软件中,非常适合嵌入式系统。Qt5以上版本可以直接使用SQLite(Qt自带驱动)。用法1准备引入SQL模块在Qt项目文件(.pro文件)中,加入SQL模块:QT+=sql引用头文件在需要使用SQL的类定义中,引用相关头文件。例如:#include#include#include2使用1.建立数据库检查连接、
#[特殊字符] 我靠这插件周肝5个项目!2024最强AI编程神器CodeGeeX实战(附保姆级教程+私藏资源)
donk66zzz
chatgpt人工智能c++javapythonAI编程开发语言
**写在前面**:最近用这个国产插件彻底上头了!不仅比Copilot省$10/月,还专门优化中文注释❗实测1天写完爬虫+数据清洗+自动化报告(附完整代码)。文末送《30个ChatGPT高效咒语模板》和《VSCode终极配置包》!---##一、为什么我弃用Copilot投奔CodeGeeX?###1.1真实项目耗时对比(Python数据清洗场景)||传统编码|Copilot|CodeGeeX||--
wangeditor html编辑,Vue整合wangEditor富文本编辑器
莫姐
wangeditorhtml编辑
最近在做项目时,客户有个发布新闻动态的功能,具体页面内容让客户自己编写,所以要选择富文本编辑器,这样用户体验好一点。网上有很多的富文本编辑器,因为项目的功能并不是很复杂,所以选择了wangEditor,界面简洁,使用起来也挺方便的;image.png实现思路1.安装wangEditor2.封装成组件3.父组件中直接调用一、wangEditor安装这里使用npm命令安装;npminstallwang
新手教程,小白学web前端开发—HTML5+css3
皆非本人
前端html5css3
小白教程,一起来跟我学简单的网页制作吧!本书教材:web前端开发案例教程—HTML5+css3简介:2005年以后,互联网进入了web2.0的时代,各种类似的桌面软件的web应用大量涌现,网站的前端,由此发生了翻天覆地的变化。网站不再只承载单一的文字和图片,各种丰富的媒体让网页的内容更加生动,网页的各种交互形式为用户带来了更好的体验,都基于前端的技术实现,好了废话不多说,让我们简单的体验一下如何制
GStreamer —— 2.2、Windows下Qt加载GStreamer库后运行 - “教程2:GStreamer 概念“(附:完整源码)
听见涛声、
GStreamerQtGStreamer
运行效果 简介 上一个教程演示了如何自动构建管道。现在我们将通过实例化每个元素来手动构建管道并将它们全部链接在一起。在此过程中,我们将学习: •什么是GStreamer元素以及如何创建一个。 •如何将元素相互连接。 •如何自定义元素的行为。 •如何观察总线的错误条件并提取信息来自GStreamer消息。 这些
centos虚拟机安装
lqlj2233
linux
以下是一个详细的VMware+CentOS虚拟机安装教程,结合了最新的信息和步骤:一、准备工作1.下载VMware软件访问VMware官方网站:VMwareWorkstation官网。点击“现在安装”并下载适合您操作系统的VMwareWorkstation。2.下载CentOSISO文件前往清华大学开源软件镜像站或CentOS官方网站下载CentOS7或CentOS8的ISO文件。-清华大学镜像站
redis学习笔记——不仅仅是存取数据
Everyday都不同
returnSourceexpire/delincr/lpush数据库分区redis
最近项目中用到比较多redis,感觉之前对它一直局限于get/set数据的层面。其实作为一个强大的NoSql数据库产品,如果好好利用它,会带来很多意想不到的效果。(因为我搞java,所以就从jedis的角度来补充一点东西吧。PS:不一定全,只是个人理解,不喜勿喷)
1、关于JedisPool.returnSource(Jedis jeids)
这个方法是从red
SQL性能优化-持续更新中。。。。。。
atongyeye
oraclesql
1 通过ROWID访问表--索引
你可以采用基于ROWID的访问方式情况,提高访问表的效率, , ROWID包含了表中记录的物理位置信息..ORACLE采用索引(INDEX)实现了数据和存放数据的物理位置(ROWID)之间的联系. 通常索引提供了快速访问ROWID的方法,因此那些基于索引列的查询就可以得到性能上的提高.
2 共享SQL语句--相同的sql放入缓存
3 选择最有效率的表
[JAVA语言]JAVA虚拟机对底层硬件的操控还不完善
comsci
JAVA虚拟机
如果我们用汇编语言编写一个直接读写CPU寄存器的代码段,然后利用这个代码段去控制被操作系统屏蔽的硬件资源,这对于JVM虚拟机显然是不合法的,对操作系统来讲,这样也是不合法的,但是如果是一个工程项目的确需要这样做,合同已经签了,我们又不能够这样做,怎么办呢? 那么一个精通汇编语言的那种X客,是否在这个时候就会发生某种至关重要的作用呢?
&n
lvs- real
男人50
LVS
#!/bin/bash
#
# Script to start LVS DR real server.
# description: LVS DR real server
#
#. /etc/rc.d/init.d/functions
VIP=10.10.6.252
host='/bin/hostname'
case "$1" in
sta
生成公钥和私钥
oloz
DSA安全加密
package com.msserver.core.util;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
public class SecurityUtil {
UIView 中加入的cocos2d,背景透明
374016526
cocos2dglClearColor
要点是首先pixelFormat:kEAGLColorFormatRGBA8,必须有alpha层才能透明。然后view设置为透明glView.opaque = NO;[director setOpenGLView:glView];[self.viewController.view setBackgroundColor:[UIColor clearColor]];[self.viewControll
mysql常用命令
香水浓
mysql
连接数据库
mysql -u troy -ptroy
备份表
mysqldump -u troy -ptroy mm_database mm_user_tbl > user.sql
恢复表(与恢复数据库命令相同)
mysql -u troy -ptroy mm_database < user.sql
备份数据库
mysqldump -u troy -ptroy
我的架构经验系列文章 - 后端架构 - 系统层面
agevs
JavaScriptjquerycsshtml5
系统层面:
高可用性
所谓高可用性也就是通过避免单独故障加上快速故障转移实现一旦某台物理服务器出现故障能实现故障快速恢复。一般来说,可以采用两种方式,如果可以做业务可以做负载均衡则通过负载均衡实现集群,然后针对每一台服务器进行监控,一旦发生故障则从集群中移除;如果业务只能有单点入口那么可以通过实现Standby机加上虚拟IP机制,实现Active机在出现故障之后虚拟IP转移到Standby的快速
利用ant进行远程tomcat部署
aijuans
tomcat
在javaEE项目中,需要将工程部署到远程服务器上,如果部署的频率比较高,手动部署的方式就比较麻烦,可以利用Ant工具实现快捷的部署。这篇博文详细介绍了ant配置的步骤(http://www.cnblogs.com/GloriousOnion/archive/2012/12/18/2822817.html),但是在tomcat7以上不适用,需要修改配置,具体如下:
1.配置tomcat的用户角色
获取复利总收入
baalwolf
获取
public static void main(String args[]){
int money=200;
int year=1;
double rate=0.1;
&
eclipse.ini解释
BigBird2012
eclipse
大多数java开发者使用的都是eclipse,今天感兴趣去eclipse官网搜了一下eclipse.ini的配置,供大家参考,我会把关键的部分给大家用中文解释一下。还是推荐有问题不会直接搜谷歌,看官方文档,这样我们会知道问题的真面目是什么,对问题也有一个全面清晰的认识。
Overview
1、Eclipse.ini的作用
Eclipse startup is controlled by th
AngularJS实现分页功能
bijian1013
JavaScriptAngularJS分页
对于大多数web应用来说显示项目列表是一种很常见的任务。通常情况下,我们的数据会比较多,无法很好地显示在单个页面中。在这种情况下,我们需要把数据以页的方式来展示,同时带有转到上一页和下一页的功能。既然在整个应用中这是一种很常见的需求,那么把这一功能抽象成一个通用的、可复用的分页(Paginator)服务是很有意义的。
&nbs
[Maven学习笔记三]Maven archetype
bit1129
ArcheType
archetype的英文意思是原型,Maven archetype表示创建Maven模块的模版,比如创建web项目,创建Spring项目等等.
mvn archetype提供了一种命令行交互式创建Maven项目或者模块的方式,
mvn archetype
1.在LearnMaven-ch03目录下,执行命令mvn archetype:gener
【Java命令三】jps
bit1129
Java命令
jps很简单,用于显示当前运行的Java进程,也可以连接到远程服务器去查看
[hadoop@hadoop bin]$ jps -help
usage: jps [-help]
jps [-q] [-mlvV] [<hostid>]
Definitions:
<hostid>: <hostname>[:
ZABBIX2.2 2.4 等各版本之间的兼容性
ronin47
zabbix更新很快,从2009年到现在已经更新多个版本,为了使用更多zabbix的新特性,随之而来的便是升级版本,zabbix版本兼容性是必须优先考虑的一点 客户端AGENT兼容
zabbix1.x到zabbix2.x的所有agent都兼容zabbix server2.4:如果你升级zabbix server,客户端是可以不做任何改变,除非你想使用agent的一些新特性。 Zabbix代理(p
unity 3d还是cocos2dx哪个适合游戏?
brotherlamp
unity自学unity教程unity视频unity资料unity
unity 3d还是cocos2dx哪个适合游戏?
问:unity 3d还是cocos2dx哪个适合游戏?
答:首先目前来看unity视频教程因为是3d引擎,目前对2d支持并不完善,unity 3d 目前做2d普遍两种思路,一种是正交相机,3d画面2d视角,另一种是通过一些插件,动态创建mesh来绘制图形单元目前用的较多的是2d toolkit,ex2d,smooth moves,sm2,
百度笔试题:一个已经排序好的很大的数组,现在给它划分成m段,每段长度不定,段长最长为k,然后段内打乱顺序,请设计一个算法对其进行重新排序
bylijinnan
java算法面试百度招聘
import java.util.Arrays;
/**
* 最早是在陈利人老师的微博看到这道题:
* #面试题#An array with n elements which is K most sorted,就是每个element的初始位置和它最终的排序后的位置的距离不超过常数K
* 设计一个排序算法。It should be faster than O(n*lgn)。
获取checkbox复选框的值
chiangfai
checkbox
<title>CheckBox</title>
<script type = "text/javascript">
doGetVal: function doGetVal()
{
//var fruitName = document.getElementById("apple").value;//根据
MySQLdb用户指南
chenchao051
mysqldb
原网页被墙,放这里备用。 MySQLdb User's Guide
Contents
Introduction
Installation
_mysql
MySQL C API translation
MySQL C API function mapping
Some _mysql examples
MySQLdb
HIVE 窗口及分析函数
daizj
hive窗口函数分析函数
窗口函数应用场景:
(1)用于分区排序
(2)动态Group By
(3)Top N
(4)累计计算
(5)层次查询
一、分析函数
用于等级、百分点、n分片等。
函数 说明
RANK() &nbs
PHP ZipArchive 实现压缩解压Zip文件
dcj3sjt126com
PHPzip
PHP ZipArchive 是PHP自带的扩展类,可以轻松实现ZIP文件的压缩和解压,使用前首先要确保PHP ZIP 扩展已经开启,具体开启方法就不说了,不同的平台开启PHP扩增的方法网上都有,如有疑问欢迎交流。这里整理一下常用的示例供参考。
一、解压缩zip文件 01 02 03 04 05 06 07 08 09 10 11
精彩英语贺词
dcj3sjt126com
英语
I'm always here
我会一直在这里支持你
&nb
基于Java注解的Spring的IoC功能
e200702084
javaspringbeanIOCOffice
java模拟post请求
geeksun
java
一般API接收客户端(比如网页、APP或其他应用服务)的请求,但在测试时需要模拟来自外界的请求,经探索,使用HttpComponentshttpClient可模拟Post提交请求。 此处用HttpComponents的httpclient来完成使命。
import org.apache.http.HttpEntity ;
import org.apache.http.HttpRespon
Swift语法之 ---- ?和!区别
hongtoushizi
?swift!
转载自: http://blog.sina.com.cn/s/blog_71715bf80102ux3v.html
Swift语言使用var定义变量,但和别的语言不同,Swift里不会自动给变量赋初始值,也就是说变量不会有默认值,所以要求使用变量之前必须要对其初始化。如果在使用变量之前不进行初始化就会报错:
var stringValue : String
//
centos7安装jdk1.7
jisonami
jdkcentos
安装JDK1.7
步骤1、解压tar包在当前目录
[root@localhost usr]#tar -xzvf jdk-7u75-linux-x64.tar.gz
步骤2:配置环境变量
在etc/profile文件下添加
export JAVA_HOME=/usr/java/jdk1.7.0_75
export CLASSPATH=/usr/java/jdk1.7.0_75/lib
数据源架构模式之数据映射器
home198979
PHP架构数据映射器datamapper
前面分别介绍了数据源架构模式之表数据入口、数据源架构模式之行和数据入口数据源架构模式之活动记录,相较于这三种数据源架构模式,数据映射器显得更加“高大上”。
一、概念
数据映射器(Data Mapper):在保持对象和数据库(以及映射器本身)彼此独立的情况下,在二者之间移动数据的一个映射器层。概念永远都是抽象的,简单的说,数据映射器就是一个负责将数据映射到对象的类数据。
&nb
在Python中使用MYSQL
pda158
mysqlpython
缘由 近期在折腾一个小东西须要抓取网上的页面。然后进行解析。将结果放到
数据库中。 了解到
Python在这方面有优势,便选用之。 由于我有台
server上面安装有
mysql,自然使用之。在进行数据库的这个操作过程中遇到了不少问题,这里
记录一下,大家共勉。
python中mysql的调用
百度之后能够通过MySQLdb进行数据库操作。
单例模式
hxl1988_0311
java单例设计模式单件
package com.sosop.designpattern.singleton;
/*
* 单件模式:保证一个类必须只有一个实例,并提供全局的访问点
*
* 所以单例模式必须有私有的构造器,没有私有构造器根本不用谈单件
*
* 必须考虑到并发情况下创建了多个实例对象
* */
/**
* 虽然有锁,但是只在第一次创建对象的时候加锁,并发时不会存在效率
27种迹象显示你应该辞掉程序员的工作
vipshichg
工作
1、你仍然在等待老板在2010年答应的要提拔你的暗示。 2、你的上级近10年没有开发过任何代码。 3、老板假装懂你说的这些技术,但实际上他完全不知道你在说什么。 4、你干完的项目6个月后才部署到现场服务器上。 5、时不时的,老板在检查你刚刚完成的工作时,要求按新想法重新开发。 6、而最终这个软件只有12个用户。 7、时间全浪费在办公室政治中,而不是用在开发好的软件上。 8、部署前5分钟才开始测试。
按字母分类:
ABCDEFGHIJKLMNOPQRSTUVWXYZ其他
首页 -
关于我们 -
站内搜索 -
Sitemap -
侵权投诉
版权所有 IT知识库 CopyRight © 2000-2050 E-COM-NET.COM , All Rights Reserved.