Bunny's Code Burrow

this is a JS world


  • Home

  • About

  • Archives

  • Tags

  • Search

less

Posted on 2017-09-27

Less

  1. example

    @base:#f938ab;
    .box-shadow(@style, @c) when(iscolor(@c)){
        -webkit-box-shadow:@style @c;
        box-shadow:@style @c;
    }
    .box-shadow(@sytle,@alpha:50%) when(isnumber(@alpha)){
        .box-shadow(@style,rgba(0,0,0,@alpha));
    }
    .box{
        color:saturate(@base,5%);
        border-color:lighten(@base,30%);
        div{.box-shaow(0 0 5px 30%)}
    }
    
  2. Language features

2.1 Variables

@nice-blue:#979699;
@light-blue:@nice-blue+111;

#header{
    color:@light-blue;
}

2.2 Mixins

.borderd{
    border-top:dotted 1px black;
    border-bottom:solid 2px black;
}

#menu a{
color:#111;
.bordered;
}
.post a{
    color:red;
    .bordered;
}

2.3 Nested Rules

#header{
    color:black;
    .navigation{
        font-size:12px;
    }
    .logo{
        width:300px;
    }
}

.clearfix{
    display:block;
    zoom:1;
    &:after{
        content:"";
        display:block;
        font-size:0;
        height:0;
        clear:both;
        visibility:hidden;
    }
}

Android studio icon on device

Posted on 2017-09-25

How to change or set the Icon for your Android APP?

  1. Go to the path “..android\app\src\main\res”
  2. Update the images in those folders

    \mipmap-xxhdpi
    \mipmap-xhdpi
    \mipmap-mdpi
    \mipmap-hdpi

  3. You could use some online tool to generate your icon https://makeappicon.com/ which resizes all iOS icons and Android icons.

update apk version to google play

Posted on 2017-09-25

How to update APK to Google play

For people who use Android Studio the problem may be solved by editing versionCode and versionName in

android/app/build.gradle

instead of AndroidManifest.xml.e.g.

defaultConfig {
    applicationId "com.my.packageId"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 2      <-- change this
    versionName "2.0"  <-- change this
}

If not, there will be error

The way to update the apk is like following:
1.Eddit Release

2.Add the new released apk(remember to check the version code!!!)

3.Remember to save the change



Start to roll-out to Beta

Then you will see the result

4.Here is the place to view all the apk

5.Remember to check the status of apk

how to upload app to ios app store

Posted on 2017-08-31

How to upload app to ios App Store

This solution suits the Xcode8.

  1. Xcode must be the right one, which is download from app store. You need a Mac as well.
  2. go to https://developer.apple.com ,go to account
  3. choose Certificates, Identifiers & Profiles,

  4. choose iOS,tvOS,watchOS, select ALL, click +

  5. choose APP Store and Ad Hoc
  6. continue with



  7. Don’t close the browser.Go to the Mac Launchpad and find others as below:choose the keychain access


  8. go to the toolbar and choose as below:

    save to disk

  9. go back to the browser, and choose file,upload the certification which we just saved to disk. then, download

  10. Bind your App with Bundle Identifier https://developer.apple.com/account/ios/certificate/
    choose iOS,tvOS,watchOS and App IDs,and click”+” as below

  11. input App IDs and Bundle Identifier
    for Name, it’d better begin with date and project name, and for Bundle ID,which is named with “com.domainname.projectname”.
    Tips: Bundle ID shoube to fixed. and shoudl be the same with your project Bundle ID as below

  12. Then choose the App service according to your requirements.



  13. Generate the provisioning Profiles.
  14. Choose App store, and click continue
  15. Find your AppIDs(Bundle ID),continue
  16. Input your APP name, which is just for project name ,not the name displayed in app Store
  17. Download the Provisioning Profile,then click “done”

  18. Back to Account, choose iTunes Connect

  19. Click my app
  20. click “+” and
![](http://img0.ph.126.net/EGqmpe0pBaJiiWBKiCgYSQ==/6632592788329150287.jpg)
  1. Fill the form, remember to choose iOS,and your Bundle ID, SKU is the code to distinguish with others, which should be unique, select the language you are going to use.

  2. Choose App information, and fill the other information of App

  3. Choose Price and sales

  4. Prepare for the screenshot and introduction page of iPhone, the better and simple solution is to design one set(1242 x 2208 or 2208 x 1242) which will meet all the different requirements

  5. upload your LOGO which should be (1024*1024)

  6. Then upload your Logo to https://makeappicon.com/ to get the appicon set, then import the appicon set to Xcode ,remember to import the whole folder instead of dragging all the images, which will provide your all the different sizes of images to meet different devices.

  7. Then go back to the browser, choose class, you must fill this form before next step.

  8. Then provide other information which will help to you pass to review smoothly.

  9. Go to Xcode to choose iOS device. Remember to connect to a physical device as well.

  10. If your device doesn’t support landscape display, please remove these two options.

  11. Double check the Bundle ID and version, for version ID, from then on ,the next time you release it, the number should +1

  12. Here is the difference from Xcode 8 Don’t change anything in Build setting ,just keep the option here

  13. Remove all the breakpoints, and update all the mode to release

    Go to the edit Scheme






  14. Archive:Xcode-Product-Achive

  15. Upload to App Store

  16. Choose the right account,must be the one in Apple developer account

  17. Preparing

  18. Upload

  19. Success

  20. Sometimes it won’t successful due to some issues, then the developer’email will receive the introduction about this issue, please pay attention to you email address. For the issue I have is about info.plist,which is caused by the privacy setting of iOS 10. I just mannual input the value of the photo library then it is sorted.

  21. Go back to the browse,check the version, then you will find the one you just uploaded.

  22. Follow the image below, to add the version,choose the one you want to upload

  23. Then submit

nopcommerce from 3.3 to 3.9

Posted on 2017-06-28

update nopcommerce

update nopcommerce from 3.3-3.9
Here is the steps to update

  1. download form nop

  2. unblock the zar for window securtiy issue,if not, there wil be problems when releasing

  3. Extract files
  4. setup by: run NopCommerce.sln, clean and rebuild
  5. view in chrome
  6. you will see the installation page: input your local database and choose to create one database, it doesn’t matter, because you will rewrite it later, but it seems that you cannot skip the initial part
  7. open nop.web/app_data/setting.txt
  8. change the database to your own one. make sure the version of you database is same with the source code. if it is not ,you should download the update.sql from nopcommerce and run it one by one: 3.3-3.4, 3.4-3.5. when you run it, make sure you open the microsoft sql server and click the target database you want to update
  9. copy the original theme from v3.3 to 3.9, choose the new theme from backend of website, then you will notice the difference ,what we are supposed to do is address them one by one:

  10. solve the problem of responsive by go to the nop.web/views/shared/_Root.cshtml

@{
    Layout = "~/Views/Shared/_Root.Head.cshtml";
}
@Html.Widget("body_start_html_tag_after")
@Html.Partial("_Notifications")
@Html.Action("JavaScriptDisabledWarning", "Common")
@Html.Partial("OldInternetExplorerWarning")

<div class="master-wrapper-page">
    @Html.Action("AdminHeaderLinks", "Common")

    <div class="master-wrapper-content">
    @Html.Partial("Header")
    <script type="text/javascript">
        AjaxCart.init(false, '.header-links .cart-qty', '.header-links .wishlist-qty', '#flyout-cart');
    </script>
    <div class="header-menu">
        @Html.Action("TopMenu", "Catalog")
    </div>
        @Html.Widget("content_before")
        <div class="master-wrappermain">

           <div class="master-wrapper-main clearfix">
            @if (IsSectionDefined("Breadcrumb"))
                {
                    @RenderSection("Breadcrumb") 
                }
             @RenderBody()
            </div>
        </div>
        @Html.Widget("content_after")
    </div>
    @Html.Action("Footer", "Common")
</div>
@Html.Action("EuCookieLaw", "Common")
@Html.Widget("body_end_html_tag_before")
  1. modify for the slider by go to the nop.web\Plugins\Nop.Plugin.Widgets.NivoSlider\Content\nivoslider\themes\custom

    @media all and (min-width: 1001px) {
    .theme-custom {
    /*margin: -30px 0 60px;*/
    }
    
  2. go to the views/common/footer.cshtml,update as below:

    @model FooterModel
    @using Nop.Core
    @using Nop.Core.Domain.Tax
    @using Nop.Core.Infrastructure
    @using Nop.Web.Models.Common;
    
    <div class="footer">
        <div class="footer-menu-wrapper">
            <div class="column information">
    
            <h3>@T("Footer.Information")</h3>
            <ul>
    
        @if (Model.SitemapEnabled)
        {
            <li><a href="@Url.RouteUrl("Sitemap")">@T("Sitemap")</a></li>
        }
        <li><a href="@Url.RouteUrl("Topic", new {SeName = Html.GetTopicSeName("shippinginfo") })">@T("ShippingReturns")</a></li>
        <li><a href="@Url.RouteUrl("Topic", new {SeName = Html.GetTopicSeName("privacyinfo") })">@T("PrivacyNotice")</a></li>
        <li><a href="@Url.RouteUrl("Topic", new {SeName = Html.GetTopicSeName("conditionsofuse") })">@T("ConditionsOfUse")</a></li>
        <li><a href="@Url.RouteUrl("Topic", new {SeName = Html.GetTopicSeName("aboutus") })">@T("AboutUs")</a></li>




        <li><a href="@Url.RouteUrl("ContactUs")">@T("ContactUs")</a></li>
    </ul>
</div>
<div class="column customer-service">

    <h3>@T("Footer.CustomerService")</h3>
    <ul>


        <li><a href="@Url.RouteUrl("ProductSearch")">@T("Search")</a> </li>
        @if (Model.NewsEnabled)
        {
            <li><a href="@Url.RouteUrl("NewsArchive")">@T("News")</a></li>
        }
        @if (Model.BlogEnabled)
        {
            <li><a href="@Url.RouteUrl("Blog")">@T("Blog")</a></li>
        }
        @if (Model.ForumEnabled)
        {
            <li><a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")</a></li>
        }
        @if (Model.RecentlyViewedProductsEnabled)
        {
            <li><a href="@Url.RouteUrl("RecentlyViewedProducts")">@T("Products.RecentlyViewedProducts")</a></li>
        }
        @if (Model.CompareProductsEnabled)
        {
            <li><a href="@Url.RouteUrl("CompareProducts")">@T("Products.Compare.List")</a></li>
        }
        @if (Model.NewProductsEnabled)

        {
            <li><a href="@Url.RouteUrl("NewProducts")">@T("Products.NewProducts")</a></li>
        }




    </ul>
</div>
<div class="column my-account">

    <h3>@T("Footer.MyAccount")</h3>
    <ul>


        <li><a href="@Url.RouteUrl("CustomerInfo")" class="account">@T("Account.MyAccount")</a></li>
        @if (!Model.HideOrders)
        {
            <li><a href="@Url.RouteUrl("CustomerOrders")">@T("Account.CustomerOrders")</a></li>
        }
        @if (!Model.HideAddresses)
        {
            <li><a href="@Url.RouteUrl("CustomerAddresses")" class="">@T("Account.CustomerAddresses")</a></li>
        }
        @if (Model.ShoppingCartEnabled)
        {
            <li><a href="@Url.RouteUrl("ShoppingCart")" class="ico-cart">@T("ShoppingCart")</a></li>
        }
        @if (Model.WishlistEnabled)
        {
            <li><a href="@Url.RouteUrl("Wishlist")" class="ico-wishlist">@T("Wishlist")</a></li>
        }
    </ul>
        </div>
        <div class="column follow-us">
              <div class="social">
                <div class="title">
                    <strong>@T("Footer.FollowUs")</strong>
                </div>
                @Html.Action("Social", "Common")
            </div>
        </div>
    </div>
    <div class="footer-poweredby">
        Powered by <a href="http://www.nopcommerce.com/">nopCommerce</a>
        @*Would you like to remove the "Powered by nopCommerce" link in the bottom of the footer?
            Find more info here http://www.nopcommerce.com/copyrightremoval.aspx*@

    </div>

    @if (Model.DisplayTaxShippingInfoFooter)
    {
        var inclTax = EngineContext.Current.Resolve<IWorkContext>().TaxDisplayType == TaxDisplayType.IncludingTax;
        <div class="footer-tax-shipping">
            @T(inclTax ? "Footer.TaxShipping.InclTax" : "Footer.TaxShipping.ExclTax", Url.RouteUrl("Topic", new {SeName = Html.GetTopicSeName("shippinginfo")}))
        </div>

    }
    <div class="footer-disclaimer">
        @T("Content.CopyrightNotice", DateTime.Now.Year, Model.StoreName)
    </div>


    <div class="footer-store-theme">
        @Html.Action("StoreThemeSelector", "Common")
    </div>

    @Html.Widget("footer")
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $('.footer-block .title').click(function () {
            var e = window, a = 'inner';
            if (!('innerWidth' in window)) {
                a = 'client';
                e = document.documentElement || document.body;
            }
            var result = { width: e[a + 'Width'], height: e[a + 'Height'] };
            if (result.width < 769) {
                $(this).siblings('.list').slideToggle('slow');
            }
        });
    });
</script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.block .title').click(function () {
            var e = window, a = 'inner';
            if (!('innerWidth' in window)) {
                a = 'client';
                e = document.documentElement || document.body;
            }
            var result = { width: e[a + 'Width'], height: e[a + 'Height'] };
            if (result.width < 1001) {
                $(this).siblings('.listbox').slideToggle('slow');
            }
        });
    });
</script>

meanwhile, go to the model/commom/FooterModel.cs modify as below:

using System.Collections.Generic;
using Nop.Web.Framework.Mvc;

namespace Nop.Web.Models.Common
{
    public partial class FooterModel : BaseNopModel
    {
        public FooterModel()
        {
            Topics = new List<FooterTopicModel>();
        }
        public string FacebookLink { get; set; }
        public string TwitterLink { get; set; }
        public string YoutubeLink { get; set; }
        public string GooglePlusLink { get; set; }
        public string StoreName { get; set; }
        public bool WishlistEnabled { get; set; }
        public bool ShoppingCartEnabled { get; set; }
        public bool HideAddresses { get; set; }
        public bool HideOrders { get; set; }
        public bool SitemapEnabled { get; set; }
        public bool NewsEnabled { get; set; }
        public bool BlogEnabled { get; set; }
        public bool CompareProductsEnabled { get; set; }
        public bool ForumEnabled { get; set; }
        public bool RecentlyViewedProductsEnabled { get; set; }
        public bool NewProductsEnabled { get; set; }
        public bool AllowCustomersToApplyForVendorAccount { get; set; }
        public bool DisplayTaxShippingInfoFooter { get; set; }
        public bool HidePoweredByNopCommerce { get; set; }

        public int WorkingLanguageId { get; set; }

        public IList<FooterTopicModel> Topics { get; set; }

        #region Nested classes

        public class FooterTopicModel : BaseNopEntityModel
        {
            public string Name { get; set; }
            public string SeName { get; set; }

            public bool IncludeInFooterColumn1 { get; set; }
            public bool IncludeInFooterColumn2 { get; set; }
            public bool IncludeInFooterColumn3 { get; set; }
        }

        #endregion
    }
}
  1. go to the model/commom/ContactUsModel.cs

    using System.Web.Mvc;
    using FluentValidation.Attributes;
    using Nop.Web.Framework;
    using Nop.Web.Framework.Mvc;
    using Nop.Web.Validators.Common;
    
    namespace Nop.Web.Models.Common
    {
    [Validator(typeof(ContactUsValidator))]
    public partial class ContactUsModel : BaseNopModel
    {
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.Email")]
    public string Email { get; set; }
    
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.Subject")]
    public string Subject { get; set; }
    public bool SubjectEnabled { get; set; }
    
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.Enquiry")]
    public string Enquiry { get; set; }
    
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.FullName")]
    public string FullName { get; set; }
    
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.Business")]
    public string Business { get; set; }
    
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.Department")]
    public string Department { get; set; }
    
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.Phone")]
    public string Phone { get; set; }
    
    [AllowHtml]
    [NopResourceDisplayName("ContactUs.Mobile")]
    public string Mobile { get; set; }
    
    public bool SuccessfullySent { get; set; }
    public string Result { get; set; }
    
    public bool DisplayCaptcha { get; set; }
        }
    }
    

ubuntu cmd

Posted on 2017-06-06

ubuntu command

  1. sudo:this SuperUserDo is the most important command linux website will use.Every single command that needs roots’s permisision,need this sudo command. you can use sudo before each command that requires root permissions.

    $sudo su 
    
  2. ls:with list command,you will see all the files and folders of the directory that you’re working in

    $ls
    
  3. cd:changing directory is the main command that always be in use in terminal.

    $cd
    
  4. mkdir : change directory is sitll incomplete. sometimes you want to create a new folder or subfoler. you can use mkdir command to do that.Just give your folder name after mkdir command in your teminal

    $mkdir folderName
    
  5. cp :copy and paste is the important task we need to do to organize our files. using cp will help you to copy file from terminal. first you determine the file you want to copy and type the destination location to paste

    $cd src des
    
  6. rm:rm is a command to remove your file or even your dictory. you can use -f if the file need root permission to be removed.And also you can use -r to do recurisve removal to remove your folder

    $rm myfile.txt
    
  7. apt-get:this command differs distro-by-distro. In Debian based distributions,to install remove and upgrade any package we’ve Advanced Packaging Tool (APT) package manager. The apt-get command will help you installing the software you need to run in your Linux. It is a powerful command-line tool which can perform installation, upgrade, and even removing your software.In other distributions, such as Fedora, Centos there are different package managers. Fedora used to have yum but now it has dnf.

    $sudo apt-get update
    $sudo dnf update
    
  8. grep: you need to find a file but you don’t remember its exact location or the path. grep will help you solve this issue .you can use the grep command to help finding the file based on given keywords

    $grp use /etc/passwd
    
  9. cat: as a user, you often need to view some of text or code from you script.Again,one of the Linux basic commands is cat command. it will show you the text inside your file.

    $cat CMakeLists.txt
    
  10. poweroff: sometimes you need to poweroff directly from your terminal. this command wil do the task. Don’t forget to add sudo at the beginning of the command since it needs root permission to execute poweroff.

    $sudo poweroff
    

AWS with SecureCRT

Posted on 2017-05-23

How to deploy AWS with SecureCRT

  1. rz -be
  2. cd tomcat/webapps
  3. ../bin/shutdown.sh
  4. rm -rf ./*
  5. mv ~/pt_server.war .
  6. ../bin/startup.sh
  7. ../bin/shutdown.sh
  8. vim ./pt_server/WEB-INF/jdbc.properties
  9. modify
  10. I
    jdbc.driverClassName=com.mysql.jdbc.Driver
    jdbc.url=jdbc:mysql://localhost:3306/pt?characterEncoding=utf-8
    jdbc.username=xxxx
    jdbc.password=xxxxx
    ESC
  11. : wq
  12. ../bin/startup.sh
  13. if there were something went wrong ,check here: cat pt_server/WEB-INF/jdbc.properties
  14. How to download from AWS
  15. cd tomcat/webapps
  16. sz pt_server.war
  17. Then find it in option session options — X/Y/Zmodem

ios Apple account application

Posted on 2017-05-22

How apply the ios development account as company

  1. Apply DUNS number https://developer.apple.com/program/enroll/dunsLookupForm.action this part should be easy, but if you encountered any issues, please feel free to contact the DUNS support, manually process this application
  2. https://developer.apple.com/programs/enroll/ create an apple id, especially for this company or project

  3. HERE,PLEASE PAY ATTENTION TO CHOSE TYPE


    For most cases, the issue will trouble you is the DUNS, feel free to contact DUNS support or Apple support
    for example, I struggled here for almost one month, due to the so called waiting time 14 working days, actually they work faster than I expected.
    Then I contact the DUNS company by calling them and filled a form online with problem, here is the reply from Apple support ,from then on, my applicaiton went on a normal way.
Hello
    Jenny, 



    Thank you for contacting Apple Developer Program Support. My name
    is Charlie and I’ll be happy to assist you with your company’s
    enrollment. 



    I understand that the system is not accepting your company’s DUNS
    information and is not allowing you to continue.



    I would be concerned as well if the D-U-N-S Number that has been
    assigned to my organization is not being accepted. I will do what I
    can to help you get your enrollment processed.



    I've reviewed your enrollment information and found that your DUNS
    Number doesn’t include full information of your company. However, I
    may be able to process your enrollment by verifying your company
    information manually.



    I’ve gone ahead and altered your enrollment to proceed to the next
    step. Please use the same Apple ID and submit your enrollment once
    more. 



    https://developer.apple.com/programs



    Please let me know once you’ve submitted the enrollment so that I
    can request business document to verify your information manually.

Here is the following of the staff suppot

Dear Jenny Zeng,

We’ve received your enrollment request. Once we verify that you have the authority to bind your organization to Apple Developer Program legal agreements, we’ll email you with instructions on how to complete your enrollment.

Then I receice an Email required as below:

Dear Jenny Zeng,

To continue your enrollment in the Apple Developer Program (Enrollment ID: sssss???), please upload the following documents. The information in these documents should match the information you provided for enrollment:

Company Number

Upload Documents

Here the document means the qualification of you company.
Then you will go through the next two steps till your boss receiving a call from Apple to confirm you are working there towards iOS development.
Then making the payment!
Congrats!


wordpress change domain

Posted on 2017-05-22

After updating the Domain for WordPress

  1. go to wp-config.php
update:the URL with the latest one
/** MySQL hostname */
define('DB_HOST', 'microscience.com.au');

Same for another website

/** Sets up WordPress local environmental test only for local test */
define( 'WP_SITEURL', 'http://localhost/didi' );
define( 'WP_HOME',    'http://localhost/didi' );
  1. go the the backend of WordPress:/wp-admin/options-general.php

    update the WordPress Address (URL) And Site Address (URL)
    This part might not be necessary

  2. sometimes we need access to database, modify the table :wp_options. In the tale of wp_options, find the two fields:home and siteurl, change the option_value to the same with wp-config.php. For example, for the website of didi, we use http://localhost/didi for both fields.

RegExp

Posted on 2017-05-19

Regular Expression

  1. Matching a username

    /^[a-z0-9_-]{3,16}$/
    
    ^:the begining of the line
    
    |: delimiters
    
    lowercase letter(a-z)number(0-9),and underscore,or a hyphen
    next, {3,16} makes sure that are at least 3 of those characters, but no more than 16.
    $: end of this line
    
  2. Matching a password

    /^[a-z0-9_-]{6,18}$/
    
  3. Matching a hex value

    /^#?([a-f0-9]{6}|[a-f0-9]{3})$/
    

    The question mark tells the parser that the preceding character in this case a number sign- is option
    next, inside the first group,we can have tow different situations.The first one is any lowercase letter between a and f or number six tiems. the vertical bar tells us that we also can have three lowercase letters between a and f or numbeers instead for three times

  4. Matching a slug

    /^[a-z0-9-]+$/
    beginning with the string, followed by one or more letters,numbers,or hyphens
    for example: my-title-here

  5. Matching an email

    /^([a-z0-9-.-]+)@([a-z0-9_.-]+).([a-z.]{2,6})$/

inside the first group, we match one or more lowcase letters, numbers,underscope,dots or hyphens. I have escaped the dot because a non-escaped dot means any character. after than,there must be @. then next is the domain name which must be:one or more lowercase letters, numbers, underscores, dots,or hyphens. then another escaped dot, then with the extension being two to six letters or dots.

  1. Matching a url
    /^(https?"\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.-]*)*\/?$/
    
1…91011…16
Jenny Zeng

Jenny Zeng

Loving code ,especially javascript, React Native

155 posts
37 tags
GitHub Linkedin
© 2020 Jenny Zeng
Powered by Hexo
Theme - NexT.Pisces