text:
Q: Path to document. Adobe Brackets Is there any way I can get the path of the front document in Brackets?
What I have tried:
With AppleScript this works well with most of the code editors but not with Brackets:
tell window 1 to set thePath to value of attribute "AXDocument"

On the other side, I have noticed that in the Brackets (menu bar) > Window menu there is something like:
/path/to/document.html (some-text) — Brackets

I would like to get only the path, without: (some-text) — Brackets
(Be aware that (some-text) I mean it is a text that is different in each computer. The common case is that is inside the ().

A: Running the following:
tell application "System Events" to ¬
    get has scripting terminology of application process "Brackets"

Returns:
false

So, scripting Brackets with AppleScript will be limited; however, the following example AppleScript code worked for me to return the wanted portion of what shows for the document name on the Window menu in Brackets:
tell application "System Events" to set menuItemName to ¬
    (name of menu item 7 of menu 1 of menu bar item ¬
        "Window" of menu bar 1 of application process "Brackets")

set docPathName to do shell script ¬
    "grep -o '^.*\\.[[:alnum:]]*[^ ]'<<<" & ¬
    quoted form of menuItemName

return docPathName

Note that the grep command, if used in Terminal, the regex used for it would only have one backslash preceding the . to escape it to treat it as a literal .; however, when using the do shell script command, an additional backslash is necessary to escape it properly.

In Brackets, with a document opened and selected under Working Files, the name that shows on the Window menu for the selected document is always menu item 7 and in the form of:
/path/to/filename.ext (some text) — Brackets
Using grep -o to return only the matched portion of the what's in the docPathName variable using the ^.*\.[[:alnum:]]*[^ ] regex, it will return everything up to but not including " (some text) — Brackets".
In other words, it only returns the "/path/to/filename.ext" portion.
Understanding the do shell script command:

*

*grep -  From its man page: file pattern searcher

*

*-o - Prints only the matching part of the lines.

*^.*\.[[:alnum:]]*[^ ] - See Understanding the RegEx: below.

*<<< - From the bash man page: Here Strings  A variant of here documents, the format is: <<<word  The word is expanded and supplied to the command on its standard input.

Understanding the RegEx:

*

*^.*\.[[:alnum:]]*[^ ]

*

*^ - Asserts position at start of the string.

*. - Matches any character (except for line terminators).

** - Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy).

*\. - Matches the character . literally (case sensitive).

*[[:alnum:]] - Match a single character present in the list, matches an alphanumeric character [a-zA-Z0-9].

** - Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy).

*[^ ] - Match a single character not present in the list, matches the character  literally (case sensitive).

Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.


text:
Q: No EntityManager with actual transaction available for current thread This error occurs at this.itemRepository.deleteAll() when sampleTest() method is run.
@ExtendWith(SpringExtension.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@Rollback(false)
public class ScheduleTests {

    private static final Logger LOGGER = LoggerFactory.getLogger(ScheduleTests.class);

    @Autowired
    private ScheduleRepository scheduleRepository;

    @Autowired
    private ItemRepository itemRepository;

    @Autowired
    private ItemQualifierRepository itemQualifierRepository;

    @Autowired
    private MappingRepository mappingRepository;

    @BeforeAll
    public void setUp() {
        restoreInitialData();
        LOGGER.info("Initial data restored");
    }

    @Test
    public void sampleTest() {
        File feed = new File("target/test-classes/TestFeedOK.json");
        Feed.ingest(feed);
        LOGGER.info("Feed {} ingested", feed.getName());
    }

    private void restoreInitialData() {
        this.itemRepository.deleteAll();
        this.mappingRepository.deleteByTableName("event");
    }
}

Adding @Transactional annotation to restoreInitialData() does not solve the problem - https://stackoverflow.com/a/32552558/3536552
Do you know how to fix it?

A: I think the problem is restoreInitialData is called from setup which is a @BeforeAll method.
  Spring hasn't stepped in at that point to have a transaction created. Just change this to @BeforeEach and check and also with @Transactional.
   If you want something to be executed only once. Try this approach
private static boolean setUpIsDone = false;
.....
public void setUp() {
    if (setUpIsDone) {
        return;
    }
    // do the setup
    setUpIsDone = true;
}

A: By default Spring provides implementations of Interface and Class but with the test environment spring expect you to provide its implementation. So use following code to provide EntityManager implementation.
PersistenceJPAConfig.java
import java.util.Properties;

import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
public class PersistenceJPAConfig {

    @Autowired
    private Environment environment;

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
        LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
        em.setDataSource(dataSource());
        em.setPackagesToScan(new String[] { "com.example.db.model" });

        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        em.setJpaVendorAdapter(vendorAdapter);
        em.setJpaProperties(additionalProperties());
        return em;
    }

    @Bean
    public DataSource dataSource() {
        String driverClassName = environment.getProperty("spring.datasource.driverClassName");
        String url = environment.getProperty("spring.datasource.url");
        String username = environment.getProperty("spring.datasource.username");
        String password = environment.getProperty("spring.datasource.password");

        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(driverClassName);
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);

        return dataSource;
    }

    @Bean
    public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
        JpaTransactionManager transactionManager = new JpaTransactionManager();
        transactionManager.setEntityManagerFactory(emf);

        return transactionManager;
    }

    @Bean
    public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
        return new PersistenceExceptionTranslationPostProcessor();
    }

    Properties additionalProperties() {
        Properties properties = new Properties();
        properties.setProperty("hibernate.id.new_generator_mappings","false");
        return properties;
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Where can i find all right-to-left characters in UTF-8? I know that Hebrew and Arabic characters are going from right to left but I want to see all of them.

A: Have a look at the bidirectional character type (Unicode character property Bidi_Class). You're looking for characters of type R (Right-to-Left) or AL (Right-to-Left Arabic). The file DerivedBidiClass.txt in the Unicode database contains a list of all code points with these classes.

A: Quoting i18nguy:

Languages don't have a direction. Scripts have a writing direction,
  and so languages written in a particular script, will be written with
  the direction of that script.

Here are some scripts using RTL: Arabic, Hebrew, N'ko, Syriac, Thaana/Thâna, Tifinar, Urdu.
You can just look for unicode range of a given script. Like for example Tifinar: U+2D30 – U+2D7F.
Not sure what you want to achieve by looking at all those characters but I think that is the only way of actually finding them.
You can refer to the original page here:
http://www.i18nguy.com/temp/rtl.html


text:
Q: htaccess redirect rule from www.domain.com/?page=news to www.domain.com/news i need to redirect the URL as
www.domain.com/?page=news --> www.domain.com/news
Here my htaccess file:
Options -Multiviews
RewriteEngine On
RewriteBase /

# Force search engines to use www.domain.com
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteRule ^(.*) http://www.domain.com/$1 [R=301,L]

# Specify search friendly URLs
RewriteRule ^http://www\.domain\.com/news/$ /http://www.domain.com/?page=news [L]

Please suggest me the exact rule to use in .htaccess file.
Thanks in advance.

A: Sorry, I do not know a thing about this, but I have seen a good tutorial posted by someone I am following on facebook:
http://www.9lessons.info/2013/11/htaccess-file-tutorial-and-tips.html
Hope this helps.

A: Your 2nd rule is not correct as you can't match domain name in RewriteRule pattern. That pattern only matches REQUEST_URI without domain name and query string.
Your 2nd rule should be like this:
RewriteCond %{THE_REQUEST} \s/+\?page=([^&\s]+) [NC]
RewriteRule ^ /%1? [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# Specify search friendly URLs
RewriteCond %{QUERY_STRING} !(^|&)page=[^&]+
RewriteRule ^([^/]+)/?$ /?page=$1 [L,NC,QSA]

Reference: Apache mod_rewrite Introduction


text:
Q: static List lazy initialization fail I have a viewpager that get its adapter from a List. I get the List from a static method :
private static List<VerticalPagerAdapter> verticalAdapters;
public static List<VerticalPagerAdapter> getVerticalPagerAdapterList(FragmentManager fm) {
//        List<VerticalPagerAdapter> verticalAdapters = new ArrayList<>();
    if (verticalAdapters==null) {
        verticalAdapters = new ArrayList<>();
        GraphModel graphModel = GraphModel.getInstance();
        int numberOfYears = graphModel.getLastYear()-graphModel.getFirstYear();
        for (int i = 0; i < numberOfYears; i++) {
            verticalAdapters.add(new VerticalPagerAdapter(fm, i, 2, DoubleVPChildFragment.class));
        }
    }
    return verticalAdapters;
}

If I create a new array by uncommenting the line 3 and commenting the condition, everything works fine, but this is a test code sample and the creation of the array may become CPU intensive in some cases.
So I tried to lazy initialize the ArrayList, but it doesn't work : only the second fragment is populated (not the first one, strange isn't it ?).
This is part of my testing of my library, so you can try the sample project (only 2 classes) to see my problem.


text:
Q: cxf inbound and outbound message logging to the separate log file I looked up all messages but did not find a clear answer for that question.
How can I configure logging to log CXF inbound and outbound restful messages ?
I have the following setup.

*

*File org.apache.cxf.Logger with
org.apache.cxf.common.logging.Log4jLogger

*applicationContext.xml has the following (it sounds silly, but it is the only place for interceptors I could get messages output)
<bean id="abstractLoggingInterceptor" abstract="true">
<property name="prettyLogging" value="true"/>
</bean>
<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"
parent="abstractLoggingInterceptor"/>
<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"
parent="abstractLoggingInterceptor"/>

<cxf:bus>
<cxf:inInterceptors>
<ref bean="loggingInInterceptor"/>
</cxf:inInterceptors>
<cxf:outInterceptors>
<ref bean="loggingOutInterceptor"/>
</cxf:outInterceptors>
<cxf:outFaultInterceptors>
<ref bean="loggingOutInterceptor"/>
</cxf:outFaultInterceptors>
<cxf:inFaultInterceptors>
<ref bean="loggingInInterceptor"/>
</cxf:inFaultInterceptors>
</cxf:bus>

I tried to follow these instructions with slf4j and with log4j, but the the only output I get to the file is application log messages. I can see inbound and outbound messages on my console.
Can I get something similar to logback.xml work for me, so I separate app logs and message logs. Example: http://www.wolfe.id.au/2011/05/20/apache-cxf-logging/
Thanks.
EDIT 1:
I removed  org.apache.cxf.common.logging.Log4jLogger from my classpath, and placed the following to my log4j.xml. It logging to the file and to console when the level of logging is equal to INFO.
<appender name="RSLOGFILE" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${project.basedir}/logs/cxf_inout_messages.log"/>
<param name="MaxFileSize" value="100KB"/>
<!-- Keep one backup file -->
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- Print the date in ISO 8601 format -->
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<logger name="org.apache.cxf">
<level value="ERROR"/>
<appender-ref ref="RSLOGFILE"/>
</logger>

A: Assuming you are using CXF 2.2.8 or higher, you would need to do the following:
step 1) Create a file META-INF/cxf/org.apache.cxf.Logger on the classpath containing the following:
org.apache.cxf.common.logging.Slf4jLogger

If you're using Maven, this new file must be in src/main/resources/META-INF/cxf, not below src/main/webapp!
step 2) If you want to log all messages, create a CXF LoggingFeature, set the prettyLogging property to true and add it to the CXF bus.
step 3) Add the needed jar files for log4j and slf4j-log4j12. If you are using Maven, include following dependencies:
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
    </dependency>

step 4) In you log4j.xml set the log level of org.apache.cxf.services to INFO, set additivity to FALSE and attach a dedicated appender:
<!-- level INFO needed to log SOAP messages -->
<logger name="org.apache.cxf.services" additivity="false">
    <level value="INFO" />
    <!-- specify a dedicated appender for the SOAP messages -->
    <appender-ref ref="WS_LOG_FILE" />
</logger>

I've created a blog post which explains how to configure CXF for log4j in more detail.


text:
Q: How can I show dynamic list of MapQuickItem? How can I show for example dynamic list of planes from http://doc.qt.io/qt-5/qtlocation-planespotter-example.html example?
I would like to add and remove items from the map. And also refresh each changed item.
I need to show objects from QList or QAbstractItemModel on the map as MapQuickItem.

A: The right answer is: use MapItemView :)
MapItemView {
    model: planeModel
    delegate: Plane { }
}

A: Both a QList based property or a QAbstractListModel derived class would work.
On the QML Side you would use either as the model for a Repeater that uses the Plane type as its delegate, taking the coordinate from the model handle
Somewhat like this
Map {
    Repeater {
        model: listOrModelFromCpp

        delegate: Plane {
            cooridinate: model.position // or model.modelData for a QList<QGeoCoordinate> as the listOrModelFromCpp
        }
    }
}

Using a custom QAbstractListModel derived model has the advantage that the Repeater can individually create and destroy Plane items, while a basic list will require it to recreate all items when the list's count changes

A: There are 2 methods for Map to manipulate items dynamically :
void addMapItem(MapItem item) and void clearMapItems()
Here is a code snippet from my project( I guess rather self-documented) :
function clearTargets()
{
   map.clearMapItems();
}

function showPlaneItems( planeItemsToShow )
{
   for ( var idx = 0; idx < planeItemsToShow.length; idx++ ) {
      var item = planeItemsToShow[idx];

      var itemComponent = Qt.createComponent("qrc:/components/Plane.qml");
      if ( itemComponent.status == Component.Ready ) {
         var itemObject = itemComponent.createObject( map,
                                      {
                                         "planeName" : item["targetName"],
                                         "coordinate" : QtPositioning.coordinate(item["targetLattitude"],
                                                                                item["targetLongitude"] )
                                      }
                                    );
         if ( itemObject != null ) {
            map.addMapItem( itemObject );
         }
      }
   }
}


text:
Q: Mutiple gesture recognizers on same UIImage I am trying to add 2 gestures to a uiimage that pulls a subVIew. One gesture is swipe to open/close. And the other is longpressand hold to open it at a specific height.
longPress.minimumPressDuration = 1;
[imageNavigationSlider addGestureRecognizer:longPress];

UILongPressGestureRecognizer *longPressWall = [[[UILongPressGestureRecognizer alloc]
                                            initWithTarget:self     action:@selector(handleLongPressWall:)] autorelease];
longPressWall.minimumPressDuration = 1;
PullMeImage.userInteractionEnabled=YES;
[PullMeImage addGestureRecognizer:longPressWall];

UISwipeGestureRecognizer *swipe = [[[UISwipeGestureRecognizer alloc] initWithTarget:self     action:@selector(swipe:)] autorelease];
swipe.direction = UISwipeGestureRecognizerDirectionLeft |     UISwipeGestureRecognizerDirectionRight;
[PullMeImage addGestureRecognizer:swipe];
[swipe setDelegate:self];

The long press gesture is correctly recognized, but the swipe isn't.
I also tried using:
    -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
  return YES;
}

But with no success. Any help will be very much appreciated.
Thank you


text:
Q: How to retrieve secret data from vault API using AppRole? My HashiCorp vault instance is runnning properly on CentOS7. I enabled AppRole authentication, created a policy and a role, enabled secret engine and created a secret for a client application.
I can retrieve the secret data using root CLI but I can't figure out how to get secret data from HTTP API with my application role using curl. I tried a few endpoint combinations without success. Retrieving the client token works, but I can't get secret data itself.
I wonder if the API endpoint is correct or if there is another setting in play.
Authentication method
vault auth enable approle

Policy
# File: my_app /etc/vault/my_app.hcl

path "kv/data/foo/*" {
 capabilities = ["read", "list"]
}

# Command line
vault policy write my_app /etc/vault/my_app.hcl

Role
vault write auth/approle/role/my_app policies="my_app"

Secret creation
vault kv put kv/data/foo/user@domain.tld password=1234

API call token request
curl --request POST --data '{"role_id": "xxxxxxxxxxxxxxxxx", "secret_id": "xxxxxxxxxxxxxxxxxxxx"}' http://127.0.0.1:8200/v1/auth/approle/login | jq

Result: Token is properly retrieved
API call for secret data request
export VAULT_CLIENT_TOKEN=XXXXXXX
curl --header "X-Vault-Token: $VAULT_CLIENT_TOKEN" --request GET "http://127.0.0.1:8200/v1/kv/data/foo/user@domain.tld"

Result : No secret data retrieved
Output:

{"errors":[]}

CLI call for secret data
vault kv get -field=password kv/data/foo/user@domain.tld

Output:

1234

Global settings
vault secrets list

Path          Type         Accessor              Description
----          ----         --------              -----------
cubbyhole/    cubbyhole    cubbyhole_xxxxxxxx    per-token private secret storage
identity/     identity     identity_xxxxxxxx     identity store
kv/           kv           kv_xxxxxxxx           n/a
sys/          system       system_xxxxxxxx       system endpoints used for control, policy and debugging


text:
Q: How to disable play button of YouTube embed code in rich editor? What I want to do is to remove YouTube embed code by 2 clicks.
First, when you click the YouTube display, show the remove icon at just above it. Second, when you click the remove icon, YouTube display is removed.
This is code I'm working on.
My problem is when I click YouTube display, YouTube start.
To avoid this I added div.media-frame and gave z-index:1 to it. But it doesn't work.
How can I show remove icon without starting YouTube and remove it?


text:
Q: What causes some icons not to appear when I run my iPhone web app in Safari on the desktop? NOTE: I have rephrased the title because I'm not getting any answers. Surely someone out there has experienced this problem and knows what to do. Thank you!
I have an iPhone web app that works almost perfectly in Safari on the desktop. Only two things do not work correctly on the desktop:

*

*Radio buttons do not appear. They are operational because you can check one if you know where it is; it simply is invisible.

*When SELECT is used, the little box with the default selection in it and the little down arrow do not appear. However, the actual text of the default selection DOES appear. If I click on that text the drop-down menu appears as it should.
In both cases the problem seems to have to do with icons missing or not rendered as needed.
What is the problem and how can I correct it?
Thank you.
Dave

A: Have you tried changing your user agent to Mobile Safari?  If you turn on the Develop menu in Safari advanced prefs, you can then test the app in different environments.  It's just a thought.


text:
Q: SendGrid API Limitations questions This document here: https://docs.sendgrid.com/api-reference/mail-send/limitations
States the following:

*

*Unicode encoding is not supported for the from field.

*The to.name, cc.name, and bcc.name personalizations cannot include either the ; or , characters.

So I tried a test email to see what happens. I put emojis in the From name, and I sent to a To name of "John,;;, Doe;". There was no error and the email was successfully delivered.
Am I misreading these limitations? I want to make sure that what I build is correctly validating what it sends to the API, but these limitations don't seem to be correctly stated.

A: While I don't know exactly what the limitations are within SendGrid, I would imagine those limitations were written for a reason. It may well be the case that SendGrid itself can handle each of those characters, but the mailbox you are sending to may not. Obviously the test email that you sent handled those characters too, but that may not be the case for all mailboxes and you could cause yourself delivery problems if you try to send messages that conflict with these stated limitations.
I would stick within the guidelines for the best possible outcome.


text:
Q: how to check if an image was cached in js? when I joined an interview , I was asked the question, I didn't know how to answer it .
do you know the key point of the question?

A: you could check like:
function is_cached(img_url){
    var imgEle = document.createElement("img");
    imgEle.src = img_url;
    return imgEle.complete || (imgEle.width+imgEle.height) > 0;
}

//and check, returns true or false depending on cached or not
is_cached("http://www.somesite.com/some_image.jpg");

A: Check if the complete attribute of the Image object is true:
function is_cached(src) {
    var image = new Image();
    image.src = src;

    return image.complete;
}

It seems to work (although it'll load the image if it isn't in the cache, which might not be what you want):
> is_cached('http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=3')
false
> is_cached('http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=3')
true


text:
Q: Xcode TARGET_OS_IPHONE seems confused, bug or configuration error? in an older project I'm using the TARGET_OS_IPHONE precompiler macro in several places to implement some iOS-specific things.
This used to work fine in the past, but currently Xcode seems to have this macro "inverted" in such way that code-completion doesn't work within #if TARGET_OS_IPHONE blocks, even though my build target is an iOS app. There's also no syntax-highlighting. It syntax-highlights and code-completes the things in the #else block which should only happen on a macOS target. As far as I can tell, it builds correctly though, just the editor seems confused. This makes editing code quite irritating. I am using Xcode 8.1 GM.
Might this be an Xcode bug, or is there possibly some configuration in my project which got messed up? It seems Xcode is looking at the wrong headers for a reason. When I CMD-click on the TARGET_OS_IPHONE macro, it navigates to this file:

which has the macro values for macOS, not the ones for iOS:
#define TARGET_OS_OSX               1
#define TARGET_OS_IPHONE            0

Seems that it chooses the wrong SDK. Not sure where to look / change this back to normal. I've looked at the target build settings, and they look ok.
thanks!

A: this seems to have been an Xcode 8.1 bug. Issue seems to have resolved itself in Xcode 8.2 beta.


text:
Q: Google Cloud Hosted VM. This site can't be reached  refused to connect Forgive me here, I am largely post-technical for 10+ years and taken this as far as I can.  I can probably take any advice and run with it, but may ask for some specifics to help if troubleshooting tools or commands are required.  So please forgive that too.
Background:
Yesterday we could hit site URL after restarting VM hosted on Google Cloud.  Sometime overnight, the URL was inaccessible.
Message:
    This site can't be reached <URL> refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

Troubleshooting:

*

*can load using IP.

*The technical guys (3rd party suppliers) insist they have not made any changes.  My team have not made any changes.

*The domain is still valid (it renews tomorrow)

*The domain is used for the DEV environment with DEV as a prefix hosted on another VM.

*Looking at firewall rules, all the rules with the proper tags appear to be set up correctly for HTTPS with appropriate IP (0.0.0.0) and port 80.

Many thanks in advance for your help.  When I find the answer, I will post it here.

A: RESOLVED:
ROOT CAUSE:
During setup on GCP, the team forgot to link the reserved external IP address to the VM.  As such, the external IP address was ephemeral so after a reboot of the server, Google issued a new external IP for the VM.
SOLUTION:
Reserve a static external IP Address and link it to the VM or promote an existing ephemeral external IP Address.
https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address


text:
Q: CredentialHandler encoding in base64 with Tomcat 8 I'm trying to configure a CredentialHandler in Tomcat 8 (8.0.36).
The password in DB are hashed with md5 and encode in base64
I'm trying the following configuration in the context.xml
<Realm>
<CredentialHandler
className="org.apache.catalina.realm.MessageDigestCredentialHandler"
algorithm="md5"
encoding="base64"/>
</realm>

When present, the encoding attributes is ignored. and the CredentialHandler only work when the password are hashed without any encoding afterward.
Did I missuse the encoding attribute ?
Thanks,
Arthur


text:
Q: Скрипт после рендера ReactJS Необходимо вополнить скрипт, когда отрендерится и отобразится на экране некоторый код.
ReactDOM.render(
72
, ...);
console.log('Отобразилось');

Нужно, чтобы запись в консоли появилась после отображения div'ов на экране. Как такое сделать? Представленный выше код, как я понимаю, работает асинхронно

A: Выделите
72
 в отдельную компоненту и используйте useEffect
import React, {useEffect} from 'react';

const Component = () => {
    useEffect(() => {
       console.log('Отобразилось');
    }, [])
    return
72
;
}

И вызовите эту компоненту:
ReactDOM.render(<Component />, ...);


text:
Q: Como buscar en dos modelos al mismo tiempo Tengo los siguientes modelos:
class Videos(models.Model):
    title = models.CharField(max_length=45)

class TimelinePoints(models.Model):
    description = models.CharField(max_length=45)
    videos_id = models.ForeignKey('Videos', models.DO_NOTHING, db_column='Videos_id')
    # ... Otros campos sin importancia

Quiero hacer una búsqueda trayendo todos los videos cuyo titulo contenga el string ingresado por el usuario, y todos los videos cuyos TimelinePoint contengan también dicho string en su campo description.
Hasta ahora lo estaba solucionando de la siguiente manera:
videos = Videos.objects.filter(Q(title__icontains = string_ingresado) | Q(timelinepoints__description__icontains = string_ingresado))

Pero después me di cuenta que mi aplicación necesita tener la lista de descripciones de los TimelinePoints matcheados, por lo que tuve que agregar esta consulta debajo:
timeline_points = TimelinePoints.objects.filter(description__icontains = string_ingresado).only('description')

Esto no me convence mucho ya que estoy haciendo un proceso costoso 2 veces. Entonces mi pregunta es:
¿Hay alguna manera de hacer lo que necesito sin necesidad de realizar la misma búsqueda dos veces?

A: Quizás lo que encuentro menos costozo para solucionar el problema es hacer este queryset:
TimelinePoints.objects.filter(
    Q(descripcion__icontains=string) | Q(videos_id__title__icontains=string)
).select_related('videos_id')

Teniendo en cuenta que así estás haciendo una sola consulta a la base de datos, en la tabla timeline, estas consultado los timeline que en su descripción tenga el string, y los timeline que los videos tengan en el titulo el string, luego estas haciendo un select_related a la tabla de videos para que los traiga en la misma consulta, lo único es que pueden repetirse algunos campos, por lo que es importante pasar un distinct() espero haberte ayudado.


text:
Q: In openjdk, security policies are not taking effect In redhat-openjdk:1.8.0, jvm java.policy and custom.policy file's java.version is being effective on the activeprocess
I've configured the java process to use java security manager and it uses Apache server to run the process. So Apache client look for "java.version" read permission in default and/or custom policy file.
I've included ready property permission, yet i'm getting weird AccessControlException.
Exception i'm seeing is:
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.version" "read")

I've right permissions in place Property permission entry in jvm/secruity/java.policy
permission java.util.PropertyPermission "java.version", "read";

and in custom.policy ( -Djava.security.manager -Djava.security.policy=custom.policy), file path fully-qualified, i just shortened for better understanding):
 permission java.util.PropertyPermission "java.version", "read";

Expectation is to run java process with out issues, but that's not happening.
Edit 1:
I've also tried enforcing all permission using below line:
grant{
 permission java.security.AllPermission;
};

But seems like it is still not working. I've also tried using '==' while setting up policy  file, which mean
`If you use
java -Djava.security.manager -Djava.security.policy==someURL SomeApp

(note the double equals) then just the specified policy file will be used; all the ones indicated in the security properties file will be ignored.`
As per jdk 8 doc
Any help is much appreciated.

A: Looks to me that the policy is not in effect. In case you have multiple JDK releases installed, are you sure that you've modified the default policy for the same release that you are running with? I'd start by granting AllPermissions just to make sure that the policy is in effect, and then focus on the permission line itself.


text: Q: How to show that our model is close to Einstein's gravity after inflation We have a modified $f \left( R \right)$ gravity model. How can we show that the proposed model is close to Einstein's gravity after inflation and does not contradict observation data?


text:
Q: SQL Where IF statement with multiple conditions /*    I am working in SQL Server Report Builder and I have a Where statement where a parameter equals to a value, check another parameter then do something, else do something else.  Below is an example:
*/
where
case when @Parameter1 = 'Value' then
    when @Parameter2 = True then
       Date >= @BegDate and
       Date <= @EndDate and
       totext(Field) = @Parameter1 and
      Field2 = 'Value2'
    Else
       totext(Field) = @Parameter1 and
        Field2 = 'Value2'
Case when @Parameter1 = 'Value3' then
        Field3 = ToNumber(@Parameter3) and
        Field2 = 'Value2';

A: You don't need CASE here, which returns a scalar value. Just use normal boolean logic
WHERE (
       (
             @Parameter1 = 'Value'
         AND @Parameter2 = 'True'
         AND Date >= @BegDate
         AND Date <= @EndDate
         AND totext(Field) = @Parameter1
         AND Field2 = 'Value2'
        )
  OR
        ( @Parameter1 = 'Value'
         AND totext(Field) = @Parameter1
         AND Field2 = 'Value2'
        )
  OR
        ( @Parameter1 = 'Value3'
         AND FIeld3 = ToNumber(@Parameter3)
         AND Field2 = 'Value2'
        )
  )

You can obviously simplify this by pulling some conditions to the outside of the OR

A: You need to rewrite your case so that it "returns" something that you then check for. I'm not sure where exactly what your logic is because your CASEs are incorrectly nested so it's hard to read, but this should give you an idea
WHERE CASE -- first set of conditions
        WHEN @Parameter1 = 'Value'
         AND @Parameter2 = True
         AND Date >= @BegDate
         AND Date <= @EndDate
         AND totext(Field) = @Parameter1
         AND Field2 = 'Value2'
        THEN 1 -- return 1 when the first condition is met

        -- Second set of conditions
        WHEN @Parameter1 = 'Value' -- but not @Parameter2 = True, that'd have been matched above
         AND totext(Field) = @Parameter1
         AND Field2 = 'Value2'
        THEN 1`

        -- Third set of conditions
        WHEN @Parameter1 = 'Value3'
         AND FIeld3 = ToNumber(@Parameter3)
         AND Field2 = 'Value2'
        THEN 1
        -- otherwise we're returning 0
        ELSE 0
    END = 1 -- here we're checking if the CASE returns a 1


text:
Q: PHP mysql_query where x = $this or $that I currently have a mysql_query line that looks like this:
mysql_query("SELECT * from users WHERE id = '". $id1 ."' ") or die(mysql_error());

However, I want to select everything from users where id = $id1 OR $id2. How would I edit this line to do so?
I've thought about just having two copies of this line, one with $id1 and one with $id2. However, I'm sure that there is a more efficent way to accomplish this. I'm very new to SQL.

A: The answer is almost in your question. You should change the query into this:
mysql_query("SELECT * from users WHERE id = '". $id1 ."' OR id = '" . $id2. "'")

You should however not be using the mysql_* functions anymore, since they are deprecated. Use mysqli_* or PDO instead.

A: You can use the IN clause just like the example below.
SELECT * FROM employees WHERE id IN ( 250, 220, 170 );

A: Your query statement can be something like
$query = "SELECT * FROM users WHERE id IN('{$id1}','{$id2}')";

or,
$query = "SELECT * FROM usrs WHERE id = '{$id1}' or id = '{$id2}'";

mysql_* is officially deprecated, so use mysqli or PDO to query your statements.


text:
Q: Have any clones married? I know that clones were made to fight for the Republic during the Clone Wars, and that's all they were used for. But after Order 66, there wasn't anyone to fight against anymore. So did any clones settle down, maybe even marry afterwards?

A: In canon, the only clone who got married (that I'm aware of) is Cut Lawquane, who deserted and married a Twi'lek named Suu before the Clone Wars ended.
In Legends, there are a few clones who got married.
The most notable is, of course, Boba Fett, who married Sintas Vel a few years after the Clone Wars (although Boba certainly didn't "settle down" as a result of his marriage). (Obviously, Boba himself is fully canon, but his marriage is present only in Legends.)
All the others I know of are from Clan Skirata.

*

*Fi Skirata married a human Mandalorian named Parja Bralor at the end of the Clone Wars.

*Null-11 Ordo Skirata married a Republic Treasury Audit Division agent named Besany Wennen. They married before the Clone Wars ended but survived the war and presumably settled down to live a quiet life.

*Clone commando Darman Skirata married a Jedi named Etain Tur-Mukan near the end of the Clone Wars, and they had a son together. However, she was killed shortly after Order 66.

Since we know that some clones married it's reasonable to assume that others did as well -- we just don't know much about the clones after the end of the Clone Wars.


text:
Q: git stash pop : discard local changes in a single file On my-branch
 git stash
 git checkout master
 git pull --rebase
 git checkout my-branch
 git rebase master
 git stash pop

Everything is ok but only 1 file has conflicts and I do not want the changes that I stashed. There are bunch of other files which are not conflicting and those changes are needed.
Unmerged paths:
  (use "git restore --staged <file>..." to unstage)
  (use "git add <file>..." to mark resolution)
  both modified:   /server/Server.java

How do I get rid of these changes and have a clean stash pop ?

A: git checkout HEAD -- /server/Server.java

to discard local changes and check out the state of the file as recorded in HEAD i.e. the current commit.


text:
Q: django.urls.exceptions.NoReverseMatch: Reverse for 'Professors' with arguments '(1, 5)' not found I'm trying to filter my professor table to display the professors that correspond to a specific school and specific major, the parameters are showing up in the error message, I just don't understand why there is a error message at all.
Views.py
from django.http import HttpResponse
from django.shortcuts import render
from .models import professor, School, Major, School_Major

def index(request):
    schools = School.objects.all()
    return render(request, 'locate/index.html', {'schools': schools})

# def Major(request, Major):
#   major_choice = professor.objects.filter(Major =Major)
#   return render(request, 'locate/major.html', {'major_choice': major_choice})

def Majors(request, school_pk):
    schools_majors_ids = []
    major_after_filter = []

    #Filter to a show the association of 1 schools majors
    school_choice = School_Major.objects.filter(school_id = school_pk)

    #Append each of the major id's to school_majors_ids list
    for store in school_choice:
        schools_majors_ids.append(store.major_id)

    #Filter majors names required
    for store in schools_majors_ids:
        name = Major.objects.get(id = store)
        major_after_filter.append(name)
    return render(request, 'locate/major.html', {'major_after_filter' : major_after_filter,
                                                 'school_pk' : school_pk})

def Professors(request, school_pk, major_pk):
    professors = professors.objects.filter(school_id = school_pk).filter(major_id = major_pk)
    return render(request, 'locate/professors', {'professors' : professors})

url.py
from django.urls import path

from . import views

urlpatterns = [
    path('', views.index, name='index'),
    path(' <int:school_pk>/', views.Majors, name='Major'),
    path(' <int:school_pk/<int:major_pk>/', views.Professors, name="Professors")
]

majors.html

{{school_pk}}

                {% for major in major_after_filter %}

{{major.name}}

                {%endfor%}

I needed a way to place the value of the schools primary key, as well as the majors primary key as parameters for the Professor view function to be able to filter down the professor table in order to display the correct majors.
When I leave school_pk as seen below
I get the following error
django.urls.exceptions.NoReverseMatch: Reverse for 'Professors' with arguments '(1, 5)' not found. 1 pattern(s) tried: ['locate/\\ <int:school_pk/(?P<major_pk>[0-9]+)/$']

When I remove the school_pk like below

{{major.name}}

I get this error
TypeError: Professors() missing 1 required positional argument: 'school_pk'

Which makes sense because the professor function requires a school_pk parameter (Note that the variable used in the html and parameter are named the same sorry if that seems confusing).

A: You're missing a close bracket in your URL pattern.
path('<int:school_pk>/<int:major_pk>/',
                    ^


text:
Q: Spring Boot embedded Jetty stop right away after start Here's my main class
@SpringBootApplication
public class SendMsg {
    public static void main(String...args) {
        SpringApplication.run(SendMsg.class, args);
    }
}

In my gradle.build I have:
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
    exclude module: "spring-boot-starter-logging"
}
compile("org.springframework.boot:spring-boot-starter-jetty:${springBootVersion}")

I'm using IntelliJ. When I run the class SendMsg from within the IDE, Spring Boot start, then stop right away. I'm not sure why that's the case.
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
log4j:WARN Please initialize the log4j system properly.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.4.2.RELEASE)

   [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STARTED @3096ms org.eclipse.jetty.websocket.server.WebSocketServerFactory@66ec9390
    2016-11-15 09:21:49.739-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.websocket.jsr356.DecoderFactory | init(org.eclipse.jetty.websocket.jsr356.client.EmptyClientEndpointConfig@4afd21c6)
    2016-11-15 09:21:49.739-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.BooleanDecoder
    2016-11-15 09:21:49.739-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.ByteDecoder
    2016-11-15 09:21:49.740-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.CharacterDecoder
    2016-11-15 09:21:49.740-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.DoubleDecoder
    2016-11-15 09:21:49.740-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.FloatDecoder
    2016-11-15 09:21:49.740-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.IntegerDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.LongDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.ShortDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.StringDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.BooleanDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.ByteDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.CharacterDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.DoubleDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.FloatDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.IntegerDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.LongDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.ShortDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.ByteBufferDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.ByteArrayDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.PongMessageDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.ReaderDecoder
    2016-11-15 09:21:49.741-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.decoders.InputStreamDecoder
    2016-11-15 09:21:49.742-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.websocket.jsr356.EncoderFactory | init(org.eclipse.jetty.websocket.jsr356.client.EmptyClientEndpointConfig@4afd21c6)
    2016-11-15 09:21:49.742-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.BooleanEncoder
    2016-11-15 09:21:49.742-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ByteEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.CharacterEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.DoubleEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.FloatEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.IntegerEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.LongEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ShortEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.StringEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.BooleanEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ByteEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.CharacterEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.DoubleEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.FloatEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.IntegerEncoder
    2016-11-15 09:21:49.743-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.LongEncoder
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ShortEncoder
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ByteBufferEncoder
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.DecoratedObjectFactory | Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ByteArrayEncoder
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STARTED @3102ms org.eclipse.jetty.websocket.jsr356.server.ServerContainer@6d4c273c
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | starting org.springframework.boot.context.embedded.jetty.JettyEmbeddedErrorHandler@46678e49
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.handler.AbstractHandler | starting org.springframework.boot.context.embedded.jetty.JettyEmbeddedErrorHandler@46678e49
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STARTED @3103ms org.springframework.boot.context.embedded.jetty.JettyEmbeddedErrorHandler@46678e49
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | INFO    | [main] | org.eclipse.jetty.server.handler.ContextHandler | Started o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,AVAILABLE}
    2016-11-15 09:21:49.744-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.webapp.WebAppContext | postConfigure o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,AVAILABLE} with org.springframework.boot.context.embedded.jetty.ServletContextInitializerConfiguration@78e89bfe
    2016-11-15 09:21:49.745-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.webapp.WebAppContext | postConfigure o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,AVAILABLE} with org.springframework.boot.autoconfigure.websocket.JettyWebSocketContainerCustomizer$1@652ce654
    2016-11-15 09:21:49.745-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.webapp.WebAppContext | postConfigure o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,AVAILABLE} with org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory$1@522ba524
    2016-11-15 09:21:49.745-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.webapp.WebAppContext | postConfigure o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,AVAILABLE} with org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory$2@29c5ee1d
    2016-11-15 09:21:49.745-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STARTED @3103ms o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,AVAILABLE}
    2016-11-15 09:21:49.745-0600 | sessionId= | correlationId= | INFO    | [main] | org.eclipse.jetty.server.Server | Started @3103ms
    2016-11-15 09:21:49.745-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STARTED @3103ms org.eclipse.jetty.server.Server@1a5f7e7c
    2016-11-15 09:21:49.765-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.server.Server@1a5f7e7c
    2016-11-15 09:21:49.766-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.Server | doStop org.eclipse.jetty.server.Server@1a5f7e7c
    2016-11-15 09:21:49.767-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.Server | Graceful shutdown org.eclipse.jetty.server.Server@1a5f7e7c by
    2016-11-15 09:21:49.767-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.handler.AbstractHandler | stopping org.eclipse.jetty.server.Server@1a5f7e7c
    2016-11-15 09:21:49.767-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.server.session.HashSessionIdManager@24e08d59
    2016-11-15 09:21:49.767-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.server.session.HashSessionIdManager@24e08d59
    2016-11-15 09:21:49.767-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,SHUTDOWN}
    2016-11-15 09:21:49.767-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.handler.AbstractHandler | stopping o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,UNAVAILABLE}
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.springframework.boot.context.embedded.jetty.JettyEmbeddedErrorHandler@46678e49
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.handler.AbstractHandler | stopping org.springframework.boot.context.embedded.jetty.JettyEmbeddedErrorHandler@46678e49
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.springframework.boot.context.embedded.jetty.JettyEmbeddedErrorHandler@46678e49
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.websocket.jsr356.server.ServerContainer@6d4c273c
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.websocket.server.WebSocketServerFactory@66ec9390
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@5bb7643d
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@5bb7643d
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.websocket.server.WebSocketServerFactory@66ec9390
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.websocket.client.WebSocketClient@2e3cdec2
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.websocket.client.WebSocketClient | Stopping org.eclipse.jetty.websocket.client.WebSocketClient@2e3cdec2
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@7a22a3c2
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@7a22a3c2
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping SslContextFactory@2e34384c(null,null)
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED SslContextFactory@2e34384c(null,null)
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.websocket.client.WebSocketClient | Stopped org.eclipse.jetty.websocket.client.WebSocketClient@2e3cdec2
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.websocket.client.WebSocketClient@2e3cdec2
    2016-11-15 09:21:49.768-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.websocket.jsr356.server.ServerContainer@6d4c273c
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.springframework.boot.context.embedded.jetty.ServletContextInitializerConfiguration$Initializer@19ccca5
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.springframework.boot.context.embedded.jetty.ServletContextInitializerConfiguration$Initializer@19ccca5
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.server.session.SessionHandler@7906578e
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.handler.AbstractHandler | stopping org.eclipse.jetty.server.session.SessionHandler@7906578e
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.security.ConstraintSecurityHandler@322803db
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.handler.AbstractHandler | stopping org.eclipse.jetty.security.ConstraintSecurityHandler@322803db
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler@878537d
    2016-11-15 09:21:49.769-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.server.handler.AbstractHandler | stopping org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler@878537d
    2016-11-15 09:21:49.770-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler@878537d
    2016-11-15 09:21:49.770-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.security.ConstraintSecurityHandler@322803db
    2016-11-15 09:21:49.770-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.server.session.HashSessionManager@8a62297
    2016-11-15 09:21:49.770-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@50f40653
    2016-11-15 09:21:49.770-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@50f40653
    2016-11-15 09:21:49.771-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.server.session.HashSessionManager@8a62297
    2016-11-15 09:21:49.771-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.server.session.SessionHandler@7906578e
    2016-11-15 09:21:49.771-0600 | sessionId= | correlationId= | INFO    | [main] | org.eclipse.jetty.server.handler.ContextHandler | Stopped o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,UNAVAILABLE}
    2016-11-15 09:21:49.771-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED o.s.b.c.e.j.JettyEmbeddedWebAppContext@61a91912{/,file:///private/var/folders/vf/sc6988r90rdc0jbbjkhzv571dv5hs5/T/jetty-docbase.1071746313451738117.8080/,UNAVAILABLE}
    2016-11-15 09:21:49.771-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | stopping qtp1145391264{STARTED,8<=8<=200,i=8,q=0}
    2016-11-15 09:21:49.772-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED qtp1145391264{STOPPED,8<=8<=200,i=0,q=0}
    2016-11-15 09:21:49.772-0600 | sessionId= | correlationId= | DEBUG   | [main] | org.eclipse.jetty.util.component.AbstractLifeCycle | STOPPED org.eclipse.jetty.server.Server@1a5f7e7c

    Process finished with exit code 1

Here's the complete build.gradle
group 'com.tung.poc'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.7

repositories {

    mavenLocal()

    maven {
        url 'http://repo1.maven.org/maven2'
    }
    maven {
        url 'http://repo.spring.io/plugins-release'
    }
}

ext {
    springVersion = "4.3.4.RELEASE";
    jsonPath = "0.9.1";
    springBootVersion = "1.4.2.RELEASE";
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
        exclude module: "spring-boot-starter-logging"
    }
    compile("org.springframework.boot:spring-boot-starter-jetty:${springBootVersion}")
    compile "org.springframework:spring-core:${springVersion}"
    compile "org.springframework:spring-jms:${springVersion}"

    compile "com.netflix.hystrix:hystrix-metrics-event-stream:1.4.10"

    testCompile(
            "junit:junit:4.12",
            "org.mockito:mockito-core:1.10.8",
            "org.easytesting:fest-assert-core:2.0M10",
            "org.hamcrest:hamcrest-all:1.3",
            "org.springframework:spring-test:${springVersion}",
            "com.jayway.jsonpath:json-path-assert:${jsonPath}",
            'nl.jqno.equalsverifier:equalsverifier:1.7.4'
    )
}

A: Try with this Gradle configuration
Sources from spring-boot docs https://spring.io/guides/gs/spring-boot/
dependencies {
    // tag::jetty[]
    compile("org.springframework.boot:spring-boot-starter-web") {
        exclude module: "spring-boot-starter-tomcat"
    }
    compile("org.springframework.boot:spring-boot-starter-jetty")
    // end::jetty[]
    // tag::actuator[]
    compile("org.springframework.boot:spring-boot-starter-actuator")
    // end::actuator[]
   testCompile("junit:junit:4.12",
        "org.mockito:mockito-core:1.10.8",
        "org.easytesting:fest-assert-core:2.0M10",
        "org.hamcrest:hamcrest-all:1.3",
        "org.springframework:spring-test:${springVersion}",
        "com.jayway.jsonpath:json-path-assert:${jsonPath}",
        'nl.jqno.equalsverifier:equalsverifier:1.7.4')
}


text:
Q: Equivalent tool as MAC agent in Visual Studio 2017 for Nativescript using Visual Code I am new to Nativescript.
Need to know if there is any tool available to connect to MAC emulator like we have MAC agent in Visual Studio 2017 for Xamarin

A: Unfortunately we don't have anything as such with Sidekick,  yet. Only could builds are supported at the moment which requires real device.


text:
Q: Is it possible to add a color picker or a hex field to WooCommerce attribute to make it similar to color swatch without a plugin? I have a multilingual WooCommerce shop using the WPML plugin. All of my products are variable products not simple. I have created WooComerce attributes like (size, brand, and color) that I use for filtration on the shop page.
What I'm trying to achieve is that "I want to extend the WooCommerce variable color attribute by adding a color picker or even a simple field to add my hex color code to it, so it will be showing on the shop page as a color not just a name for a better user experience" similar to color swatches but without the use of any plugins at all.
So from the WooComerce attributes page, a color picker or a field to accept my #hex value will be added.

To achieve this look on the shop page.

I have been looking for a solution for this functionality all over the internet without the use of a plugin but I couldn't find any even though I have developed some CSS rules for achieving that but I know it's not the best approach since I need to add a rule for each color and it uses the (*) which is slow and not recommended.
a[href*="filter_color=reds"]{
    background-color: #cc1818;
    font-size: 0;
}

a[href*="filter_color=creams"]{
    background-color: #d5b49f;
    font-size: 0;
}

a[href*="filter_color=blacks"]{
    background-color: #2f3032;
    font-size: 0;
}

... etc for all colors even if I have n.

So can I achieve this through code? or even without the need to create the color picker or #hex value field and use a different approach like target the label of that color?
Any help will be appreciated.

A: Please check sity by Misha Rudrastyh.https://rudrastyh.com/woocommerce/display-variations-with-color-or-size-buttons.html. Maybe you can do something similar as a function.

$attribute_type = $wpdb->get_var(
        $wpdb->prepare(
            "
            SELECT attribute_type
            FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies
            WHERE attribute_name = '%s'
            ",
            substr( $taxonomy, 3 ) // remove "pa_" prefix
        )
    );


text:
Q: How can i protect a URL/Directory in my site? I want to protect a URL in my site For exapmle: www.mysite.com/admin using user "Login"
I don't want to let anyone see any content in the "admin" directory not even a picture or any other file. How could this be possible? i have read about the sessions and all but that can stop a user to access a webpage. I am familiar with PHP. Please help!

A: I'm not quite sure what is your purpose so
.htaccess is the one solution to help you protect your data if the user know all specific path
but this solution need some effort to learn
but if you think no one know your specific path so an quick and easy way is to create plain index.php to echo some wording to who want to access that folder in every folder you have can help you to protect the list of directory in your folder path
hope this help ;)

A: It's a little bit ugly, but the easiest way would be to password protect the directory, which would bring up an authentication pop-up type box to the browser. If you are using Apache, you can find out more information in the Apache docs. If you are using another server, they will likely have similar docs available somewhere. This can also be done directly by PHP by sending the correct header in order to authenticate against a database instead of storing the users' information in a text file.
If you are looking to make it seamlessly integrate into your site (i.e. without the ugly pop-up), it is a bit more difficult, but doable. The PHP files are easy. Just write some sort of code to determine if the user is logged in, and if not, don't show the content. However for the images or other static files, I would recommend doing something like this: Echo/print a jpg-image with php, for safety?

A: Take a look at this, you can hide according to your need


text:
Q: Basic encapsulation in C Background

*

*Writing a library with two kind of functions

*

*process array

*process array char

*This data structure is accessed by the project inner loop

Situation
I attempt to encapsulate the array declaration with its initialization as a step to keep related code together.
I am aware I will need to pass an array pointer to each function and wonder about performance.
Version 1 :
#include <stdio.h>

typedef struct char_array {
    unsigned char uchar;
    char          achar;

} char_array;

#define CA_SIZE 1000000

char_array *ptr_array_one;
char_array *ptr_array_two;

main() {
    char_array_init(ptr_array_one);
    char_array_search(ptr_array_one);

    char_array_init(ptr_array_two);
    // etc.
}

char_array_init(struct char_array *ptr_array) {
    static char_array ptr_array[CA_SIZE];

    ptr_array[0].uchar= 'a';
    ptr_array[5].uchar= 'b';

    printf("%c\n\n", ptr_array[0].uchar);
}

char_array_search(struct char_array *ptr_array){
    printf("%c\n\n", ptr_array[5].uchar);
}

I also tried Version 2 :
    #include <stdio.h>

    typedef union char_array {
        unsigned char uchar;
        char        achar;
    } char_array;

    #define CA_SIZE 1000000

    char_array *ptr_array_one;

    main() {

        ptr_array_one = char_array_init(ptr_array_one);

    }

    union * char_array_init(union char_array ptr_array) {

            static char_array char_array[CA_SIZE];

                char_array[0].uchar= 'a';
                char_array[5].uchar= 'b';

                printf("%c\n\n", char_array[0].uchar);
                return &char_array;
    }

I cannot get this to compile either.
Question
I am looking for a solution to achieve this coding attempt, inspired by this code
I am trying to dynamically declare two or more static arrays, for a pointer (ptr_array_one, ptr_array_two, ...) to reference them.
char_array_init()

*

*to declare and initialize a different array each time it is called

*to place array address into ptr_array_one, ptr_array_two, ...

char_array_search() intends to access a specific array, hence receives a char_array structure pointer as argument.
This code is my attempt to isolate the sought feature rather than the actual inner loop.
This code does not compile successfully. It's the best I can come up with.

A: Starting from this code of yours (with the function reindented but otherwise unchanged):
#include <stdio.h>

typedef union char_array {
    unsigned char uchar;
    char        achar;
} char_array;

#define CA_SIZE 1000000

char_array *ptr_array_one;

main() {

    ptr_array_one = char_array_init(ptr_array_one);

}

union * char_array_init(union char_array ptr_array) {

    static char_array char_array[CA_SIZE];
    char_array[0].uchar= 'a';
    char_array[5].uchar= 'b';

    printf("%c\n\n", char_array[0].uchar);
    return &char_array;
}

I would immediately write it like this:
#include <stdio.h>

typedef union char_array
{
    unsigned char uchar;
    char achar;
} char_array;

#define CA_SIZE 1000000

union char_array *char_array_init(union char_array **ptr_array);

char_array *ptr_array_one;
char_array *ptr_array_two;

int main(void)
{
    ptr_array_two = char_array_init(&ptr_array_one);
    printf("one: %c (%p)\n", ptr_array_one->uchar, (void *)ptr_array_one);
    printf("two: %c (%p)\n", ptr_array_two->uchar, (void *)ptr_array_two);
    return 0;
}

union char_array *char_array_init(union char_array **ptr_array)
{
    static char_array char_array[CA_SIZE];

    char_array[0].uchar = 'a';
    char_array[5].uchar = 'b';

    printf("%c\n\n", char_array[0].uchar);
    *ptr_array = char_array;
    return char_array;
}

This compiles cleanly using:
gcc -g -O3 -std=c11 -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes \
    -Werror tddoop.c -o tddoop

and runs:
a

one: a (0x104e9d040)
two: a (0x104e9d040)

Since the two pointers end up pointing at the same (enormous) static array, it isn't surprising that the printing prints the same pair of values twice.

A: Partial answer :
This article proposes a solution to encapsulate in C

*

*type safe

*hides data structures from the API user

*does not require typedef on the struct


text:
Q: JQuery. how do I create nested buttons with well defined onclick action (MODIFIED) For my little project (which involves nested forms), it seems that I need something as below. I am not sure how to pass parameters x and y as to have nested buttons. What I need is that a nested button 'knows' under which outer button is. How do I achieve that? Is there a way to write something like $(".add_field_button_sub_"+x+"")?

<title> test </title>

TEST

    <button class="add_field_button">Fonti</button>


text:
Q: Change row count doesn't work in materialize css text area In materialize css text area, is it possible to initialize the text area with a specific row count using "rows='20'" ? How can we increase the default row count ?
code which doesn't work:

   <textarea id="textarea1" class="materialize-textarea" rows="20" ></textarea>
   Text

A: Instead of that you can add style attribute like this
<textarea class="materialize-textarea" style="height: 200px;"></textarea>

And materialize won't override it

A: The default stylesheet is setting a height so you'll have to override that.
textarea.materialize-textarea{height: 6rem;}

A: Works for me.
$('#textarea1').val('New Text');

M.textareaAutoResize($('#textarea1'));

A: Unfortunately, materializecss changes the basic concepts of DOM, HTML, etc.
textarea {
     height: your height;
     width: your width:
}

A: I tried with this
<textarea class="materialize-textarea" style="height: 200px;"></textarea>

But my textarea was hide and I shown it with jQuery but don't work.
$('#textarea').show();
So i do it and works correctly.
$('#textarea').show(function(){
        $(this).css("height","80px");
    });


text:
Q: Scroll to top inside an iframe when clicked I have an iframe which pops up on click event on the main page. The iframe has a big form content, so when I click on a reset botton at the end of the form I want the iframe content to scroll to Top.
$(document).ready(function () {
    $("#reset").click(function (e) {
        /*clearFormContent();*/
        $('body').prop('scrollTop', 0);
    }).click(function (e) {
        e.preventDefault();
    });
});

I have tried the above code but not working for me, I have tried, .animate({scrollTop:0}) too
But it doesn't seem to work. Do you have any idea?

A: then try to detect onload event and do it that way:
var myIframe = document.getElementById('iframe');
myIframe.onload = function () {
    myIframe.contentWindow.scrollTo(xcoord,ycoord);
}

A: This seems to fix the issue:
  $("#reset").click(function (e) {
                                 $('html, body').animate({
                                     scrollTop: $("body").offset().top
                                       }, 500);
                                }).click(function (e) { e.preventDefault();});

A: change your code
$(document).ready(function () {
    $("#reset").click(function (e) {
        /*clearFormContent();*/
        $('body').prop('scrollTop', 0);
    }).click(function (e) {
        e.preventDefault();
    });
});

for this
$(function(){

        $("#reset").click(function (e) {

            $(this).parents("body").animate({scrollTop:0});
        }).click(function (e) {
            e.preventDefault();
        });

})


text:
Q: Run php script by docker-compose.yml I am getting started with docker. I want to run simple php code:
<?php
    echo 'Hello World !';
?>

I have docker-compose.yml:
version: '3'
services:
    web:
        image: webdevops/php-apache-dev:latest
        container_name: web
        restart: always
        environment:
          - PHP_DISPLAY_ERRORS=1
          - PHP_MEMORY_LIMIT=2048M
          - PHP_MAX_EXECUTION_TIME=300
          - PHP_POST_MAX_SIZE=500M
          - PHP_UPLOAD_MAX_FILESIZE=1024M
        volumes:
          - ./public_html/:/var/www/html
        ports:
          - "80:80"
          - "443:443"
          - "32823:22"
        links:
          - mysql
    mysql:
        image: mariadb:10
        container_name: mysql
        restart: always
        ports:
          - "3306:3306"
        environment:
          - MYSQL_ROOT_PASSWORD=root
          - MYSQL_DATABASE=test
        volumes:
          - db-data:/var/lib/mysql
    phpmyadmin:
        container_name: phpmyadmin
        restart: always
        image: phpmyadmin/phpmyadmin:latest
        environment:
          - MYSQL_ROOT_PASSWORD=root
          - PMA_USER=root
          - PMA_PASSWORD=root
        ports:
          - "8080:80"
        links:
          - mysql:db
        depends_on:
          - mysql

volumes:
    db-data:
        external: false

Structure is:
-app
  -public_html
     -index.php
  -docker-compose.yml

I run this configuration by docker-compose up -d
The problem is that I enter localhost on the web browser I have:

Any suggestions how can I run my PHP script?
Thanks.

A: Hi you should use the right volume settings see https://dockerfile.readthedocs.io/en/latest/content/DockerImages/dockerfiles/php-apache-dev.html#php-development-environment-variables
version: '3'
services:
    web:
        image: webdevops/php-apache-dev:latest
        container_name: web
        restart: always
        environment:
          - PHP_DISPLAY_ERRORS=1
          - PHP_MEMORY_LIMIT=2048M
          - PHP_MAX_EXECUTION_TIME=300
          - PHP_POST_MAX_SIZE=500M
          - PHP_UPLOAD_MAX_FILESIZE=1024M
        volumes:
          - ./public_html/:/app
        ports:
          - "80:80"
          - "443:443"
          - "32823:22"
        links:
          - mysql
    mysql:
        image: mariadb:10
        container_name: mysql
        restart: always
        ports:
          - "3306:3306"
        environment:
          - MYSQL_ROOT_PASSWORD=root
          - MYSQL_DATABASE=test
        volumes:
          - db-data:/var/lib/mysql
    phpmyadmin:
        container_name: phpmyadmin
        restart: always
        image: phpmyadmin/phpmyadmin:latest
        environment:
          - MYSQL_ROOT_PASSWORD=root
          - PMA_USER=root
          - PMA_PASSWORD=root
        ports:
          - "8080:80"
        links:
          - mysql:db
        depends_on:
          - mysql

volumes:
    db-data:
        external: false


text:
Q: Find Next / Previous Element I am loading data via ajax from a row of divs with a class of .gameListing. When one of the divs is clicked it has a class of .active added and loads the relative data into a container, this is all working perfectly.
What I would like is to have a Previous & Next link which finds the next or prev .gameListing and clicks it.
$('.gameListing').click(function(){

    $('.gameListing').removeClass('active');
    $(this).addClass('active');

    var id = $(this).attr('data-id');
    var url = "http://localhost:8888/projects/superfreerespo/" + id + "?json=get_category_posts&slug=games";

    call_ajax(url);
});

function call_ajax(url) {

    $.ajax( {
            url: url,
            method: "GET",
            data: {json:  1},
            dataType: "JSON"
     })

        .done(function( data ) {

        // LOAD GAME INFORMATION
        $("#game-name").html(data.post.title);
        $("#game-reels").html(data.post.custom_fields.reels);
        $("#game-paylines").html(data.post.custom_fields.paylines);
        $("#game-minBet").html(data.post.custom_fields.min_bet);
        $("#game-maxBet").html(data.post.custom_fields.max_bet);
        $("#game-jackpot").html(data.post.custom_fields.jackpot);
        $("#game-info").html(data.post.custom_fields.game_info);

        // LOAD GAME PROVIDERS
        var provSource = new String(data.post.custom_fields.game_name);
                provSource = provSource.replace(/ /g,"-");
                $("#game_provs").load("http://localhost:8888/projects/superfreerespo/" + provSource + "/ .gameBox-Ops");

        // LOAD GAME THUMBNALS
        var gameThumbSrc = new String(data.post.custom_fields.game_name);
        gameThumbSrc = gameThumbSrc.replace(/ /g,'');

        $('#gameBoxGallery').html('');
            for(i = 0;  i<= 2; i++){
                            image = '<img src="<?php bloginfo('template_directory'); ?>/images/games/screenshots/' + gameThumbSrc + '-' + i + '.jpg" class="gameThumb">'
                            $('#gameBoxGallery').append(image);
        };

        // ZOOM FIRST THUMBNAIL
        $('#gameBox-Screenshot').html('');
            image = '<img src="<?php bloginfo('template_directory'); ?>/images/games/screenshots/' + gameThumbSrc + '-0' + '.jpg" id="gameScreenshot">'
        $('#gameBox-Screenshot').append(image);

        })
}

A: How about something like this:
$('.prev').click(function(){

    var $current = $('.gameListing .active');
    $current.removeClass('active')
    $current.prev().addClass('active');

    var id = $current.prev().attr('data-id');
    var url = "http://localhost:8888/projects/superfreerespo/" + id + "?json=get_category_posts&slug=games";

    call_ajax(url);
});

$('.next').click(function(){

    var $current = $('.gameListing .active');
    $current.removeClass('active')
    $current.next().addClass('active');

    var id = $current.next().attr('data-id');
    var url = "http://localhost:8888/projects/superfreerespo/" + id + "?json=get_category_posts&slug=games";

    call_ajax(url);
});

UPDATE
If you want to use a generic function:
$('.prev').click(function(){
     Navigate('previous');
});

$('.next').click(function(){
     Navigate('next');
});

function Navigate (direction){
    var $current = $('.gameListing .active');
    $current.removeClass('active')

    var secondItem = $current.next().addClass('active');
    if(direction == 'previous')
         secondItem = $current.prev().addClass('active');

    var id = secondItem.attr('data-id');
    var url = "http://localhost:8888/projects/superfreerespo/" + id + "?json=get_category_posts&slug=games";

    call_ajax(url);

}

A: You can use .next() from Jquery
for more detail https://api.jquery.com/next/ & for Previous use .prev()
https://api.jquery.com/prev/

A: Here's a solution for if your .gameListing are not next to eachother (so if next() and prev() won't work):
Fiddle for if the code snippet doesn't work.

jQuery.fn.reverse = function() {
    return this.pushStack(this.get().reverse(), arguments);
};
function GameListing(el) {
    $('.gameListing').removeClass('active');
    $(el).addClass('active');

    var id = $(el).attr('data-id');
    var url = "http://localhost:8888/projects/superfreerespo/" + id + "?json=get_category_posts&slug=games";

    //call_ajax(url);
    $('#result').text('URL: ' + url);
}
$('.gameListing').click(function () {
    GameListing(this);
});
$('.prev').click(function () {
    var next = false;
    $('.gameListing').reverse().each(function () {
        if (next) {
            GameListing(this);
            return false;
        }
        if ($(this).hasClass('active')) {
            next = true;
        }
    });
});
$('.next').click(function () {
    var next = false;
    $('.gameListing').each(function () {
        if (next) {
            GameListing(this);
            return false;
        }
        if ($(this).hasClass('active')) {
            next = true;
        }
    });
});

function call_ajax(url) {
  // Your code here
}
div {
    display:inline-block;
    border:1px solid black;
    padding:2px 5px;
    margin:0 5px;
    cursor:pointer;
    float:left;
}
div.active {
    background:green;
}
#result {
    background:red;
    display:block;
    float:left;
    clear:left;
    width:300px;
    text-align:center;
    margin:20px 0;
}

«

1

2

3

4

»

A: Simple solution using custom data attribute
var $current = $('.gameListing.active');
$current.removeClass('active')

var postNumber = parseInt($current.attr('data-count'));

var nextPost = (postNumber - 1);

$("[data-count='"+nextPost+"']").trigger("click");


text:
Q: Flex CrossDomain.xml Error - Channel.Security.Error error Error #2048 I am struggling with getting a Flex SWF (which is embedded in JSP) to access remote data (from another domain).
I have a crossdomain.xml (which is embedded in my SWF). Its content is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy>
    <site-control permitted-cross-domain-policies="all" />
    <allow-access-from domain="*"/>
    <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

In my main.xml I load the crossdomain.xml file using:
Security.loadPolicyFile("http://www.mysite.com:8380/CSS/ReviewItemsServer/crossdomain.xml");

When I access the JSP webpage via the browser, the embedded SWF tries to do a Java remoting call and I get the following error:
Error string = Send failed
Error code = Client.Error.MessageSend
Error details = Channel.Security.Error error Error #2048:
Security sandbox violation: http://www.mysite.com/CSS/ReviewItemsServer/ReviewItemsMain.swf
cannot load data from http://www.mysite.com:8380/CSS/ReviewItemsServer/messagebroker/amf. url:

I am pretty sure that the crossdomain.xml file actually get loaded by the SWF as I have created a simple URLLoader to load the xml file and check that there is no error. So I dont think that is an issue...
When I run the SWF in debug mode...I also see the following error message:
Error: [strict] Ignoring policy file at http://www.mysite.com:8380/CSS/ReviewItemsServer/crossdomain.xml due to missing Content-Type.  See http://www.adobe.com/go/strict_policy_files to fix this problem.

Any help would be greatly appreaciated....
Mark

A: You need a master policy file at http://www.mysite.com:8380/crossdomain.xml with the following contents:
<?xml version="1.0" encoding="ISO-8859-1"?>
<cross-domain-policy>
  <site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>

That will permit crossdomain policy files in subdirectories to be used.


text:
Q: how to set shadow border with round corners in android (using open source only) I want to create a container like this:

I have tried this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".MainActivity$PlaceholderFragment"
    android:weightSum="1">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="100dip"
        android:src="@android:drawable/alert_dark_frame"
        android:id="@+id/textView1"
        android:gravity="center"
        android:background="#152"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="10dip"
        android:text="New Text"
        android:textColor="#FFFFFF"
        android:id="@+id/textView2"
        android:background="#120"
        android:gravity="center"
        android:layout_weight="0.07" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="30dip"
        android:text="--"
        android:textSize="30dp"
        android:id="@+id/textView3"
        android:gravity="center"
        android:layout_weight="0.88" />

</LinearLayout>

and this is my output:

how can I create the shadow border and rounded corners?
I want the corners to be around the whole container and not on each shape\color separately.
So I need to user "upper" and "lower" corners?

A: You can try using a library for creating nice layouts with shadow.
Try this one here.


text:
Q: Selenium javascript util and elementIsEnabled trying to click remove when input is enabled:
https://the-internet.herokuapp.com/dynamic_controls
const { expect } = require("chai");
const {Builder,By} = require("selenium-webdriver");
describe("Dynamic controls",function(){
it("Remove/add checkbox",async function(){
    const driver = new Builder().forBrowser("firefox").build();
    await driver.get("https://the-internet.herokuapp.com/dynamic_controls");
    await driver.findElement(By.css("#input-example>button")).click();
    await driver.wait(driver.until.elementIsEnabled(By.CSS('#input-example > input[type=text]')), 30000);
    await driver.findElement(By.css("#checkbox-example>button")).click();
});

});
I get an error: TypeError: Cannot read property 'elementIsEnabled' of undefined
If I try:
await driver.wait(until.elementIsEnabled(By.CSS('#input-example > input[type=text]')), 30000);

Have other error: ReferenceError: until is not defined

A: Right way
await driver.wait(until.elementIsEnabled(driver.findElement(By.css('#input-example > input[type=text]'))), 10000);

elementIsEnabled accepts a webelement


text:
Q: How to search by genre in Windows10? I've got a bunch of mp3s.  Each album is a folder which is named after the artist.
I am trying to search through all of them to find a particular genre, which is contained in the mp3 tags.
So far I've got this in my search bar:
grime kind:=music tags:genre
However it is not producing any results.  I don't know why.  I've tried adding in the equels as in the 'kind' like so:
grime kind:=music tags:=genre but it is not working either.
Anyone got any ideas?  I know this is doable with lots of other third party programs but damn it Windows 10 should be able to do this native by now.

A: Okay so once I optimised the folder to 'Music' and applied to to the root folder and all subfolders, I then got the option to do this:
kind:=music genre:Grime
So its not tags.  It's simply genre.
Just leaving this here for anyone else who needed to know that.


text:
Q: How to remove all the characters in char array from a given string recursively without using loops? I am practicing Java tutorial and I am trying to remove all the characters given in char array from a given string (e.g. array contains 'b', 'm', 'w'. Target string is "big workshop", output: "ig orkshop"). But I cannot use loops and I should do it recursively. I have managed it without recursion but not with recursion.
This is my non-recursive code:
char[] testChars={'E', 'i', 'n'};
String b = new String(testChars);
...
public static String removeChars(String text)
{
 return text.replaceAll("[" + b + "]", "");
}

A: Try this,
public class Example
{
   public static void main(String[] agrs) {
       String input = "big workshop";
       char[] charToRemove = {'b', 'm', 'w'};
       String charsToRemove = new String(charToRemove);
       StringBuilder sb = new StringBuilder();
       Example ex = new Example();
       ex.removeChar(input, 0, charsToRemove, sb);
       System.out.println(sb);

   }

   public void removeChar(String input, int index, String charToRemove, StringBuilder target) {

       if(input.length() == index) {
           return;
       }

       char c = input.charAt(index);
       if(charToRemove.indexOf(c) == -1) {
           target.append(c);
       }

       removeChar(input, index + 1, charToRemove, target);

   }

}

A: Try:
public static String removeChars(String text, char[] chars) {
    return removeChars(text, chars, 0);
}

private static String removeChars(String text, char[] chars, int currentIndex) {
    if(currentIndex == chars.length) {
        return text;
    }
    char currentChar = chars[currentIndex];
    String removed = text.replace(currentChar.toString(), "");
    return removeChars(removed, chars, currentIndex + 1);
}

A: When trying to use recursion, you have two remember that you are either at a base case or taking a step toward it.
For example: your base case could be the end of the string. You have two possibilities at each recursive level.
1) you are at the end of the string: return an empty string to use as a building base.
2) you are not at the end of the string: you can check the first character and pass the rest of the string to a recursive call.
See the example below. This is not tested code but should point you in the right direction.
public String recursiveRemove (String[] arr, String str){
    // first check if at the base case
    if (str.length() == 0) {
        return "";
    }
    // else handle character, and reduce to approach base case
    String character = str.substring(0,1);
    // contains is not a method but just to show the logic being used here
    if (arr.contains(character)){
        //replace character with empty sting to remove it from the result
        character = "";
    }
    // return the character (or empty string) with the result of the
    // recursive call appended onto the end
    return character + recursiveRemove(arr, str.substring(1));
}

A: You can replace for-loops this way:
public void replaceFor(int i , Predicate<Integer> p , Consumer<Integer> c , Function<Integer , Integer> f)
{
    //check whether the termination-condition is true
    if(!p.test(i))
        return;

    //this consumer does what would be in the for-loop
    c.accept(i);

    //continue with the next value for i
    replaceFor(f.apply(i) , p , c , f);
}

A basic for-loop replacement that prints all numbers from 0 to 10 would look like this:
replaceFor(0 , i -> i <= 10 , i -> System.out.println(i) , i -> ++i);

A: Here is a solution that

*

*Maintains your method signature

*Does not mask iteration with recursion

*Teaches you divide and conquer

Note, I'm not thrilled about the testChars field, but it looks like you already had that in your iterative version.
private final static char[] testChars = {'b', 'm', 'w'};

  public static String removeChars(String text) {
    switch (text.length()) {
      case 0:
        return "";
      case 1:
        char asChar = text.charAt(0);
        for (char testChar : testChars) {
          if (asChar == testChar) {
            return "";
          }
        }
        return text;
      default:
        int middle = text.length() / 2;
        String firstHalf = text.substring(0, middle);
        String lastHalf = text.substring(middle);
        return removeChars(firstHalf) + removeChars(lastHalf);
    }

  }

  public static void main(String... args) {
    System.out.println(removeChars("big workshop"));
  }