java用正则表达式提取background:url和background-image:url中的链接
<section style="padding: 10px 10px 30px; line-height: 30px; box-shadow: rgb(204, 204, 204) 2px 0px 10px; overflow: hidden; background-image: url(&quot;https://mpt.135editor.com/mmbiz_gif/uN1LIav7oJ84T6TnzapJHpqQx8IaOOL0nfYWuyCbx2G0xHn6fdnU2oSicxJ0ibuja6gdvdemx9AHdbB6VUo9zkWA/0?wx_fmt=gif&quot;); background-size: 100%; box-sizing: border-box;" class="135bg">
<section style="background: url(http://image2.135editor.com/cache/remote/aHR0cHM6Ly9tbWJpei5xbG9nby5jbi9tbWJpel9wbmcvN1FSVHZrSzJxQzQ4UUZIaDNWaWJZMUtRNUpaR2haNlR3dzBtV2ljQnNtcHR2cWY3MU1nYUJYaG5JdzQ3R3doRmp2VXJqZU55MnBwM0hnM3RQQ3JIREQ1Zy8wP3d4X2ZtdD1wbmc=)repeat-x;background-size:40px 4px;background-position:top ;">

用正则表达式取出
https://mpt.135editor.com/mmbiz_gif/uN1LIav7oJ84T6TnzapJHpqQx8IaOOL0nfYWuyCbx2G0xHn6fdnU2oSicxJ0ibuja6gdvdemx9AHdbB6VUo9zkWA/0?wx_fmt=gif

http://image2.135editor.com/cache/remote/aHR0cHM6Ly9tbWJpei5xbG9nby5jbi9tbWJpel9wbmcvN1FSVHZrSzJxQzQ4UUZIaDNWaWJZMUtRNUpaR2haNlR3dzBtV2ljQnNtcHR2cWY3MU1nYUJYaG5JdzQ3R3doRmp2VXJqZU55MnBwM0hnM3RQQ3JIREQ1Zy8wP3d4X2ZtdD1wbmc=

正则表达式应该怎么写

2个回答

1.

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches {

    public static void main(String args[]) {
        String str = "";
        String pattern = ""((ht|f)tps?):\\/\\/(.*?)&quot";

        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(str);
        System.out.println(m.matches());
    }

}

2.

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches {

    public static void main(String args[]) {
        String str = "";
        String pattern = "\\(((ht|f)tps?):\\/\\/(.*?)\\)";

        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(str);
        System.out.println(m.matches());
    }

}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
C# 反序列化嵌套JSON。请问这个JSON C#怎么来处理

{"head"=>{"rtnCode"=>"000000", "rtnMsg"=>"访问成功"}, "body"=>{"pageTotal"=>"184", "list"=>[{"ldxh"=>"1373", "xm"=>"金蛾南路", "zyzt"=>"已完成", "czfs"=>"新增", "zl"=>"湟中县李家山镇金蛾南路47号", "lyfs"=>"新建", "qx"=>"湟中县", "jd"=>"李家山镇金蛾南路", "ymph"=>"47号", "tfh"=>"", "qdh"=>"", "zh"=>"无", "jzmj"=>"300.48", "zcs"=>"1373", "jgrq"=>"", "ima"=>"1373", "rjl"=>"", "czz"=>"王迎春", "lpb_Url"=>"http://192.168.1.97:1627/?iw-cmd=HZ_XLP_LPB&iw-apikey=123&buildID=1373&stanID=1610"}, {"ldxh"=>"1374", "xm"=>"多巴镇南街滨河路", "zyzt"=>"已完成", "czfs"=>"新增", "zl"=>"湟中县多巴镇南街滨河路64号民运站1号楼", "lyfs"=>"新建", "qx"=>"湟中县", "jd"=>"多巴镇南街滨河路", "ymph"=>"64号", "tfh"=>"", "qdh"=>"", "zh"=>"民运站1号楼", "jzmj"=>"83.79", "zcs"=>"1374", "jgrq"=>"", "ima"=>"1374", "rjl"=>"", "czz"=>"王迎春", "lpb_Url"=>"http://192.168.1.97:1627/?iw-cmd=HZ_XLP_LPB&iw-apikey=123&buildID=1374&stanID=1610"}, {"ldxh"=>"1375", "xm"=>"金塔路", "zyzt"=>"已完成", "czfs"=>"新增", "zl"=>"湟中县鲁沙尔镇金塔路64号", "lyfs"=>"新建", "qx"=>"湟中县", "jd"=>"鲁沙尔镇金塔路", "ymph"=>"64号", "tfh"=>"", "qdh"=>"", "zh"=>"无", "jzmj"=>"68.36", "zcs"=>"1375", "jgrq"=>"", "ima"=>"1375", "rjl"=>"", "czz"=>"王迎春", "lpb_Url"=>"http://192.168.1.97:1627/?iw-cmd=HZ_XLP_LPB&iw-apikey=123&buildID=1375&stanID=1610"}]}}

写了3年eclipes安卓开发,现在要换android studio,快捷键快把我折磨疯了,求救

我用eclipes得习惯是 1.不用自动提示代码,比如我要打ImageView,我只打Ima,这时不要让他有自动提示框 2.我打了Ima后,alt+/后如果只有唯一全选项出现提示框,的补全选项就直接补全类名并倒包,如果有多个补并能上下选择,选择后补全类名并导包。 3.我选择了后自动导包(因为没弄出来2得效果,不知道如果能实现2,是不是自动导包) 4. 123成功后(比如ImageView)空一格再alt+/ 自动出现默认变量名称,比如 ImageView imageview,系统默认变量名要小写,最好能有多个选择(比如imageview或者 view或者iview等) 好了!上图,来大佬救我,别说直接在keymap中设置eclipes模式,对我不好使 ![图片说明](https://img-ask.csdn.net/upload/201806/20/1529488305_478031.png) ![图片说明](https://img-ask.csdn.net/upload/201806/20/1529488322_495744.png) ![图片说明](https://img-ask.csdn.net/upload/201806/20/1529488335_465221.png) ![图片说明](https://img-ask.csdn.net/upload/201806/20/1529488345_973653.png) ![图片说明](https://img-ask.csdn.net/upload/201806/20/1529488359_876784.png)

Symfony2 - 重载注册表单导致CSRF错误(添加了github repo)

<div class="post-text" itemprop="text"> <p>I am currently overloading SonataUser registration form so that I can have my own custom form when people create an account.</p> <p>I have overloaded everything properly (the handler, the form type, the controller and the twig template). However, when I send the form, I only get the data back and a new user is not created. Therefore, I investigated and I found out that when I echoed this</p> <pre><code>var_dump($this-&gt;form-&gt;getErrors()); </code></pre> <p>I obtained an error saying the CSRF token is invalid. I am using <code>Symfony 2.4.2</code> and <code>sonata user 2.2.x-dev</code>.</p> <p>I will show you all the classes that I have overloaded. For now, they are mostly copy and pasted from their parents. </p> <p>Here is my form handler</p> <pre><code>&lt;?php /* * This file is part of the Sonata package. * * (c) Thomas Rabaix &lt;thomas.rabaix@sonata-project.org&gt; * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * */ namespace Application\Sonata\UserBundle\Form\Handler; use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; use FOS\UserBundle\Model\UserInterface; use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Form\Handler\RegistrationFormHandler as BaseHandler; use Symfony\Component\Form\FormInterface; use FOS\UserBundle\Mailer\MailerInterface; use FOS\UserBundle\Util\TokenGeneratorInterface; /** * * This file is an adapted version of FOS User Bundle RegistrationFormHandler class * * (c) FriendsOfSymfony &lt;http://friendsofsymfony.github.com/&gt; */ class RegistrationFormHandler extends BaseHandler { protected $request; protected $userManager; protected $form; protected $mailer; protected $tokenGenerator; public function __construct(FormInterface $form, Request $request, UserManagerInterface $userManager, MailerInterface $mailer, TokenGeneratorInterface $tokenGenerator) { $this-&gt;form = $form; $this-&gt;request = $request; $this-&gt;userManager = $userManager; $this-&gt;mailer = $mailer; $this-&gt;tokenGenerator = $tokenGenerator; } /** * @param boolean $confirmation */ public function process($confirmation = false) { $user = $this-&gt;createUser(); $this-&gt;form-&gt;setData($user); if ('POST' === $this-&gt;request-&gt;getMethod()) { $this-&gt;form-&gt;bind($this-&gt;request); if ($this-&gt;form-&gt;isValid()) { var_dump('working !!'); $this-&gt;onSuccess($user, $confirmation); return true; } var_dump($this-&gt;form-&gt;getErrors()); } return false; } /** * @param boolean $confirmation */ protected function onSuccess(UserInterface $user, $confirmation) { if ($confirmation) { $user-&gt;setEnabled(false); if (null === $user-&gt;getConfirmationToken()) { $user-&gt;setConfirmationToken($this-&gt;tokenGenerator-&gt;generateToken()); } $this-&gt;mailer-&gt;sendConfirmationEmailMessage($user); } else { $user-&gt;setEnabled(true); } $this-&gt;userManager-&gt;updateUser($user); } /** * @return UserInterface */ protected function createUser() { return $this-&gt;userManager-&gt;createUser(); } } </code></pre> <p>Here is my form type:</p> <pre><code>&lt;?php /* * This file is part of the FOSUserBundle package. * * (c) FriendsOfSymfony &lt;http://friendsofsymfony.github.com/&gt; * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Application\Sonata\UserBundle\Form\Type; use Entities\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Sonata\UserBundle\Model\UserInterface; class RegistrationFormType extends AbstractType { private $class; /** * @var array */ protected $mergeOptions; /** * @param string $class The User class name * @param array $mergeOptions Add options to elements */ public function __construct($class, array $mergeOptions = array()) { $this-&gt;class = $class; $this-&gt;mergeOptions = $mergeOptions; } public function buildForm(FormBuilderInterface $builder, array $options) { $builder -&gt;add('username', null, array_merge(array( 'label' =&gt; 'form.username', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('email', 'email', array_merge(array( 'label' =&gt; 'form.email', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('plainPassword', 'repeated', array_merge(array( 'type' =&gt; 'password', 'required' =&gt; true, 'options' =&gt; array('translation_domain' =&gt; 'SonataUserBundle'), 'first_options' =&gt; array_merge(array( 'label' =&gt; 'form.password', ), $this-&gt;mergeOptions), 'second_options' =&gt; array_merge(array( 'label' =&gt; 'form.password_confirmation', ), $this-&gt;mergeOptions), 'invalid_message' =&gt; 'fos_user.password.mismatch', ), $this-&gt;mergeOptions)) -&gt;add('lastName', null, array_merge(array( 'label' =&gt; 'form.label_lastname', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('firstName', null, array_merge(array( 'label' =&gt; 'form.label_firstname', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('date_of_birth', 'birthday', array_merge(array( 'label' =&gt; 'form.label_date_of_birth', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('gender', 'sonata_user_gender', array( 'label' =&gt; 'form.label_gender', 'required' =&gt; true, 'translation_domain' =&gt; 'SonataUserBundle', 'choices' =&gt; array( UserInterface::GENDER_FEMALE =&gt; 'gender_female', UserInterface::GENDER_MALE =&gt; 'gender_male', ) )) -&gt;add('phone', null, array_merge(array( 'label' =&gt; 'form.label_phone', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('address', null, array_merge(array( 'label' =&gt; 'form.address', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('city', null, array_merge(array( 'label' =&gt; 'form.city', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) -&gt;add('state', 'choice', array_merge(array( 'label' =&gt; 'form.state', 'translation_domain' =&gt; 'SonataUserBundle', 'multiple' =&gt; false, 'expanded' =&gt; false ), $this-&gt;mergeOptions)) -&gt;add('country', 'choice', array_merge(array( 'label' =&gt; 'form.country', 'translation_domain' =&gt; 'SonataUserBundle', 'multiple' =&gt; false, 'expanded' =&gt; false ), $this-&gt;mergeOptions)) -&gt;add('postalCode', null, array_merge(array( 'label' =&gt; 'form.postalCode', 'translation_domain' =&gt; 'SonataUserBundle', ), $this-&gt;mergeOptions)) // -&gt;add('children', 'collection', array_merge(array( // 'type' =&gt; new ChildFormType('Application\Sonata\UserBundle\Entity\User'), // 'translation_domain' =&gt; 'SonataUserBundle', // 'allow_add' =&gt; true, // 'allow_delete' =&gt; true, // 'by_reference' =&gt; false, // ), $this-&gt;mergeOptions)) ; } public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver-&gt;setDefaults(array( 'data_class' =&gt; $this-&gt;class, 'intention' =&gt; 'registration', )); } public function getName() { return 'sonata_user_registration'; } } </code></pre> <p>Here is my registration controller</p> <pre><code>&lt;?php /* * This file is part of the Sonata package. * * (c) Thomas Rabaix &lt;thomas.rabaix@sonata-project.org&gt; * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Application\Sonata\UserBundle\Controller; use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccountStatusException; use FOS\UserBundle\Model\UserInterface; /** * Class SonataRegistrationController * * This class is inspired from the FOS RegistrationController * * @package Sonata\UserBundle\Controller * * @author Hugo Briand &lt;briand@ekino.com&gt; */ class RegistrationFOSUser1Controller extends ContainerAware { public function registerAction() { $user = $this-&gt;container-&gt;get('security.context')-&gt;getToken()-&gt;getUser(); if ($user instanceof UserInterface &amp;&amp; 'POST' === $this-&gt;container-&gt;get('request')-&gt;getMethod()) { $this-&gt;container-&gt;get('session')-&gt;getFlashBag()-&gt;set('sonata_user_error', 'sonata_user_already_authenticated'); $url = $this-&gt;container-&gt;get('router')-&gt;generate('sonata_user_profile_show'); return new RedirectResponse($url); } $form = $this-&gt;container-&gt;get('sonata.user.registration.form'); $formHandler = $this-&gt;container-&gt;get('sonata.user.registration.form.handler'); $confirmationEnabled = $this-&gt;container-&gt;getParameter('fos_user.registration.confirmation.enabled'); $process = $formHandler-&gt;process($confirmationEnabled); var_dump(0); if ($process) { var_dump(1); exit(); $user = $form-&gt;getData(); $authUser = false; if ($confirmationEnabled) { $this-&gt;container-&gt;get('session')-&gt;set('fos_user_send_confirmation_email/email', $user-&gt;getEmail()); $route = 'fos_user_registration_check_email'; } else { $authUser = true; $route = $this-&gt;container-&gt;get('session')-&gt;get('sonata_basket_delivery_redirect', 'sonata_user_profile_show'); $this-&gt;container-&gt;get('session')-&gt;remove('sonata_basket_delivery_redirect'); } $this-&gt;setFlash('fos_user_success', 'registration.flash.user_created'); $url = $this-&gt;container-&gt;get('session')-&gt;get('sonata_user_redirect_url'); if (null === $url || "" === $url) { $url = $this-&gt;container-&gt;get('router')-&gt;generate($route); } $response = new RedirectResponse($url); if ($authUser) { $this-&gt;authenticateUser($user, $response); } return $response; } $this-&gt;container-&gt;get('session')-&gt;set('sonata_user_redirect_url', $this-&gt;container-&gt;get('request')-&gt;headers-&gt;get('referer')); return $this-&gt;container-&gt;get('templating')-&gt;renderResponse('FOSUserBundle:Registration:register.html.'.$this-&gt;getEngine(), array( 'form' =&gt; $form-&gt;createView(), )); } /** * Tell the user to check his email provider */ public function checkEmailAction() { $email = $this-&gt;container-&gt;get('session')-&gt;get('fos_user_send_confirmation_email/email'); $this-&gt;container-&gt;get('session')-&gt;remove('fos_user_send_confirmation_email/email'); $user = $this-&gt;container-&gt;get('fos_user.user_manager')-&gt;findUserByEmail($email); if (null === $user) { throw new NotFoundHttpException(sprintf('The user with email "%s" does not exist', $email)); } return $this-&gt;container-&gt;get('templating')-&gt;renderResponse('FOSUserBundle:Registration:checkEmail.html.'.$this-&gt;getEngine(), array( 'user' =&gt; $user, )); } /** * Receive the confirmation token from user email provider, login the user */ public function confirmAction($token) { $user = $this-&gt;container-&gt;get('fos_user.user_manager')-&gt;findUserByConfirmationToken($token); if (null === $user) { throw new NotFoundHttpException(sprintf('The user with confirmation token "%s" does not exist', $token)); } $user-&gt;setConfirmationToken(null); $user-&gt;setEnabled(true); $user-&gt;setLastLogin(new \DateTime()); $this-&gt;container-&gt;get('fos_user.user_manager')-&gt;updateUser($user); if ($redirectRoute = $this-&gt;container-&gt;getParameter('sonata.user.register.confirm.redirect_route')) { $response = new RedirectResponse($this-&gt;container-&gt;get('router')-&gt;generate($redirectRoute, $this-&gt;container-&gt;getParameter('sonata.user.register.confirm.redirect_route_params'))); } else { $response = new RedirectResponse($this-&gt;container-&gt;get('router')-&gt;generate('fos_user_registration_confirmed')); } $this-&gt;authenticateUser($user, $response); return $response; } /** * Tell the user his account is now confirmed */ public function confirmedAction() { $user = $this-&gt;container-&gt;get('security.context')-&gt;getToken()-&gt;getUser(); if (!is_object($user) || !$user instanceof UserInterface) { throw new AccessDeniedException('This user does not have access to this section.'); } return $this-&gt;container-&gt;get('templating')-&gt;renderResponse('FOSUserBundle:Registration:confirmed.html.'.$this-&gt;getEngine(), array( 'user' =&gt; $user, )); } /** * Authenticate a user with Symfony Security * * @param \FOS\UserBundle\Model\UserInterface $user * @param \Symfony\Component\HttpFoundation\Response $response */ protected function authenticateUser(UserInterface $user, Response $response) { try { $this-&gt;container-&gt;get('fos_user.security.login_manager')-&gt;loginUser( $this-&gt;container-&gt;getParameter('fos_user.firewall_name'), $user, $response); } catch (AccountStatusException $ex) { // We simply do not authenticate users which do not pass the user // checker (not enabled, expired, etc.). } } /** * @param string $action * @param string $value */ protected function setFlash($action, $value) { $this-&gt;container-&gt;get('session')-&gt;getFlashBag()-&gt;set($action, $value); } protected function getEngine() { return $this-&gt;container-&gt;getParameter('fos_user.template.engine'); } } </code></pre> <p>Here are my services:</p> <pre><code>sonata.user.registration.form.type: class: Application\Sonata\UserBundle\Form\Type\RegistrationFormType arguments: [ "%fos_user.model.user.class%"] tags: - { name: form.type, alias: sonata_user_registration } sonata.child.registration.form.type: class: Application\Sonata\UserBundle\Form\Type\ChildFormType arguments: [ "%fos_user.model.user.class%"] tags: - { name: form.type, alias: sonata_child_registration } sonata.user.registration.form.handler.default: class: Application\Sonata\UserBundle\Form\Handler\RegistrationFormHandler scope: request public: false arguments: [@fos_user.registration.form, @request, @fos_user.user_manager, @fos_user.mailer, @fos_user.util.token_generator] </code></pre> <p>Here is my sonata user configuration(app/config/config.yml)</p> <pre><code>sonata_user: security_acl: false manager_type: orm # Can be orm for mongodb table: user_group: "my_custom_user_group_association_table_name" impersonating: route: page_slug parameters: { path: / } class: # Entity Classes user: Application\Sonata\UserBundle\Entity\User group: Application\Sonata\UserBundle\Entity\Group admin: # Admin Classes user: class: Sonata\UserBundle\Admin\Entity\UserAdmin controller: SonataAdminBundle:CRUD translation: SonataUserBundle group: class: Sonata\UserBundle\Admin\Entity\GroupAdmin controller: SonataAdminBundle:CRUD translation: SonataUserBundle profile: # Profile Form (firstname, lastname, etc ...) form: type: sonata_user_profile handler: sonata.user.profile.form.handler.default name: sonata_user_profile_form validation_groups: [Profile] register: # You may customize the registration forms over here form: type: sonata_user_registration handler: sonata.user.registration.form.handler.default name: sonata_user_registration_form validation_groups: # Defaults: - Registration - Default </code></pre> <p>My twig rendering:</p> <pre><code>{% block fos_user_content %} &lt;br&gt; &lt;div class="row"&gt; &lt;div class="col-md-6 col-md-offset-3"&gt; &lt;div class="well"&gt; &lt;div class="panel-heading"&gt; &lt;h3&gt;{{ 'title_user_registration'|trans({}, 'SonataUserBundle') }}&lt;/h3&gt; &lt;/div&gt; &lt;div class="panel-body"&gt; &lt;form ng-app="userRegistrationApp" action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register form-horizontal"&gt; &lt;h4&gt;{{ 'General'|trans({}, 'SonataUserBundle') }}&lt;/h4&gt; &lt;hr&gt; &lt;div class="form-group"&gt; {{ form_label(form.username, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.username, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.email, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.email, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;br&gt; &lt;h4&gt;{{ 'form.label_plain_password'|trans({}, 'SonataUserBundle') }}&lt;/h4&gt; &lt;hr&gt; &lt;div class="form-group"&gt; {{ form_label(form.plainPassword.first, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.plainPassword.first, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.plainPassword.second, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.plainPassword.second, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;br&gt; &lt;h4&gt;{{ 'Profile'|trans({}, 'SonataUserBundle') }}&lt;/h4&gt; &lt;hr&gt; &lt;div class="form-group"&gt; {{ form_label(form.lastName, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.lastName, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.firstName, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.firstName, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.date_of_birth, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.date_of_birth, {'attr': {'class': '' }}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.gender, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.gender, {'attr': {'class': ''}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.phone, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.phone, {'attr': {'class': 'form-control bfh-phone', 'data-country':'sonata_user_registration_form_country'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.address, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.address, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.city, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.city, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.country, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.country, {'attr': {'class': 'form-control bfh-countries', ' data-country':'US'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.state, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.state, {'attr': {'class': 'form-control bfh-states', 'data-country':'sonata_user_registration_form_country'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; {{ form_label(form.postalCode, null, {'label_attr': {'class': 'col-xs-4 control-label'}}) }} &lt;div class="col-xs-8"&gt; {{ form_widget(form.postalCode, {'attr': {'class': 'form-control'}}) }} &lt;/div&gt; &lt;/div&gt; &lt;br&gt; {{ form_rest(form) }} {#&lt;a href="#Children" class="btn btn-link" ng-click="userRegistrationService.addEmptyChild()"&gt;&lt;span class="glyphicon glyphicon-plus-sign"&gt;&lt;/span&gt; {{ 'AddAChildren'|trans({}, 'SonataUserBundle') }}&lt;/a&gt;#} &lt;div class="form-actions"&gt; &lt;button type="submit" class="btn btn-success pull-right"&gt;{{ 'registration.submit'|trans({}, 'FOSUserBundle') }}&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; {% endblock fos_user_content %} </code></pre> <p>I really don't know why I get the error:</p> <pre><code>array (size=1) 0 =&gt; object(Symfony\Component\Form\FormError)[1125] private 'message' =&gt; string 'Le jeton CSRF est invalide. Veuillez renvoyer le formulaire.' (length=60) protected 'messageTemplate' =&gt; string 'Le jeton CSRF est invalide. Veuillez renvoyer le formulaire.' (length=60) protected 'messageParameters' =&gt; array (size=0) empty protected 'messagePluralization' =&gt; null </code></pre> <p>because I have in my page <code>{{form_rest(form)}}</code> and the token field is present...</p> <p><strong>UPDATE</strong> I created a github repository so that my configuration can be pulled so you can see the problems for yourself. <a href="https://github.com/ima-tech/testSonataUser" rel="nofollow">https://github.com/ima-tech/testSonataUser</a></p> </div>

openpyxl修改excel出错

Traceback (most recent call last): File "D:\project\op.py", line 8, in <module> wb.save('e:/2.xlsx') File "D:\python\lib\site-packages\openpyxl\workbook\workbook.py", line 396, in save save_workbook(self, filename) File "D:\python\lib\site-packages\openpyxl\writer\excel.py", line 294, in save_workbook writer.save() File "D:\python\lib\site-packages\openpyxl\writer\excel.py", line 276, in save self.write_data() File "D:\python\lib\site-packages\openpyxl\writer\excel.py", line 76, in write_data self._write_worksheets() File "D:\python\lib\site-packages\openpyxl\writer\excel.py", line 226, in _write_worksheets self._write_comment(ws) File "D:\python\lib\site-packages\openpyxl\writer\excel.py", line 180, in _write_comment vml = fromstring(self.workbook.vba_archive.read(ws.legacy_drawing)) AttributeError: 'NoneType' object has no attribute 'read'

微信jssdk errmsg":"invalid media_id",调试了很久,请高人指点,谢谢

我用微信的js-sdk接口的wx.chooseImage选择图片,用wx.uploadImage上传图片,再用http://file.api.weixin.qq.com /cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID上传下载多媒 体文件接口下载图片到本地服务器,可总是报错{"errcode":40007,"errmsg":"invalid media_id"}无效媒体ID错误。 1、拍照或从手机相册中选图接口,得到图片的localIds。 wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 success: function (res) { var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片 } }); 2、上传图片接口,得到serverId。 wx.uploadImage({ localId: '', // 需要上传的图片的本地ID,由chooseImage接口获得 isShowProgressTips: 1, // 默认为1,显示进度提示 success: function (res) { var serverId = res.serverId; // 返回图片的服务器端ID(serverId) } }); 备注:上传图片有效期3天,可用微信多媒体接口下载图片到自己的服务器,此处获得的 serverId 即 media_id,参考文档 ../12/58bfcfabbd501c7cd77c19bd9cfa8354.html 目前多媒体文件下载接口的频率限制为10000次/天,如需要调高频率,请邮件weixin-open@qq.com,邮件主题为【申请多媒体接口调用量】,请对你的项目进行简单描述,附上产品体验链接,并对用户量和使用量进行说明。 3、通过“下载多媒体文件”接口 http请求方式: GET http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID 下载已经上传到微信服务器的图片到本地服务器,但是总提示{"errcode":40007,"errmsg":"invalid media_id"}无效媒体ID错误。 调试了很久,就是弄不懂是什么问题,请高人指点,谢谢

无法从php exec运行sox()

<div class="post-text" itemprop="text"> <p>when i run this code in my php </p> <pre><code>$location = "/var/www/html/recordings/$date/$file"; echo shell_exec('/usr/bin/sox $location test.wav'); </code></pre> <p>i get this return </p> <pre><code>/usr/bin/sox: SoX v14.4.1 Usage summary: [gopts] [[fopts] infile]... [fopts] outfile [effect [effopt]]... SPECIAL FILENAMES (infile, outfile): - Pipe/redirect input/output (stdin/stdout); may need -t -d, --default-device Use the default audio device (where available) -n, --null Use the `null' file handler; e.g. with synth effect -p, --sox-pipe Alias for `-t sox -' SPECIAL FILENAMES (infile only): "|program [options] ..." Pipe input from external program (where supported) http://server/file Use the given URL as input file (where supported) GLOBAL OPTIONS (gopts) (can be specified at any point before the first effect): --buffer BYTES Set the size of all processing buffers (default 8192) --clobber Don't prompt to overwrite output file (default) --combine concatenate Concatenate all input files (default for sox, rec) --combine sequence Sequence all input files (default for play) -D, --no-dither Don't dither automatically --effects-file FILENAME File containing effects and options -G, --guard Use temporary files to guard against clipping -h, --help Display version number and usage information --help-effect NAME Show usage of effect NAME, or NAME=all for all --help-format NAME Show info on format NAME, or NAME=all for all --i, --info Behave as soxi(1) --input-buffer BYTES Override the input buffer size (default: as --buffer) --no-clobber Prompt to overwrite output file -m, --combine mix Mix multiple input files (instead of concatenating) --combine mix-power Mix to equal power (instead of concatenating) -M, --combine merge Merge multiple input files (instead of concatenating) --magic Use `magic' file-type detection --multi-threaded Enable parallel effects channels processing --norm Guard (see --guard) &amp; normalise --play-rate-arg ARG Default `rate' argument for auto-resample with `play' --plot gnuplot|octave Generate script to plot response of filter effect -q, --no-show-progress Run in quiet mode; opposite of -S --replay-gain track|album|off Default: off (sox, rec), track (play) -R Use default random numbers (same on each run of SoX) -S, --show-progress Display progress while processing audio data --single-threaded Disable parallel effects channels processing --temp DIRECTORY Specify the directory to use for temporary files -T, --combine multiply Multiply samples of corresponding channels from all input files (instead of concatenating) --version Display version number of SoX and exit -V[LEVEL] Increment or set verbosity level (default 2); levels: 1: failure messages 2: warnings 3: details of processing 4-6: increasing levels of debug messages FORMAT OPTIONS (fopts): Input file format options need only be supplied for files that are headerless. Output files will have the same format as the input file where possible and not overriden by any of various means including providing output format options. -v|--volume FACTOR Input file volume adjustment factor (real number) --ignore-length Ignore input file length given in header; read to EOF -t|--type FILETYPE File type of audio -e|--encoding ENCODING Set encoding (ENCODING may be one of signed-integer, unsigned-integer, floating-point, mu-law, a-law, ima-adpcm, ms-adpcm, gsm-full-rate) -b|--bits BITS Encoded sample size in bits -N|--reverse-nibbles Encoded nibble-order -X|--reverse-bits Encoded bit-order --endian little|big|swap Encoded byte-order; swap means opposite to default -L/-B/-x Short options for the above -c|--channels CHANNELS Number of channels of audio data; e.g. 2 = stereo -r|--rate RATE Sample rate of audio -C|--compression FACTOR Compression factor for output format --add-comment TEXT Append output file comment --comment TEXT Specify comment text for the output file --comment-file FILENAME File containing comment text for the output file --no-glob Don't `glob' wildcard match the following filename AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb amr-nb amr-wb anb au avr awb caf cdda cdr cvs cvsd cvu dat dvms f32 f4 f64 f8 fap flac fssd gsm gsrt hcom htk ima ircam la lpc lpc10 lu mat mat4 mat5 maud nist ogg paf prc pvf raw s1 s16 s2 s24 s3 s32 s4 s8 sb sd2 sds sf sl sln smp snd sndfile sndr sndt sou sox sph sw txw u1 u16 u2 u24 u3 u32 u4 u8 ub ul uw vms voc vorbis vox w64 wav wavpcm wv wve xa xi PLAYLIST FORMATS: m3u pls AUDIO DEVICE DRIVERS: alsa EFFECTS: allpass band bandpass bandreject bass bend biquad chorus channels compand contrast dcshift deemph delay dither divide+ downsample earwax echo echos equalizer fade fir firfit+ flanger gain highpass hilbert input# ladspa loudness lowpass mcompand mixer* noiseprof noisered norm oops output# overdrive pad phaser pitch rate remix repeat reverb reverse riaa silence sinc spectrogram speed splice stat stats stretch swap synth tempo treble tremolo trim upsample vad vol * Deprecated effect + Experimental effect # LibSoX-only effect EFFECT OPTIONS (effopts): effect dependent; see --help-effect </code></pre> <p>any help would be greatly appreciated and thank you in advance!</p> </div>

error LNK2001: 无法解析的外部符号 acrxGetApiVersion

![图片说明](https://img-ask.csdn.net/upload/201505/11/1431337123_498048.png) ![图片说明](https://img-ask.csdn.net/upload/201505/11/1431337131_783132.png) 本人小白,求详细解决方法

pcm音频格式转换成ima_adpcm音频,有杂音,望各位大侠帮忙看看。

初次接触音频转换,希望各位帮忙看看。多谢了。 这个代码我找了好多大神的博客,改了改最终确定下来的版本。 项目使用的是vs2017编译器,C语言和C++语言。 主要是采样位数为16位的pcm转换成采样位数为4位的ima_adpcm。 但是有挺大的杂音并且采样率越高,转换出来的ima_adpcm音频的杂音就越大。 望各位大侠帮忙看看,我写这个写了一个多月了。。。。。 如需可运行的整个项目,可联系我,若能帮我修改,我愿提供一定的报酬。多谢了。。。。 下面是将pcm源文件以1010个字节为一个数据块传给压缩函数 ``` for (i = 0; i < len0 - 1010; i += 1010) { // 以1010个字节截取 memcpy(data1, data + i, 1010); len += adpcm_encode_block((uint8_t *)(data2 + j * 256), (uint8_t *)data1, 1010); j++; } ``` 下面为pcm转换成ima_adpcm的具体代码 ``` /* Private define ------------------------------------------------------------*/ /* Quantizer step size lookup table */ const uint16_t StepSizeTable[89] = { 7,8,9,10,11,12,13,14,16,17, 19,21,23,25,28,31,34,37,41,45, 50,55,60,66,73,80,88,97,107,118, 130,143,157,173,190,209,230,253,279,307, 337,371,408,449,494,544,598,658,724,796, 876,963,1060,1166,1282,1411,1552,1707,1878,2066, 2272,2499,2749,3024,3327,3660,4026,4428,4871,5358, 5894,6484,7132,7845,8630,9493,10442,11487,12635,13899, 15289,16818,18500,20350,22385,24623,27086,29794,32767 }; /* Table of index changes */ const int8_t IndexTable[16] = { 0xff,0xff,0xff,0xff,2,4,6,8,0xff,0xff,0xff,0xff,2,4,6,8 }; static int16_t index = 0; //willow add static int32_t predsample = 0; /*如果按分块处理,这也是电脑上通用的IMA_ADPCM保存的格式,就需要预置index & presample的值*/ void set_index(int16_t idx) { index = idx; } void set_presample(int32_t pcm_16) { predsample = pcm_16; } uint8_t ADPCM_Encode(int32_t sample) { // static int16_t index = 0; // static int32_t predsample = 0; uint8_t code = 0; //ima_adpcm值 uint16_t tmpstep = 0; //步长 int32_t diff = 0; // 预测输出值 int32_t diffq = 0; // 当前更改值 uint16_t step = 0; // 当前步长 step = StepSizeTable[index]; /* 1. compute diff and record sign and absolut value */ /* 计算差异,记录符号和绝对值 */ diff = sample - predsample; if (diff < 0) { code = 8; diff = (-diff); } /* Note: ** This code *approximately* computes: ** code = diff*4/step; ** diffq = (code+0.5)*step/4; ** but in shift step bits are dropped. The net result of this is ** that even if you have fast mul/div hardware you cannot put it to ** good use since the fixup would be too expensive. */ /* 3. quantize the diff into ADPCM code */ /* 4. inverse quantize the code into a predicted diff */ /* 将差异量化为ADPCM代码 */ /* 将代码反量化为预测的差异 */ tmpstep = step; diffq = (step >> 3); if (diff >= tmpstep) { //code += 0.5; code |= 0x04; diff -= tmpstep; diffq += step; } tmpstep = tmpstep >> 1; if (diff >= tmpstep) { //code += 0.5; code |= 0x02; diff -= tmpstep; diffq += (step >> 1); } tmpstep = tmpstep >> 1; if (diff >= tmpstep) { //code += 0.5; code |= 0x01; diffq += (step >> 2); } /* 5. fixed predictor to get new predicted sample*/ /* 固定的预测得到新的预测样本 */ if (code & 8) { predsample -= diffq; } else { predsample += diffq; } /* check for overflow*/ /* 溢出检查*/ if (predsample > 32767) { predsample = 32767; } else if (predsample < -32768) { predsample = -32768; } /* 6. find new stepsize index */ /* 找出新的下标索引 */ index += IndexTable[code]; /* check for overflow*/ /* 检查溢出 */ if (index <0) { index = 0; } else if (index > 88) { index = 88; } /* 8. return new ADPCM code*/ /* 返回adpcm 值*/ //return (code); return (code & 0x0f); } int adpcm_encode_block(uint8_t *p_dst, uint8_t *p_src, uint32_t len) { int length = 0; int16_t *p_pcm; uint32_t i; uint8_t tmp; p_pcm = (int16_t*)p_src; set_presample(*p_pcm); //第一个不压缩 *(int16_t*)p_dst = *p_pcm++; //保存第一个采样值 p_dst += 2; len--; *p_dst++ = index; //保存index *p_dst++ = 0; //保留字节 =0 length += 8; int jj = 0; for (i = 0; i<(len >> 1); i++) { tmp = ADPCM_Encode(*p_pcm++); jj++; tmp |= ADPCM_Encode(*p_pcm++) << 4; jj++; *p_dst++ = tmp; length++; } return length / 2; } ```

JAVA 如何暂停一个正在运行的线程,再启动另一个已经暂停的线程。

package MahJong; import java.awt.Image; import java.util.Iterator; import javax.swing.ImageIcon; import javax.swing.JButton; public class Card { int i; String img; Card(int i,String img){ this.i = i; this.img = img; } } public class Frame extends JFrame{ Frame(){ new JFrame("MahJong Game"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(880, 660); setLocation( 0, 0); setVisible(true); setResizable(false); Container container = this.getContentPane(); container.setLayout(null); ImageIcon background =new ImageIcon("MahJong.jpg"); background = new ImageIcon(background.getImage().getScaledInstance(880, 660, Image.SCALE_SMOOTH)); JLabel label =new JLabel(background); label.setBounds(0, 0, this.getWidth(), this.getHeight()); JPanel mainPanel = (JPanel)this.getContentPane(); mainPanel.setOpaque(false); this.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE)); repaint(); setVisible(true); } } public class Button { Card card ; JButton btn = new JButton(); Button(Frame frame,Card card,int x,int y){ this.card = card; String ima = this.card.img; System.out.println(ima); ImageIcon img = new ImageIcon(ima); img = new ImageIcon(img.getImage().getScaledInstance(60, 50, Image.SCALE_SMOOTH)); btn.setLocation(x, y); btn.setSize(45, 50); btn.setIcon(img); frame.add(btn); frame.repaint(); } Button(Frame frame,int x,int y){ btn.setLocation(x, y); btn.setSize(45, 50); btn.setContentAreaFilled(false); frame.add(btn); frame.repaint(); } } public class tools { static int time=0,TIME = 0; static void rank(Button[] btn,Frame Frame){ int i,j;Card card = null; for(i=0;i<13;i++){ for(j=0;j<12;j++){ if(btn[j].card.i>btn[j+1].card.i){ card = btn[j].card; btn[j].card=btn[j+1].card; btn[j+1].card=card; } } } for(i=0;i<13;i++){ String ima = btn[i].card.img; ImageIcon img = new ImageIcon(ima); img = new ImageIcon(img.getImage().getScaledInstance(60, 50, Image.SCALE_SMOOTH)); btn[i].btn.setIcon(img);}} static void deal(Iterator ite,Button btn){ Card card = (Card)ite.next(); btn.card = card; String ima=card.img; ImageIcon img = new ImageIcon(ima); img = new ImageIcon(img.getImage().getScaledInstance(60, 50, Image.SCALE_SMOOTH)); btn.btn.setIcon(img); } static void out(Button[] btn,Button Jbtn,Frame Frame,Button BTN,Iterator ite){ Card out; out = Jbtn.card; TIME = time/17+TIME; if(time%17==0){time = 0;} JButton lose = new JButton(); lose.setSize(45, 50); lose.setLocation((50+(time)*45), 135+TIME*55); String ima = out.img; ImageIcon img = new ImageIcon(ima); img =new ImageIcon(img.getImage().getScaledInstance(60, 50, Image.SCALE_SMOOTH)); lose.setIcon(img); Frame.add(lose); Jbtn.card = BTN.card; ima = Jbtn.card.img; img = new ImageIcon(ima); img =new ImageIcon(img.getImage().getScaledInstance(60, 50, Image.SCALE_SMOOTH)); Jbtn.btn.setIcon(img); BTN.card = null; BTN.btn.setIcon(null); BTN.btn.setContentAreaFilled(false); rank(btn,Frame); tools.deal(ite, BTN); Frame.repaint(); time++; } static void out2(Button BTN,Frame frame,Iterator ite){ Card out; out = BTN.card; TIME = time/17+TIME; if(time%17==0){time = 0;} JButton lose = new JButton(); lose.setSize(45, 50); lose.setLocation((50+(time)*45), 135+TIME*55); String ima = out.img; ImageIcon img = new ImageIcon(ima); img =new ImageIcon(img.getImage().getScaledInstance(60, 50, Image.SCALE_SMOOTH)); lose.setIcon(img); frame.add(lose); BTN.card = null; BTN.btn.setIcon(null); BTN.btn.setContentAreaFilled(false); tools.deal(ite, BTN); frame.repaint(); time++; } } public class Mythread extends Thread{ Frame frame; Iterator ite; public Mythread(String Name,Frame frame,Iterator ite){ setName(Name); this.frame = frame; this.ite =ite; } public void run(){ int x,y; y =500; Button[] btn = new Button[13]; for(int i=0;i<13;i++){ x =50+i*45;btn[i] = new Button(frame,(Card)ite.next(),x,y); }tools.rank(btn,frame); Button BTN = new Button(frame,660,y); tools.deal(ite, BTN); for(int i=0;i<13;i++){ Button jbtn = btn[i]; btn[i].btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ tools.out(btn,jbtn,frame,BTN,ite); } }); } BTN.btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ tools.out2(BTN, frame,ite); } }); this.suspend(); } } public class AIthread extends Thread{ Frame frame; Iterator ite; public AIthread(String Name,Frame frame,Iterator ite){ setName(Name); this.frame = frame; this.ite =ite; } public void run(){ int x,y; y =80; Button[] btn = new Button[13]; for(int i=0;i<13;i++){ x =50+i*45;btn[i] = new Button(frame,(Card)ite.next(),x,y); }tools.rank(btn,frame); Button BTN = new Button(frame,660,y); tools.deal(ite, BTN); for(int i=0;i<13;i++){ Button jbtn = btn[i]; btn[i].btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ tools.out(btn,jbtn,frame,BTN,ite); } }); } BTN.btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ tools.out2(BTN, frame,ite); } }); } } public class test { public static void main(String[] agrs){ int i,j; Frame mainFrame = new Frame(); ArrayList list = new ArrayList(); Card[] MJ = new Card[64]; String IMG[]={"A.jpg","B.jpg","C.jpg","D.jpg","E.jpg","F.jpg","G.jpg","H.jpg" ,"I.jpg","J.jpg","K.jpg","L.jpg","M.jpg","N.jpg","O.jpg","P.jpg"}; for(i=0;i<16;i++){ for(j=0;j<4;j++){ MJ[j+i*4] = new Card(i,IMG[i]); list.add(MJ[j+i*4]);} } Collections.shuffle(list);//打乱list Iterator ite = list.iterator(); Mythread player = new Mythread("player",mainFrame,ite); AIthread AI = new AIthread("AI",mainFrame,ite); player.start(); AI.start(); } }

关于java swing的一点问题

package 最短路径; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextField; public class floyed extends JFrame { public int map[][]; public int numberofpoint; public int numberofedge; public int minnum; public floyed() { this.setSize(300, 400); this.setVisible(true); this.setTitle("Floyed algorithm"); Container c=this.getContentPane(); this.setLayout(new FlowLayout(1,5,5)); JTextField tb=new JTextField("B",20); JTextField tf=new JTextField("F",20); JTextField t0=new JTextField("numberofpoint",20); JTextField t00=new JTextField("numberedge",20); JTextField t1=new JTextField("begin",20); JTextField t2=new JTextField("final",20); JTextField t3=new JTextField("length",20); JTextField t4=new JTextField("最短路径长度",20); JButton k1=new JButton("collect"); JButton k2=new JButton("count"); JButton k3=new JButton("init"); c.add(tb);c.add(tf); c.add(t0);c.add(t00); c.add(t1);c.add(t2);c.add(t3); c.add(t4); c.add(k1);c.add(k2);c.add(k3); k3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO 自动生成的方法存根 init(); tb.setText("B"); tf.setText("F"); t0.setText("numberofpoint"); t00.setText("numberofedge"); t1.setText("begin"); t2.setText("final"); t3.setText("length"); t4.setText("最短路径"); } }); tb.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO 自动生成的方法存根 if(tb.getText().equals("")==true) tb.setText("B"); } @Override public void focusGained(FocusEvent e) { // TODO 自动生成的方法存根 tb.setText(""); } }); tf.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO 自动生成的方法存根 if(tf.getText().equals("")==true) tf.setText("F"); } @Override public void focusGained(FocusEvent e) { // TODO 自动生成的方法存根 tf.setText(""); } }); t0.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO 自动生成的方法存根 if(t0.getText().equals("")==true) t0.setText("numberofpoint"); } @Override public void focusGained(FocusEvent e) { // TODO 自动生成的方法存根 t0.setText(""); } }); t00.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO 自动生成的方法存根 if(t00.getText().equals("")==true) t00.setText("numberofedge"); } @Override public void focusGained(FocusEvent e) { // TODO 自动生成的方法存根 t00.setText(""); } }); t1.addFocusListener(new FocusListener() { public void focusLost(FocusEvent e) { if(t1.getText().equals("")==true) t1.setText("begin"); } public void focusGained(FocusEvent e) { t1.setText(""); } }); t2.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO 自动生成的方法存根 if(t2.getText().equals("")==true) t2.setText("final"); } @Override public void focusGained(FocusEvent e) { // TODO 自动生成的方法存根 t2.setText(""); } }); t3.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO 自动生成的方法存根 if(t3.getText().equals("")==true) t3.setText("length"); } @Override public void focusGained(FocusEvent e) { // TODO 自动生成的方法存根 t3.setText(""); } }); t4.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO 自动生成的方法存根 t4.setText("最短路径长度"); } @Override public void focusGained(FocusEvent e) { // TODO 自动生成的方法存根 t4.setText(""); } }); k1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO 自动生成的方法存根 int a,b,c; numberofpoint=Integer.parseInt(t0.getText()); numberofedge=Integer.parseInt(t00.getText()); a=Integer.parseInt(t1.getText()); b=Integer.parseInt(t2.getText()); c=Integer.parseInt(t3.getText()); map[a][b]=c; } }); k2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO 自动生成的方法存根 int kb=Integer.parseInt(tb.getText()); int kf=Integer.parseInt(tf.getText()); for(int i=1;i<=numberofpoint;i++) { for(int j=1;j<=numberofpoint;j++) { for(int k=1;k<=numberofpoint;k++) { if(map[j][k]>map[j][i]+map[i][k]) { map[j][k]=map[j][i]+map[i][k]; } } } } minnum=map[kb][kf]; t4.setText(""+minnum); } }); init(); } public void init() { map=new int[10000][10000]; for(int i=1;i<=10000;i++) { for(int j=1;j<=10000;j++) { map[i][j]=9999999; if(i==j) map[i][j]=0; } } numberofpoint=numberofedge=0; minnum=9999999; } } 出现的问题是,我想通过collect按钮不断收集参数,最终通过count进行最短路径的计算,但是最后的结果是,始终是返回0,或者返回错的值,看不出问题在哪里,求教

大神看看,为什么飞机不会动.

运行,按下上键等,无反应. 求解决. 以下代码. ``` package cn.sst; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; public class GameUtil { // 工具类最好将构造器私有化。 private GameUtil() { } public static Image getImage(String path) { BufferedImage bi = null; try { URL u = GameUtil.class.getClassLoader().getResource(path); bi = ImageIO.read(u); } catch (IOException e) { e.printStackTrace(); } return bi; } } ``` ``` package cn.sst; import javax.swing.JFrame; import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class MyGameFrame extends JFrame { Image bgImg = GameUtil.getImage("images/bg.jpeg"); Image planeImg = GameUtil.getImage("images/plane.png"); Plane plane =new Plane(planeImg,250,250,5); private Image offScreenImage = null; public void update(Graphics g) { if(offScreenImage == null) offScreenImage = this.createImage(500,500);//这是游戏窗口的宽度和高度 Graphics gOff = offScreenImage.getGraphics(); paint(gOff); g.drawImage(offScreenImage, 0, 0, null); } public void paint(Graphics g) { g.drawImage(bgImg, 0, 0, null); plane.drawSelf(g); } public static void main(String[] args) { MyGameFrame f = new MyGameFrame(); f.launchFrame(); } public void launchFrame() { this.setTitle("123"); this.setVisible(true); this.setSize(600, 600); this.setLocation(700, 300); ////增加关闭窗口监听,这样用户点击右上角关闭图标,可以关闭游戏程序 this.addWindowListener(new WindowAdapter() { public void Windowclosing(WindowEvent E) { System.exit(0); } }); new PaintThread().start(); } class PaintThread extends Thread { public void run() { while (true) { repaint(); try { Thread.sleep(40); //1s = 1000ms } catch (InterruptedException e) { e.printStackTrace(); } } } } class KeyMonitor extends KeyAdapter{//定义键盘 @Override public void keyPressed(KeyEvent e) { plane.adddirection(e); } @Override public void keyReleased(KeyEvent e) { plane.minusdirection(e); } } } ``` ` ``` ````` ``` package cn.sst; import java.awt.*; public class GameObject { Image img; double x,y; int speed; int width,height; public void drawSelf(Graphics g) { g.drawImage(img,(int)x,(int)y,null); } public GameObject(Image img, double x, double y, int speed, int width, int height) { super(); this.img = img; this.x = x; this.y = y; this.speed = speed; this.width = width; this.height = height; } public GameObject(Image img, double x, double y) { this.img = img; this.x = x; this.y = y; } public GameObject(Image img, double x, double y, int speed) { this.img = img; this.x = x; this.y = y; this.speed = speed; } public GameObject() { } } ![图片说明](https://img-ask.csdn.net/upload/201904/29/1556542340_634406.png) ![图片说明](https://img-ask.csdn.net/upload/201904/29/1556542351_280821.png)

在codeigniter中使用ajax添加图像 - 不要保存数据

<div class="post-text" itemprop="text"> <p>I need your help in the following code, and spent looking for solutions and none is useful, when I try to save does not save anything in the database, could you help me. </p> <p><strong>This is my VIEW</strong></p> <pre><code> &lt;div class="modal fade" id="add_modal_para" tabindex="-1" role="dialog" aria-labelledby="title" aria-hidden="true"&gt; &lt;div class="modal-dialog" role="document"&gt; &lt;div class="modal-content"&gt; &lt;div class="modal-header"&gt; &lt;h5 class="modal-title" id="title" style="font-weight: 700;"&gt;Agregar&lt;/h5&gt; &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt; &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt; &lt;/button&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;form method="post" id="form_add_para" enctype="multipart/form-data"&gt; &lt;div class="input-group mb-3"&gt; &lt;div class="input-group-prepend"&gt; &lt;span class="input-group-text" id="basic-addon1"&gt;&lt;i class="fas fa-poop"&gt;&lt;/i&gt;&lt;/span&gt; &lt;/div&gt; &lt;input type="text" name="txt_firtsname_para" id="txt_firtsname_para" class="form-control" placeholder="Nombres" maxlength="50" aria-label="Nombres" aria-describedby="basic-addon1" data-validation-error-msg-container="#txt_firtsname-error-dialog" data-validation="required custom length" data-validation-regexp="^[a-zA-Z\s]+$" data-validation-length="min3" data-validation-length="max50"&gt; &lt;/div&gt; &lt;div id="txt_firtsname-error-dialog"&gt;&lt;/div&gt; &lt;div class="input-group mb-3"&gt; &lt;div class="input-group-prepend"&gt; &lt;label for="txt_avatar"&gt;Imagen&lt;/label&gt; &lt;/div&gt; &lt;input type="file" class="form-control-file" id="txt_avatar_para" name="txt_avatar_para"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;button type="submit" id="btn_add_para" class="btn btn-success"&gt;&lt;i class="fas fa-save"&gt;&lt;/i&gt; Guardar&lt;/button&gt; &lt;button type="button" class="btn btn-secondary" data-dismiss="modal"&gt;&lt;i class="fas fa-sign-in-alt"&gt;&lt;/i&gt; Cerrar&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>This is my AJAX code</strong></p> <pre><code>$('#submit').submit(function(e){ e.preventDefault(); $.ajax({ url: baseurl+'app/Paramilitar/add_Para', type: "POST", data: new FormData(this), dataType: "JSON", processData:false, contentType:false, cache:false, async:false, success: function(data){ $("#form_add_para")[0].reset(); $('#add_modal_para').modal('hide'); show_para_table(); } }); }); </code></pre> <p><strong>This is my CONTROLLER</strong></p> <pre><code>public function add_Para(){ $config['upload_path']='./assets/uploads/'; $config['allowed_types']='jpeg|jpg|png'; $config['encrypt_name'] = TRUE; $this-&gt;load-&gt;library('upload', $config); if($this-&gt;upload-&gt;do_upload('txt_avatar_para')) { $data_ima = array('upload_data' =&gt; $this-&gt;upload-&gt;data()); $data_person = array( 'id_person_type' =&gt; '3', 'firtsname' =&gt; $this-&gt;input-&gt;post('txt_firtsname_para'), 'avatar' =&gt; $data_ima['upload_data']['file_name'], 'active' =&gt; '1' ); $data_result= $this-&gt;Person_model-&gt;Insert_Person($data_person); echo json_encode($data_result); } </code></pre> <p><strong>This is my MODEL</strong> Model example:<br> public function Insert_Person($data_person) { $data_result= $this-&gt;db-&gt;insert('tbl_person',$data_person); return $data_result; }</p> </div>

labview应该怎么把image图像传入到python中

**首先说下配置,labview2018 32位 python3.6 32位,用的labview自带调用python** 以下面代码,把labview独特行形式的image转换成8位的2维数组,把数组导入Python中,然后运行labview,会出现错误 Invalid number of channels in input image: 'VScn::contains(scn)' where 'scn' is 1 经分析图片数据后,发现导入的数组python识别成为1通道 , cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) 只能处理3通道的,所以想到利用 ima = cv2.merge([img0, img0, img0]) 函数创造一个3通道的灰度图,现在又报错 Unsupported depth of input image: 'VDepth::contains(depth)' where 'depth' is 4 (CV_32S) 说是出现透明通道了, **最后问下有没有大佬目前或者以前做过这种项目,望指点一下,怎么把image传入python还能在python中正常灰度再二值** ![图片说明](https://img-ask.csdn.net/upload/202007/09/1594261315_386232.png) ![图片说明](https://img-ask.csdn.net/upload/202007/09/1594261339_785547.png)

微信小程序VM2557:2 Failed to load image

VM2557:2 Failed to load image http://1392843813.debug.open.weixin.qq.com/pages/posts/post-detail/post-detail : the server responded with a status of 404 (HTTP/1.1 404 Not Found) From server 127.0.0.1 我的页面里图片都加载出来了,为什么会报这个错误

使用cURL将带有PHP的文件上传到ima​​geshack

<div class="post-text" itemprop="text"> <p>I am trying to upload a file to imageshack using following script:</p> <pre><code>$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://post.imageshack.us/'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_POST, true); $post = array( 'fileupload'=&gt; '@../../resources/images/cancel.png', 'optsize' =&gt; 'resample', 'rembar' =&gt; '1' ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $response = curl_exec($ch); curl_close($ch); echo $response; </code></pre> <p>However, I get following error from imageshack:</p> <p><code>Wrong file type detected for file cancel.png:application/octet-stream</code>.</p> <p>Why is that, and how can it be fixed? Thanks in advance!</p> <p><strong>EDIT:</strong> It does work when I use JPGs or GIFs (even animated ones, although Imageshack then de-animates them, I think by only using the first frame), but not with PNGs.</p> <p><strong>EDIT 2:</strong> I found out how to fix it. As stated earlier, it does only accept JPGs and GIFs. So I take the location of the image I need to upload, copy it to a temporary location <em>with the ending <code>.jpg</code></em>, upload the file, and then, upon completion, I remove the file from the temporary location.</p> </div>

哪位指标大哥空闲帮我写一个指标___通达信的源码改成MT4的

![图片说明](https://img-ask.csdn.net/upload/201906/14/1560524671_651951.png) M:1,11111,12: N:2,3,2: D:2,3,3: MA9 : MA(CLOSE,M*(9/12)*(N/2)*(D/3)),COLORRED,LINETHICK2; MA12 : MA(CLOSE,M*(N/2)*(D/3)),COLORYELLOW,LINETHICK2; MA18 : MA(CLOSE,M*2*(9/12)*(N/2)*(D/3)),COLORRED,LINETHICK2; MA27 : MA(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORGREEN,LINETHICK2; UP: MA27 + 1*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORGREEN,DOTLINE; LO: MA27 - 1*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORGREEN,DOTLINE; UP1: MA27 + 2*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORRED,DOTLINE; LO1: MA27 - 2*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORRED,DOTLINE; 下面是MT4的均线代码 ——只需要在这个基础上把布林加上就可以了,老师!非常感谢您! //+------------------------------------------------------------------+ //| 三色均线指标.mq4 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 3 //--- plot MA1 #property indicator_label1 "MA9" #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot MA2 #property indicator_label2 "MA12" #property indicator_type2 DRAW_LINE #property indicator_color2 clrYellow #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- plot MA3 #property indicator_label3 "MA26" #property indicator_type3 DRAW_LINE #property indicator_color3 clrGreen #property indicator_style3 STYLE_SOLID #property indicator_width3 1 //--- indicator buffers double MA1Buffer[]; double MA2Buffer[]; double MA3Buffer[]; input int M=12;// input int N=2;// input int D=3;// input int shift=0;//平移 input ENUM_MA_METHOD method=MODE_SMA;//类型 input ENUM_APPLIED_PRICE price=PRICE_CLOSE;//应用于 int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,MA1Buffer); SetIndexBuffer(1,MA2Buffer); SetIndexBuffer(2,MA3Buffer); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- int shu=0; if(prev_calculated==0) { shu=rates_total; } else { shu=rates_total-prev_calculated+1; } for(int i=0;i<shu;i++) { MA1Buffer[i]=iMA(Symbol(),0,(int)(M*(9.0/12.0)*(N/2.0)*(D/3.0)),shift,method,price,i); MA2Buffer[i]=iMA(Symbol(),0,(int)(M*(N/2.0)*(D/3.0)),shift,method,price,i); MA3Buffer[i]=iMA(Symbol(),0,(int)(M*(26.0/12.0)*(N/2.0)*(D/3.0)),shift,method,price,i); } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+

Python3.5版本,怎样才能成功安装face_recognition库?

win7系统,Python3.5版本,已经成功安装dlib 库,当pip install face_recognition时, 为什么还会出现Failed building wheel for dlib![图片说明](https://img-ask.csdn.net/upload/201810/18/1539861984_452784.jpg) ``` ``` ``` ```

有人会Qt调用yolo检测视频的吗?error: C2664: “std::vector<bbox_t,std::allocator<_Ty>> Detector::detect(image_t,float,bool)”: 无法将参数 1 从“cv::Mat”转换为“std::string” with [ _Ty=bbox_t ]

使用Yolov3中的Detector类老是报错: error: C2664: “std::vector<bbox_t,std::allocator<_Ty>> Detector::detect(image_t,float,bool)”: 无法将参数 1 从“cv::Mat”转换为“std::string” with [ _Ty=bbox_t ] ``` void MainWindow::on_pushbutton_video() { std::string names_file = "E:/YoloTest/coco.names"; std::string cfg_file = "E:/YoloTest/yolov3.cfg"; std::string weights_file = "E:/YoloTest/yolov3.weights"; Detector detector(cfg_file,weights_file,0); //std::vector<std::string> obj_names = objects_names_from_file(names_file); //调用获得分类对象名称 //或者使用以下四行代码也可实现读入分类对象文件 std::vector<std::string> obj_names; std::ifstream ifs(names_file.c_str()); std::string line; while (getline(ifs, line)) obj_names.push_back(line); capture.open("E:/YoloTest/test1.mp4"); if (!capture.isOpened()) { printf("文件打开失败"); } cv::Mat frame; while (true) { capture >> frame; std::vector<bbox_t> result_vec = detector.detect(frame); draw_boxes(frame, result_vec, obj_names); cv::namedWindow("test", CV_WINDOW_NORMAL); cv::imshow("test", frame); cv::waitKey(3); } } ``` 求助orz

iOS中动态cell的高度问题。cell中有一个固定高度的view,动态的label,求指教???

- (void)setCellInfo:(PropertyClassifiedsModel *)model { //时间所在的view UIView *timeView = [[UIView alloc] init]; [self.contentView addSubview:timeView]; [timeView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView.mas_top); make.left.equalTo(self.contentView.mas_left); make.size.mas_equalTo(CGSizeMake(Width, 54)); }]; UIImageView *ima = [[UIImageView alloc] init]; [self.contentView addSubview:ima]; self.notificationLabelContents = [[UILabel alloc] init]; [ima addSubview:self.notificationLabelContents]; ima.backgroundColor = [UIColor whiteColor]; [ima mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(timeView.mas_bottom); make.left.equalTo(self.notificationImageView.mas_right).offset(10); make.right.equalTo(self.contentView.mas_right).offset(-10); make.height.equalTo(self.notificationLabelContents).offset(20); }]; //通知的具体内容 // self.notificationLabelContents = [[UILabel alloc] init]; // [ima addSubview:self.notificationLabelContents]; [self.notificationLabelContents mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(ima).with.offset(10); make.left.equalTo(ima.mas_left).with.offset(10); make.right.equalTo(ima).with.offset(-10); make.bottom.equalTo(ima).with.offset(-10); }]; self.notificationLabelContents.textColor = [UIColor blackColor]; self.notificationLabelContents.font = [UIFont systemFontOfSize:15]; self.notificationLabelContents.text = model.notificationContents; self.notificationLabelContents.lineBreakMode = UILineBreakModeCharacterWrap; self.notificationLabelContents.numberOfLines = 0; CGSize size = [self.notificationLabelContents sizeThatFits:CGSizeMake(self.frame.size.width, MAXFLOAT)]; self.notificationLabelContents.frame = CGRectMake(60, 44, size.width, size.height); NSLog(@"%f",size.height); CGRect cellRrect = self.contentView.frame; cellRrect.size.height = timeView.frame.size.height + ima.frame.size.height; self.contentView.frame = cellRrect; } 直接写的预估高度 self.PropertyClassifiedsTableView.rowHeight = UITableViewAutomaticDimension; self.PropertyClassifiedsTableView.estimatedRowHeight = 350; self.edgesForExtendedLayout = UIRectEdgeNone;

新手--gallery怎么不能显示图片

package com.example.gallery; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Gallery; import android.widget.Toast; public class MainActivity extends Activity implements OnItemClickListener { private Gallery gallery; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); gallery=(Gallery) findViewById(R.id.gallery1); gallery.setAdapter(new ImageAdapter(this));//设置图片适配器 //点击图片监听 gallery.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Toast.makeText(MainActivity.this, "点击了第"+arg2+"张图片", Toast.LENGTH_LONG).show(); } }); } @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { } } //Adpater的class package com.example.gallery; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.ImageView; public class ImageAdapter extends BaseAdapter{ private Context context; private Integer[] ima; public ImageAdapter(Context context){ this.context=context; ima=new Integer[]{ R.drawable.ima01, R.drawable.ima02, R.drawable.ima03 }; } @Override public int getCount() { // 返回获得的图片数目 return ima.length; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ImageView imageview=new ImageView(context); imageview.setImageResource(position); imageview.setScaleType(ImageView.ScaleType.FIT_XY); imageview.setLayoutParams(new Gallery.LayoutParams(136,88)); return imageview; } } //xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Gallery android:id="@+id/gallery1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:background="?android:galleryItemBackground" /> </LinearLayout> 求各位师兄师姐解答,谢谢啦

linux下利用/proc进行进程树的打印

在linux下利用c语言实现的进程树的打印,主要通过/proc下的目录中的进程文件,获取status中的进程信息内容,然后利用递归实现进程树的打印

设计模式(JAVA语言实现)--20种设计模式附带源码

课程亮点: 课程培训详细的笔记以及实例代码,让学员开始掌握设计模式知识点 课程内容: 工厂模式、桥接模式、组合模式、装饰器模式、外观模式、享元模式、原型模型、代理模式、单例模式、适配器模式 策略模式、模板方法模式、观察者模式、迭代器模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式 课程特色: 笔记设计模式,用笔记串连所有知识点,让学员从一点一滴积累,学习过程无压力 笔记标题采用关键字标识法,帮助学员更加容易记住知识点 笔记以超链接形式让知识点关联起来,形式知识体系 采用先概念后实例再应用方式,知识点深入浅出 提供授课内容笔记作为课后复习以及工作备查工具 部分图表(电脑PC端查看):

Python数据分析与挖掘

92讲视频课+16大项目实战+源码+¥800元课程礼包+讲师社群1V1答疑+社群闭门分享会=99元 &nbsp; 为什么学习数据分析? &nbsp; &nbsp; &nbsp; 人工智能、大数据时代有什么技能是可以运用在各种行业的?数据分析就是。 &nbsp; &nbsp; &nbsp; 从海量数据中获得别人看不见的信息,创业者可以通过数据分析来优化产品,营销人员可以通过数据分析改进营销策略,产品经理可以通过数据分析洞察用户习惯,金融从业者可以通过数据分析规避投资风险,程序员可以通过数据分析进一步挖掘出数据价值,它和编程一样,本质上也是一个工具,通过数据来对现实事物进行分析和识别的能力。不管你从事什么行业,掌握了数据分析能力,往往在其岗位上更有竞争力。 &nbsp;&nbsp; 本课程共包含五大模块: 一、先导篇: 通过分析数据分析师的一天,让学员了解全面了解成为一个数据分析师的所有必修功法,对数据分析师不在迷惑。 &nbsp; 二、基础篇: 围绕Python基础语法介绍、数据预处理、数据可视化以及数据分析与挖掘......这些核心技能模块展开,帮助你快速而全面的掌握和了解成为一个数据分析师的所有必修功法。 &nbsp; 三、数据采集篇: 通过网络爬虫实战解决数据分析的必经之路:数据从何来的问题,讲解常见的爬虫套路并利用三大实战帮助学员扎实数据采集能力,避免没有数据可分析的尴尬。 &nbsp; 四、分析工具篇: 讲解数据分析避不开的科学计算库Numpy、数据分析工具Pandas及常见可视化工具Matplotlib。 &nbsp; 五、算法篇: 算法是数据分析的精华,课程精选10大算法,包括分类、聚类、预测3大类型,每个算法都从原理和案例两个角度学习,让你不仅能用起来,了解原理,还能知道为什么这么做。

广工操作系统课程设计(文档+代码+可执行文件)

实现作业调度(先来先服务)、进程调度功能(时间片轮转) 实现内存管理功能(连续分配)。 实现文件系统功能(选作) 这些功能要有机地连接起来

Only老K说-爬取妹子图片(简单入门)

安装第三方请求库 requests 被网站禁止了访问 原因是我们是Python过来的 重新给一段 可能还是存在用不了,使用网页的 编写代码 上面注意看匹配内容 User-Agent:请求对象 AppleWebKit:请求内核 Chrome浏览器 //请求网页 import requests import re //正则表达式 就是去不规则的网页里面提取有规律的信息 headers = { 'User-Agent':'存放浏览器里面的' } response = requests.get

linux“开发工具三剑客”速成攻略

工欲善其事,必先利其器。Vim+Git+Makefile是Linux环境下嵌入式开发常用的工具。本专题主要面向初次接触Linux的新手,熟练掌握工作中常用的工具,在以后的学习和工作中提高效率。

Python代码实现飞机大战

文章目录经典飞机大战一.游戏设定二.我方飞机三.敌方飞机四.发射子弹五.发放补给包六.主模块 经典飞机大战 源代码以及素材资料(图片,音频)可从下面的github中下载: 飞机大战源代码以及素材资料github项目地址链接 ————————————————————————————————————————————————————————— 不知道大家有没有打过飞机,喜不喜欢打飞机。当我第一次接触这个东西的时候,我的内心是被震撼到的。第一次接触打飞机的时候作者本人是身心愉悦的,因为周边的朋友都在打飞机, 每

Python数据清洗实战入门

本次课程主要以真实的电商数据为基础,通过Python详细的介绍了数据分析中的数据清洗阶段各种技巧和方法。

2019 Python开发者日-培训

本次活动将秉承“只讲技术,拒绝空谈”的理念,邀请十余位身处一线的Python技术专家,重点围绕Web开发、自动化运维、数据分析、人工智能等技术模块,分享真实生产环境中使用Python应对IT挑战的真知灼见。此外,针对不同层次的开发者,大会还安排了深度培训实操环节,为开发者们带来更多深度实战的机会。

apache-jmeter-5.1.1(Requires Java 8+).zip

。Apache JMeter 5.1.1 (Requires Java 8+),需要jdk8以上的版本。

数通HCNP中文理论全套教材.rar

内涵HCNP-IENP中文理论书-内文,

Python可以这样学(第四季:数据分析与科学计算可视化)

董付国老师系列教材《Python程序设计(第2版)》(ISBN:9787302436515)、《Python可以这样学》(ISBN:9787302456469)配套视频,在教材基础上又增加了大量内容,通过实例讲解numpy、scipy、pandas、statistics、matplotlib等标准库和扩展库用法。

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

我以为我对Mysql事务很熟,直到我遇到了阿里面试官

太惨了,面试又被吊打

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

图书管理系统(Java + Mysql)我的第一个完全自己做的实训项目

图书管理系统 Java + MySQL 完整实训代码,MVC三层架构组织,包含所有用到的图片资源以及数据库文件,大三上学期实训,注释很详细,按照阿里巴巴Java编程规范编写

Python数据挖掘简易入门

&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。

C/C++学习指南全套教程

C/C++学习的全套教程,从基本语法,基本原理,到界面开发、网络开发、Linux开发、安全算法,应用尽用。由毕业于清华大学的业内人士执课,为C/C++编程爱好者的教程。

微信公众平台开发入门

本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

2021考研数学张宇基础30讲.pdf

张宇:博士,全国著名考研数学辅导专家,教育部“国家精品课程建设骨干教师”,全国畅销书《张宇高等数学18讲》《张宇线性代数9讲》《张宇概率论与数理统计9讲》《张宇考研数学题源探析经典1000题》《张宇考

专为程序员设计的数学课

<p> 限时福利限时福利,<span>15000+程序员的选择!</span> </p> <p> 购课后添加学习助手(微信号:csdn590),按提示消息领取编程大礼包!并获取讲师答疑服务! </p> <p> <br> </p> <p> 套餐中一共包含5门程序员必学的数学课程(共47讲) </p> <p> 课程1:《零基础入门微积分》 </p> <p> 课程2:《数理统计与概率论》 </p> <p> 课程3:《代码学习线性代数》 </p> <p> 课程4:《数据处理的最优化》 </p> <p> 课程5:《马尔可夫随机过程》 </p> <p> <br> </p> <p> 哪些人适合学习这门课程? </p> <p> 1)大学生,平时只学习了数学理论,并未接触如何应用数学解决编程问题; </p> <p> 2)对算法、数据结构掌握程度薄弱的人,数学可以让你更好的理解算法、数据结构原理及应用; </p> <p> 3)看不懂大牛代码设计思想的人,因为所有的程序设计底层逻辑都是数学; </p> <p> 4)想学习新技术,如:人工智能、机器学习、深度学习等,这门课程是你的必修课程; </p> <p> 5)想修炼更好的编程内功,在遇到问题时可以灵活的应用数学思维解决问题。 </p> <p> <br> </p> <p> 在这门「专为程序员设计的数学课」系列课中,我们保证你能收获到这些:<br> <br> <span> </span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">①价值300元编程课程大礼包</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">②应用数学优化代码的实操方法</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">③数学理论在编程实战中的应用</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">④程序员必学的5大数学知识</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">⑤人工智能领域必修数学课</span> </p> <p> <br> 备注:此课程只讲程序员所需要的数学,即使你数学基础薄弱,也能听懂,只需要初中的数学知识就足矣。<br> <br> 如何听课? </p> <p> 1、登录CSDN学院 APP 在我的课程中进行学习; </p> <p> 2、登录CSDN学院官网。 </p> <p> <br> </p> <p> 购课后如何领取免费赠送的编程大礼包和加入答疑群? </p> <p> 购课后,添加助教微信:<span> csdn590</span>,按提示领取编程大礼包,或观看付费视频的第一节内容扫码进群答疑交流! </p> <p> <img src="https://img-bss.csdn.net/201912251155398753.jpg" alt=""> </p>

DDR5_Draft_Spec_Rev05c.pdf

DDR5 spec

Java面试史上最全的JAVA专业术语面试100问 (前1-50)

前言: 说在前面, 面试题是根据一些朋友去面试提供的,再就是从网上整理了一些。 先更新50道,下一波吧后面的也更出来。 求赞求关注!! 废话也不多说,现在就来看看有哪些面试题 1、面向对象的特点有哪些? 抽象、继承、封装、多态。 2、接口和抽象类有什么联系和区别? 3、重载和重写有什么区别? 4、java有哪些基本数据类型? 5、数组有没有length()方法?String有没有length()方法? 数组没有length()方法,它有length属性。 String有length()方法。 集合求长度用

网络工程师小白入门--【思科CCNA、华为HCNA等网络工程师认证】

本课程适合CCNA或HCNA网络小白同志,高手请绕道,可以直接学习进价课程。通过本预科课程的学习,为学习网络工程师、思科CCNA、华为HCNA这些认证打下坚实的基础! 重要!思科认证2020年2月24日起,已启用新版认证和考试,包括题库都会更新,由于疫情原因,请关注官网和本地考点信息。题库网络上很容易下载到。

C/C++跨平台研发从基础到高阶实战系列套餐

一 专题从基础的C语言核心到c++ 和stl完成基础强化; 二 再到数据结构,设计模式完成专业计算机技能强化; 三 通过跨平台网络编程,linux编程,qt界面编程,mfc编程,windows编程,c++与lua联合编程来完成应用强化 四 最后通过基于ffmpeg的音视频播放器,直播推流,屏幕录像,

Python界面版学生管理系统

前不久上传了一个控制台版本的学生管理系统,这个是Python界面版学生管理系统,这个是使用pycharm开发的一个有界面的学生管理系统,基本的增删改查,里面又演示视频和完整代码,有需要的伙伴可以自行下

2019数学建模A题高压油管的压力控制 省一论文即代码

2019数学建模A题高压油管的压力控制省一完整论文即详细C++和Matlab代码,希望对同学们有所帮助

4小时玩转微信小程序——基础入门与微信支付实战

这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程

相关热词 c#对文件改写权限 c#中tostring c#支付宝回掉 c#转换成数字 c#判断除法是否有模 c# 横向chart c#控件选择多个 c#报表如何锁定表头 c#分级显示数据 c# 不区分大小写替换
立即提问
相关内容推荐