text:
Q: DateEdit DevExpress Работаю с DateEdit (контрол DevExpress). Хочу сделать так, чтобы при запуске программы поле Text было заполнено и редактирование контрола было запрещено.
<dxe:DateEdit DateTime="{Binding FromDate}" Text="Od" Height="23" Width="161" Margin="3" EditValue="Od" />

A: Установите свойство IsReadOnly = "True". Поле Text у вас уже устанавливается.


text:
Q: React Native TextInput returnKeyType not working I have a number of TextInput in my react-native application and I want that if user clicks on next key, the next input must be focused. I am trying to do this with returnKeyType prop passed to all the TextInput. However this doesn't work as intended ,i.e. next input is not focused. And my code for same looks like
<TextInput
              ref={firstInputForDaysInterestTextInputRef}
              value={closingCosts.firstInputForDaysInterest}
              onChangeText={value =>
                onStateChange('firstInputForDaysInterest', value)
              }
              onEndEditing={event =>
                onEndEditing(
                  'firstInputForDaysInterest',
                  event.nativeEvent.text,
                )
              }
              placeholderTextColor={colors.placeholderColor}
              placeholder={constants.common.zeroPlaceholder}
              autoCapitalize="none"
              returnKeyType="next"
              onFocus={() => onFocus(elementName)}
              keyboardType="decimal-pad"
              style={[
                styles.textInput,
                styles.textInputWidth,
                styles.textInputMargin,
              ]}
            />

The workaround that I thought was passing ref and then focusing the next input onEndEditing, but if I does this the textinput will not be closed when I tap outside the textInput. So how can I make my text input to focus on next one?

A: You can use onSubmitEditing prop to focus the next input for example:
 const firstInputForDaysInterestTextInputRef = React.useRef()
  const secondInputForDaysInterestTextInputRef = React.useRef()

  return (
    <View style={styles.container}>
            <TextInput
              ref={firstInputForDaysInterestTextInputRef}
              placeholderTextColor={'gray'}
              placeholder={'first'}
              autoCapitalize="none"
              returnKeyType="next"
              keyboardType="decimal-pad"
              onSubmitEditing={()=>secondInputForDaysInterestTextInputRef.current?.focus()}
              style={[
                styles.textInput,
                styles.textInputWidth,
                styles.textInputMargin,
              ]}
            />
            <TextInput
              ref={secondInputForDaysInterestTextInputRef}

              placeholderTextColor={'gray'}
              placeholder={'second'}
              autoCapitalize="none"
              returnKeyType="next"
              onFocus={() => alert('I am focused !')}
              keyboardType="decimal-pad"
              style={[
                styles.textInput,
                styles.textInputWidth,
                styles.textInputMargin,
              ]}
            />

    </View>
  );

Example on Snack

A: If you want to hide the textinput (hide keyboard) when pressing somewhere else in the app, wrap it it like this for example:
 <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={styles.container}>
<TextInput />
</View>
</TouchableWithoutFeedback>

Don't forget to import TouchableWithoutFeedback and Keyboard from 'react-native'

redpajama_set_name: RedPajamaStackExchange


text:
Q: Activerecord in Sinatra transactional callbacks warning Sinatra project with activerecord gem raise a warning:
DEPRECATION WARNING: Currently, Active Record suppresses errors raised
within `after_rollback`/`after_commit` callbacks and only print them
to the logs. In the next version, these errors will no longer be
suppressed. Instead, the errors will propagate normally just like in
other Active Record callbacks.

You can opt into the new behavior and remove this warning by setting:

**config.active_record.raise_in_transactional_callbacks = true**

Gemfile.lock
activemodel (4.2.0)

      activesupport (= 4.2.0)
      builder (~> 3.1)

How to remove this? thanks!
EDIT: The mini project is here https://gist.github.com/williamhqs/c127e5d7018aa61cb02a

A: The error message tells you what to do. In Rails, add this line to your application for the time being:
config.active_record.raise_in_transactional_callbacks = true

In Sinatra, you can do it directly on ActiveRecord::Base:
ActiveRecord::Base.raise_in_transactional_callbacks = true

Keep in mind that this configuration option itself will be deprecated with the next release of Active Record.

A: Patrick is right, to remove the warning and go to the new behaviour, you should add
Rails : config.active_record.raise_in_transactional_callbacks = true
Sinatra : ActiveRecord::Base.raise_in_transactional_callbacks = true
I think a little background on what it exactly does is important :
https://github.com/rails/rails/pull/16537 and https://github.com/rails/rails/pull/14488
Actual Behaviour for after_commit / after_rollback : When there is an error, the error is logged however it's not shallowed. Meaning that the error does not stop the current execution.
Futur Behaviour for after_commit / after_rollback : When there is an error, the error is logged and WILL NOT BE shallowed. Meaning that the error WILL STOP the current execution.
The warning displayed is only here to inform you of that futur behaviour, and this warning will be removed on futur versions of Rails / ActiveRecord.


text:
Q: terminal wont stop prompting for input (homework) I am extremely new to the UNIX operating system and thus am experiencing some difficulties in my homework.
what i am trying to accomplish is using if/then statements within an alias. here is the code i have written...
alias getname='read filename'

alias vfile='getname; if [ ! -f $filename ]; then echo "Irregular file";'

I do not get errors when I source this for testing but when i run the command it does not stop prompting for input like so...
> 1a.out
>
>
>
>
> -bash: syntax error: unexpected end of file

as you can see it will only stop when i hit control d. I don't know why it is doing this and any help provided would be greatly appreciated.
Also I am completely that using a shell function or script would be much more efficient but i am required to use an alias for the assignment.

A: Like I mentioned in the comment above, you're missing a fi to your if:
$ type getname
getname is aliased to `read filename'

$ type vfile
vfile is aliased to `getname; if [ ! -f $filename ]; then echo "Irregular file"; fi'

Then:
$ vfile
doesNotExist
Irregular file
$ vfile
/etc/passwd
$


text:
Q: Facing Hard Time Setting Up Stanford-corenlp in PYTHON I am not finding a single complete tutorial to use stanford corenlp on my system (windows) using python. After searching a lot I am using StanfordCoreNLP package and using on my system. I dont find any documentation to use it more efficiently. I want to extract RELATIONS and OPENIE Since there is no documentation anywhere I just tried putting OpenIE in properties
self.props = {
            'annotators': 'tokenize,ssplit,pos,lemma,ner,parse,depparse,dcoref,relation,OpenIE',
            'pipelineLanguage': 'en',
            'outputFormat': 'json'
        }

and
self.nlp.relations(sentence)
self.nlp.relations(sentence)

But it doesnt work! (obviously). I get this error
AttributeError: 'StanfordCoreNLP' object has no attribute 'relations'
AttributeError: 'StanfordCoreNLP' object has no attribute 'openie'
Can you please guide me to the sources where I can get detailed tutorials for PYTHON?
and I heard that StanfordCoreNLP package doesnt have all the features of Stanford-corenlp? Its so confusing! There are so many packages and hard to decide which one to use and which is the right one!
Please help!
from stanfordcorenlp import StanfordCoreNLP
import logging
import json

class StanfordNLP:
    def __init__(self, host='http://localhost', port=9000):
        self.nlp = StanfordCoreNLP(host, port=port,
                                   timeout=30000)  # , quiet=False, logging_level=logging.DEBUG)
        self.props = {
            'annotators': 'tokenize,ssplit,pos,lemma,ner,parse,depparse,dcoref,relation,OpenIE',
            'pipelineLanguage': 'en',
            'outputFormat': 'json'
        }

    def word_tokenize(self, sentence):
        return self.nlp.word_tokenize(sentence)

    def pos(self, sentence):
        return self.nlp.pos_tag(sentence)

    def ner(self, sentence):
        return self.nlp.ner(sentence)

    def parse(self, sentence):
        return self.nlp.parse(sentence)

    def dependency_parse(self, sentence):
        return self.nlp.dependency_parse(sentence)

    def annotate(self, sentence):
        return json.loads(self.nlp.annotate(sentence, properties=self.props))

    def cor(self, sentence):
        return (self.nlp.coref(sentence))

    # **I tried to get relations and OpenIE**
    def relations(self, sentence):
        return (self.nlp.relations(sentence))

     def openie(self, sentence):
        return (self.nlp.openie(sentence))

    @staticmethod
    def tokens_to_dict(_tokens):
        tokens = defaultdict(dict)
        for token in _tokens:
            tokens[int(token['index'])] = {
                'word': token['word'],
                'lemma': token['lemma'],
                'pos': token['pos'],
                'ner': token['ner']
            }
        return tokens

if __name__ == '__main__':
    sNLP = StanfordNLP()
    text = 'John likes apple. Mary Likes Him'

    s=sNLP.relations(text)
    print(s)
    print("OpenIE:", sNLP.openie(text))
    ```

A: Stanford CoreNLP (Java code base) provides access to OpenIE and relation extraction.
You can start a server (Java) and access it in Python.  You can get back results in JSON.
There are detailed instructions about using the server here:
https://stanfordnlp.github.io/stanfordnlp/corenlp_client.html


text:
Q: Rename webpack/gatsby chunkmapping strings When building our production app in Gatsby, I see something like this:
window.___chunkMapping={
  "app":[],
  "component---src-templates-page-tsx":[],
  "component---src-templates-pages-newsletter-tsx":[]
}

Is it possible to hash these paths instead of printing them out? We don't want to expose too much from what is happening in the back.
I tried setting these configs in webpack:
output: {
  filename: `[chunkhash:2][contenthash:5].js`,
  chunkFilename: `[chunkhash:2][contenthash:5].js`,
},

And it successfully hashes .js files but not the template paths.

A: I upvoted this question when I first saw it, I think it's definitely should be done in production build.
Unfortunately, componentChunkName (the template path in question) is generated by Gatsby in createPage & not handled by webpack.
The code that generates componentChunkName is over here: github
I tried to modify the code as follow:
    const { kebabCase } = require(`lodash`)
    const path = require(`path`)
+   const uuidv5 = require(`uuid/v5`)
    const { store } = require(`../redux`)

    const generateComponentChunkName = componentPath => {
      const program = store.getState().program
      let directory = `/`
      if (program && program.directory) {
        directory = program.directory
      }
      const name = path.relative(directory, componentPath)

-     return `component---${kebabCase(name)}`
+     return process.env.NODE_ENV === `production`
+       ? `component---${uuidv5(name, uuidv5.URL)}`
+       : `component---${kebabCase(name)}`
    }

    exports.generateComponentChunkName = generateComponentChunkName

This successfully hides all the component names in production build:
app: Array [ "/app-e593b3d93932ed3a0363.js" ]
"component---11d478fe-6a55-579c-becf-625ab1e57cf4": Array [ "/component---11d478fe-6a55-579c-becf-625ab1e57cf4-76c90ae50035c52657a0.js" ]
"component---15c76861-b723-5e0a-823c-b6832aeeb0a0": Array [ "/component---15c76861-b723-5e0a-823c-b6832aeeb0a0-18eb457ba6c147e1b31b.js" ]
...

None of the local unit tests failed, my clicking-around-until-something-breaks test also hasn't yielded any errors. I might submit a PR later today to see if the maintainers have some insights on why this is not a good idea.
Edit: I opened an issue instead: github, you can subscribe to the issue to see how it resolves.


text:
Q: Angular Resolver data prefetching for same route with different route parameters I am trying to grasp a concept about Angular Route Resolvers.
I want to introduce a Resolver which will prefetch the data for let's say products(by given id) before displaying them and their related component. For brevity, I am gonna use the following URL pattern:
products/:id.
I implement the Resolve<T> interface. The thing is, in the resolve method, as stated here: Resolve Interface @ Angular docs we get as parameter ActivatedRouteSnapshot which is like the name states - a snapshot of the URL and its parameters at the stage of the first request. However, how are changes to route parameters(in our case id) reflected if we navigate to the same route but with different id. How the Resolver knows to update it's data property with the new product data without subscribing to any changes in the param data, considering we're using ActivatedRouteSnapshot instead of ActivatedRoute? Am I missing something?


text:
Q: Cannot get Javascript to navigate to a page I have this very simple "page":
<html>
<head>
</head>
<body>Handling...

<script>
var token = location.hash.toString().substring("#access_token=".length, location.hash.indexOf("&"));
var t = "/ri/auth/fbLogin?token=" + encodeURIComponent(token);
console.log(t);
// t is now /ri/auth/fbLogin?token=blablablablablabla
setTimeout(function() {
window.location.href = t;
}, 2000);
</script>

</body></html>

For some reason, the script always redirects to itself first, but without the hash. That version of the script then redirects to the intended URL, but with an empty token.
I've tried window.location = t and window.navigate(t) as well, but no luck there. That timeout is also a failed attempt at getting  it to work.

A: Try putting
var token = location.hash.toString().substring("#access_token=".length, location.hash.indexOf("&"));
var t = "/ri/auth/fbLogin?token=" + encodeURIComponent(token);
Inside of your timeout function.

A: How silly. Turns out the script worked after all, but the page that it navigated to redirected back to the referrer.


text:
Q: BadMethodCallException Method App\Http\Controllers\StoreController::show does not exist I am new too laravel and I'm creating  a blog, specifically the index page where all the blogs will be displayed and when displayed , when a specific blog title is clicked instead of opening the blog post it displays

BadMethodCallException Method
  App\Http\Controllers\StoreController::show does not exist.

Route::group(['middleware' => ['web']], function () {

    Route::get('/','StoreController@index');
    Route::resource('store','StoreController');
    Route::resource('category','CategoryController');
    Route::resource('post','PostController');
    //Route::resource('user','UserController');
    //Route::controller('mail','MailController');

});

Route::group(['middleware' => ['web']], function () {

    Route::get('/','StoreController@index');
    Route::resource('store','StoreController');
    Route::resource('category','CategoryController');
    Route::resource('post','PostController');
    //Route::resource('user','UserController');
    //Route::controller('mail','MailController');

});

A: Post the HTML code that you are using in order to redirect to the blog page. In addition to that, seems like you are not using Laravel routes as you should.

A: Make sure your controller "StoreController" has show method.
https://laravel.com/docs/5.8/controllers#resource-controllers

A: Did you create your StoreController? If you did seems like that your controller is missing show() function, which should handle specific blog show. Did you create it with -r flag, like this:
php artisan make:controller StoreController -r

This will automatically create a resource controller with all necessary methods:

*

*index()

*show()

*create()

*store()

*update()

*delete()

More about resource controllers in official documentation

A: Mine was working well but started throwing errors suddenly.
Create a new controller, copy and paste all the methods from the old controller to the new controller. This solved my problem. Hope it solves yours. For instance my old controller was WebsiteController and renamed to WebController.
Remember to change the controller in the routes too.
Hope someone helps to explain what causes this..


text:
Q: Postgres Server Error 500 I'm using django 1.9,gunicorn,nginx and postgres as database for my website. My site is up and running but when i try to login as admin or user i get server error 500 on webpage and on terminal i get "is the server running on host 139.59.45.246 and accepting tcp/ip connections on port 5432".

I thought there might be a problem in postgres.conf and pg_hba.conf. But there are 2 host all all....one for IPv4 and one for IPv6 in pg_hba.conf.

I can't figure out how to edit pg_hba.conf. Please use above's IP to explain.

One more thing will it solve the problem or i might need to do something else?

Here my settings.py-
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = '^4z+c_2^di81mt7sj@e8c&_b%###############'

DEBUG = False

ALLOWED_HOSTS = ['irenovate.in', '139.59.45.246']

INSTALLED_APPS = [
    # django apps
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # my apps
    'website',
    'accounts',

    # third party apps
    'crispy_forms',
]

MIDDLEWARE_CLASSES = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'irenovate.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, "templates")],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'irenovate.wsgi.application'

# Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': '########',
        'USER': '########',
        'PASSWORD': '........',
        'HOST': '139.59.45.246',
        'PORT': '',
    }
}

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env", "static")

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static_in_project", "our_static"),
)

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env", "media_root")

CRISPY_TEMPLATE_PACK = 'bootstrap3'


text:
Q: Dead lock error in PostgreSQL Ocassionaly, got an error while executing PostgreSQL query:
Caused by: org.postgresql.util.PSQLException: ERROR: deadlock detected
 Detail: Process 6805 waits for ShareLock on transaction 1985349; blocked by process 30535.
Process 30535 waits for ShareLock on transaction 1985351; blocked by process 6805.
 Hint: See server log for query details.
 Where: while inserting index tuple (19357,14) in relation "item_itemid_itemversion_ukey"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270) [postgresql-9.1-901-1.jdbc4.jar:]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998) [postgresql-9.1-901-1.jdbc4.jar:]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) [postgresql-9.1-901-1.jdbc4.jar:]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570) [postgresql-9.1-901-1.jdbc4.jar:]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420) [postgresql-9.1-901-1.jdbc4.jar:]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:366) [postgresql-9.1-901-1.jdbc4.jar:]
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:493)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186) [hibernate-core-4.2.22.Final-redhat-1.jar:4.2.22.Final-redhat-1]
... 99 more

What can be the reason for the error?
Edit
Got more information from the log file:
2018-06-29 11:16:10 UTC:10.120.40.41(54058):iwidgetarchive@iwidgetarchive_migration:[28533]:ERROR: deadlock detected
2018-06-29 11:16:10 UTC:10.120.40.41(54058):iwidgetarchive@iwidgetarchive_migration:[28533]:DETAIL: Process 28533 waits for ShareLock on transaction 1997995; blocked by process 12716.
Process 12716 waits for ShareLock on transaction 1997994; blocked by process 28533.
Process 28533: insert into item (description, itemid, itemversion, title, id) values ($1, $2, $3, $4, $5)
Process 12716: insert into item (description, itemid, itemversion, title, id) values ($1, $2, $3, $4, $5)
2018-06-29 11:16:10 UTC:10.120.40.41(54058):iwidgetarchive@iwidgetarchive_migration:[28533]:HINT: See server log for query details.
2018-06-29 11:16:10 UTC:10.120.40.41(54058):iwidgetarchive@iwidgetarchive_migration:[28533]:CONTEXT: while inserting index tuple (30446,16) in relation "item_itemid_itemversion_ukey"
2018-06-29 11:16:10 UTC:10.120.40.41(54058):iwidgetarchive@iwidgetarchive_migration:[28533]:STATEMENT: insert into item (description, itemid, itemversion, title, id) values ($1, $2, $3, $4, $5)

Two different Java threads are trying to insert values in the same table as the same time.
The question is how to avoid deadlocks in the database for concurrent insertion. DB: Postgres 9.6


text:
Q: How to declare a variable is from the enclosing scope? How do I make code like the following work? I want to reference a variable, for assignment, in the enclosing function scope.
def outer():
    x = 0

    def inner():
        x += 1

    inner()

The code as written gives an UnboundLocalError. I understand why I get this error, I just don't know how I indicate that x comes from the wrapping scope.

A: You cannot do what you ask in a clean way. There is nothing analagous to the global statement that can help you. You'll want to code it like this:
def outer():
    x = 0

    def inner(x):
        return x + 1

    x = inner(x)

This has the added advantage of making it explicitly clear as to how data passes into, and out of, the function.
Perhaps you will need to replace x with an object whose state can be mutated.

A: You can do:
def outer():
    x = [0]

    def inner():
        x[0] += 1

    inner()

You can't rebind a non-local, but you can mutate it.


text:
Q: I am trying to install dependencies but it tries to remove games and programs I am trying to install dependencies but it says packages were added automatically installed and are no longer required but the packages are games and programs
this is what the terminal says
The following packages were automatically installed and are no longer required:
  assaultcube-data cmake-data gir1.2-gdesktopenums-3.0 gir1.2-gnomedesktop-3.0
  libcec4 libcrossguid0 libfstrcmp0 libjsoncpp1 libllvm3.9 libmicrohttpd12
  libp8-platform2 libpcrecpp0v5 librhash0 libshairplay0 libtfm1 libuv1
  libwxgtk3.0-gtk3-0v5 python-bluez python-cryptodome python-wxgtk3.0
  python-wxversion python3-distro python3-evdev
Use 'sudo apt autoremove' to remove them.Suggested packages:
  gvfs:i386
Recommended packages:
  libgail-common:i386
The following packages will be REMOVED:
  assaultcube clamav-daemon clamav-freshclam cmake curl kodi kodi-x11
  libclamav9 libcurl4 lutris playonlinux steam-launcher


text:
Q: Sharepoint 2013 search service imsqueryinternal endpoint not found Search in Sharepoint 2013 gives
Search has encountered a problem that prevents results from being returned. If the issue persists, please contact your administrator.
The Search Operational Log shows
w3wp.exe: Query processing component 'net.tcp://server/06CE4A/QueryProcessingComponent1/ImsQueryInternal' changes its status to 'Failed'.
Same errors are shown in the ULS logs.
What has been tried (several times)

*

*Resetting the index

*Recreating QPC

*Recreating complete search service

*Clearing cache

*Restarting search service and host controller

*Restarting IIS

*Restarting Server

*Running PSConfig

*Running Configuration Wizard.

*Banging head on the wall as well as hitting the server ;)

Any help would be appreciated, thanks in advance
Imran

A: We had a similar issue that we resolved by looking at the firewall of the Search Server.  We turned on dropped packet logging and noticed that every time one of our front end servers performed a search, packets were dropped from port 808.  We enabled incoming TCP on port 808 on the search server and that resolved our issue.


text:
Q: Analysis Services stored procedure performance I'm writing a stored procedure in .NET to do some complex calculations that can't be written easily in pure MDX. The first problem I'm having is how to retrieve a set of data in a tabular form to pass to my calculation.
My code so far is written below. I would have thought that after we retrieve our value at position **1, we would have all the data in memory to interact with. However, it seems that at position **2, a Query Subcube is issued to the storage engine for each and every day in our range. This is devastating to performance.
Is there something I'm doing wrong? Is there another method I can call to evaluate the set all at once?
// First get the date range that we'd like to calculate over.
// (These values are constant here for example only)
DateTime date = new DateTime(2012, 4, 1);
int dateFrom = KeyFromDate(date.AddDays(-360));
int dateTo = KeyFromDate(date);

string dateRange = string.Format(
  "[Date].[Date].&[{0}]:[Date].[Date].&[{1}]",
  dateFrom,
  dateTo
);

Expression expression = new Expression(dateRange + "*[Measures].[My Measure]");
MDXValue value = expression.CalculateMdxObject(null); // ***1

foreach (var tuple in value.ToSet().Tuples)
{
  MDXValue tupleValue = MDXValue.FromTuple(tuple).ToInt32(); // ***2
}

A: Run SQL Profiler, connect to analysis services, on tab "event selection" check "show all events" and select "get data from aggredations", "get data from cache", "query subsube" and "query subcube verbose".
First read this document http://www.microsoft.com/en-us/download/details.aspx?id=17303 - see page 18 - in order to understand how "query subcube verbose" is working.
Then in Visual Studio (where you're debugging your procedure) in debug mode pass through line **1
and see in SQL Profiler what is queried in verbose - what measure group and what attributes.
Then pass through ***2 and see again in SQL Profiler in verbose events what is queried.
I believe that the set of attributes is different, so it may so happen that in **1  it uses some aggregate, and in place **2 when "value" is present in the tuple - there are no aggregate for this set of attributes, so instead of making "read from aggregations" once it makes "read from measure group cache" several times.
I can't tell more exactly cause I don't have your cube. Try to find this out by "query subcube verbose" events, and try to use BIDS Helper to create necessary aggregations manually (with specific set of attributes) - it may help.


text:
Q: Make input box slide in from left or right here is my code: https://jsfiddle.net/hsf4yo5t/
HTML code:
<input type="button" id="my-button" value="Show text input">
<input type="text" id="my-input">

CSS code:
#my-input {
  visibility: hidden;
}

Javascript code:
document.getElementById('my-button').onclick = function() {
    document.getElementById('my-input').style.visibility = 'visible';
}

when I click the button, it shows. but how can i make it slide out using javascript OR jquery?

A: If you don't mind wrapping the input in an element, you can transition translateX() to make it slide out.

document.getElementById('my-button').onclick = function() {
 document.getElementById('my-input').classList.toggle('show');
}
span {
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

#my-input {
  transform: translateX(-100%);
  opacity: 0;
  transition: opacity .25s, transform .25s;
}

#my-input.show {
  transform: translateX(0);
  opacity: 1;
}
<input type="button" id="my-button" value="Show text input">
<input type="text" id="my-input">

You can also transition scaleX() without a wrapping element around the input, but it isn't really sliding as much as contracting/expanding from the left side.

document.getElementById('my-button').onclick = function() {
 document.getElementById('my-input').classList.toggle('show');
}
#my-input {
  transform: scaleX(0);
  opacity: 0;
  transition: opacity .25s, transform .25s;
  transform-origin: 0 0;
}

#my-input.show {
  transform: scaleX(1);
  opacity: 1;
}
<input type="button" id="my-button" value="Show text input">
<input type="text" id="my-input">

A: Here's a jQuery solution: It animates the opacity and the left parameter, which initially is set to a (negative) value so that the input field is off the screen (you have to use position: relative to make that possible):

$("#my-button").click(function() {
  $("#my-input").animate({
    'left': '0px',
    'opacity': '1'
  });
});
#my-input {
  position: relative;
  left: -300px;
  opacity: 0;
}

<input type="button" id="my-button" value="Show text input">
<input type="text" id="my-input">

Right to left would be:

$("#my-button").click(function() {
  $("#my-input").animate({
    'right': '0px',
    'opacity': '1'
  });
});
#my-input {
  position: relative;
  right: -1600px;
  opacity: 0;
}

body {
  overflow-x: hidden;
}

<input type="button" id="my-button" value="Show text input">
<input type="text" id="my-input">

A: Here's a jQuery option selecting by input. (you can switch back to selecting by class)
The 'squeeze' at the end may be annoying.
fiddle
https://jsfiddle.net/Hastig/etfzt6fq/

$(".buttonNfield input[type='button']").click(function() {
 $(".buttonNfield input[type='text']").css({
   'width': '70%',
    'opacity': '1'
  });
})
.buttonNfield {
  display: flex;
  width: 100%;
}
.buttonNfield input[type="button"] {
  width: 30%;
  margin: 0 10px 0 0;
  cursor: pointer;
}
.buttonNfield input[type="text"] {
  width: 0%;
  overflow: hidden;
  margin: 0;
  padding: 5px;
  transition: width 1.3s ease;
  opacity: 0;
}

  <input type="button" value="Show text input">
  <input type="text" placeholder="type here">

Centered
This one expands from center. The submit button appears when the last empty field is focused on.
fiddle
https://jsfiddle.net/Hastig/rjab85rc/

$(".buttonNfield input[type='button']").click(function() {
 var pseudoThis = $(this).closest('.buttonNfield').find("input[type='text']");
 $(pseudoThis).show( 100, function() {
   $(pseudoThis).css({
      'display': 'flex',
      'width': '70%',
      'marginLeft': '10px',
      'opacity': '1'
    });
  });
  $(pseudoThis).focus();
})

var totalFields = 0;
var remainingFields;

$(function() {
  $("input[type='text']").each(function() {
    totalFields = totalFields + 1;
  })
})

$("input[type='button']").on("click", function() {
 // fly in total fields box
})

$("html").on("mouseover", function() {
 remainingFields = totalFields;
  $("input[type='text']").each(function() {
    if ($(this).val() != '') {
      remainingFields = remainingFields - 1;
    }
  })
  if (remainingFields > 0) {
   $('.remaining').html(remainingFields + ' ' + 'fields remaining');
  } else {
   $('.remaining').css('opacity', '0');
    // fly in submit button
    $("input[type='submit']").css({
     'marginLeft': '0',
      'marginRight': '0'
      });
  }
})

$("input[type='text']").on("focus", function() {
 if (remainingFields < 2) {
    $("input[type='submit']").css({
     'marginLeft': '0',
      'marginRight': '0'
    });
  }
})
body {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 20px;
  overflow: hidden;
  box-sizing: border-box;
}
form {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  padding-top: 50px;
}
.buttonNfield {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 15px 0;
}
.buttonNfield input[type="button"] {
  width: 30%;
  cursor: pointer;
}
.buttonNfield input[type="text"] {
  display: none;
  width: 0%;
  overflow: hidden;
  transition: width 0.5s ease;
  opacity: 1;
  box-sizing: border-box;
}

.submitNinfo {
  display: flex;
  justify-content: center;
  width: 100%;
}
input[type="submit"] {
  margin: 5px -100% 0px 100%;
  padding: 10px;
  font-size: 20px;
  color: hsla(0, 0%, 70%, 1);
  background-color: hsla(0, 0%, 20%, 1);
  border-style: solid;
  border-color: black;
  border-width: 1px;
  border-radius: 3px;
  cursor: pointer;
  transition: margin 0.6s, background 0.2s;
}
input[type="submit"]:hover {
  background-color: hsla(0, 0%, 0%, 1);
}
.remaining {
  position: fixed;
  top: 10px;
  left: 50%; transform: translateX(-50%);
  display: flex;
  justify-content: center;
  width: 100%;
  transition: opacity 1s;
  font-size: 14px;
}

<form>

    <input type="button" value="Enter First Name">
    <input type="text" placeholder="type here">

    <input type="button" value="Enter Last Name">
    <input type="text" placeholder="type here">

    <input type="submit" value="submit form">

</form>


text:
Q: stress testing a QOS switch I need to test a network Switch that has QOS capabilities. I need to simulate a large network (preferably up to or exceeding 100 devices), and I need to do it as a live test. My requirements are:
•    create around 100, if not more, TCP flows from a test internal network to an external test network.
•    The device I am testing will sit between the internal environment and the external environment.
•    The device I am testing has quality of service capabilities with which I need to test as if it were in a live environment.
What I have tried:
•    used tcpreplay to replay a pcap file through the switch. The problem with this is it only simulates the network traffic, it does not respond to QOS the way normal live connections do.
•    I have used iperf as a client and server to send data through the switch, however I am limited by the number of streams that I can create due to the limitations of the hardware/software, combination (I only have 2 servers either side of the switch).
What I would like:
•    to simulate a live large network sending TCP traffic from an internal device through the switch (so I can test QOS with up to and over 100 streams at a time) through an external device.
•    I would rather not have to populate the test network with a large number of PCs on either side of the switch to simulate the traffic.
Any ideas?


text:
Q: Request and response format for IBM cloud storage object S3 API I need information related request and response format for IBM cloud storage object S3 API.I have been searching through API doc and come across that it is only supporting XML response format.Question is, does it support Json format response? if yes,it would be really grateful provide details about objects and supporting APIs for which I can get Json response.

A: The current Amazon S3 API is dated 2006-03-01. It encapsulates the metadata in XML documents, not in JSON. The IBM Cloud Object Storage service offers a common subset of the S3 API. To be compatible, that API needs to follow the Amazon S3 API which is XML-based.
The answer to your question is that there is no JSON support, only XML.

A: Henrik is correct in that the S3 API is XML-based, but depending on the SDK or tool used it's possible to get JSON, text, or table responses.
For example, using the AWS CLI you can set the response type using aws configure, and then the output will be formatted appropriately.
JSON:
$ aws s3api --endpoint-url=https://{endpoint} s3api list-buckets
{
    "Owner": {
        "DisplayName": "{access-key}",
        "ID": "{access-key}"
    },
    "Buckets": [
        {
            "CreationDate": "2016-11-09T16:43:29.957Z",
            "Name": "bucket-1"
        },
        {
            "CreationDate": "2017-06-13T23:47:18.169Z",
            "Name": "bucket-2"
        },
        {
            "CreationDate": "2017-05-01T02:36:34.385Z",
            "Name": "bucket-3"
        },
    ]
}

Text:
$ aws s3api --endpoint-url=https://{endpoint} s3api list-buckets
BUCKETS 2016-11-09T16:43:29.957Z    bucket-1
BUCKETS 2017-06-13T23:47:18.169Z    bucket-2
BUCKETS 2017-05-01T02:36:34.385Z    bucket-3
OWNER   {access-key}    {access-key}

Table:
$ aws s3api --endpoint-url=https://{endpoint} s3api list-buckets
----------------------------------------------------------------------------
|                                ListBuckets                               |
+--------------------------------------------------------------------------+
||                                 Buckets                                ||
|+----------------------------------+-------------------------------------+|
||           CreationDate           |                Name                 ||
|+----------------------------------+-------------------------------------+|
||  2016-11-09T16:43:29.957Z        |  bucket-1                           ||
||  2017-06-13T23:47:18.169Z        |  bucket-2                           ||
||  2017-05-01T02:36:34.385Z        |  bucket-3                           ||
|+----------------------------------+-------------------------------------+|
||                                  Owner                                 ||
|+-----------------------------------+------------------------------------+|
||            DisplayName            |                ID                  ||
|+-----------------------------------+------------------------------------+|
||            {access-key}           |           {access-key}             ||
|+-----------------------------------+------------------------------------+|


text:
Q: Check if there is a value from a string in the array, if not, then add it So, I have a lot of string that look like:
!,3,1,10,27,13,078,43,05,31,307,48,16,24,042,43,02,10,267,43
!,3,2,10,26,03,031,36,07,75,215,51,09,57,121,53,30,40,234,50
!,3,3,10,23,29,117,46,04,36,114,46
!,3,1,10,27,13,078,43,05,31,307,48,16,24,042,43,02,10,267,43
!,3,2,10,26,03,031,36,07,75,215,51,09,57,121,53,30,40,234,50
!,3,3,10,23,29,117,46,04,36,114,46

I need to print some values out of the line after a certain number of commas. But only if they appear for the first time. It is known that the number of values is less than 100. I have coped with the part of the code that outputs values from the line, but I cannot cope with the second part of the task. I created an array of 100 items and searched with the command std::find, and added a value if it was absent in the array, but the program output is wrong. Also I need to solve this task without using vectors :/
I've tried it this way:
#include <iostream>
#include <string>
#include <fstream>

int main() {
    int k;
    std::string line;
    std::ifstream logs_("C:/Users/Ivan/Desktop/gpgga.txt");
    std::ofstream pout("C:/Users/Ivan/Desktop/outLOG.txt");

    int num = 100;
    int* Memory = new int[num];
    bool ExitFlag;

    if (logs_.is_open()) {
        while (getline(logs_, line)) {
            k = 0;
                for (size_t i = 0, N = 4; i < line.size(); i++) {
                    if (line[i] == ',') k++;
                    if (k == N) {
                        N += 4;
                        for (int f = 0; f < num; f++) {
                            if (Memory[f] != stoi(line.substr(i + 1, 2))) {
                                ExitFlag = false;
                                Memory[f] = stoi(line.substr(i + 1, 2));
                            }
                        }
                        if (ExitFlag == false) {
                            pout << "Satellite name: " << line.substr(i + 1, 2) << std::endl;
                        }
                    }
                }

            logs_.close();
            std::cout << "Success" << std::endl;
        }
    }
    else std::cout << "File is not open" << '\n';
    pout.close();
    return 0;
}

But its output nothing
Here is another try:
#include <iostream>
#include <string>
#include <fstream>

int main() {
    int k;
    std::string line;
    std::ifstream logs_("C:/Users/Ivan/Desktop/gpgga.txt");
    std::ofstream pout("C:/Users/Ivan/Desktop/outLOG.txt");

    int array[100];
    int size = sizeof(array) / sizeof(array[0]);

    if (logs_.is_open()) {
        while (getline(logs_, line)) {
            k = 0;
            for (size_t i = 0, N = 4; i < line.size(); i++) {
                if (line[i] == ',') k++;
                if (k == N) {
                    for (int j = 0; j < size; j++) {
                        int* foo = std::find(std::begin(array), std::end(array), stoi(line.substr(i + 1, 2)));
                        if (foo = std::end(array)) {
                            pout << "Number: " << line.substr(i + 1, 2) << "  ";
                            array[j] = stoi(line.substr(i + 1, 2));
                        }
                    }
                    N += 4;
                }
            }
            logs_.close();
            std::cout << "Success" << std::endl;
        }
    }
    else std::cout << "File is not open" << '\n';
    pout.close();

    return 0;
}

In theory program must output 27, 05, 16, 02, 26, 07, 09, 30, 23, 04
Current output: Number: 27  Number: 27  Number: 27  Number: 27  Number: 27 ... 100 times
Number: 05  Number: 05  Number: 05  Number: 05  Number: 05  Number: 05  Number: 05 ...100 times
and they are repeated

A: Thanks to user Slava std::unordered_set worked
#include <unordered_set>
...
    std::unordered_set<int> S;
    int t;
...
for (size_t i = 0, N = 4; i < line.size(); i++) {
                            if (line[i] == ',') k++;
                            if (k == N) {
                                t = stoi(line.substr(i + 1, 2));
                                if (S.find(t) == S.end()) {
                                    pout << "Number " << t << "  " << std::endl;
                                    S.insert(t);
                                }


text:
Q: Extracting bbcode quote using java and Android but not extracting the content within the quote tag I am going to extract the bbcode with the quotes but to no avail when the actual output is coming.
I would like to implement the bbcode parsing module for extracting the quotes as desired output . The number of quotes shall be a recursive method or some else..
INput :

Testing [quote]http://www.yourube.com?watch?v=asasdsadsa [url] aisa [/url] [/quote] Testing

   Desired Output

Testing
    http://www.yourube.com?watch?v=asasdsadsa [url] aisa [/url]
     aisa
Testing
Actual Output:

http://www.yourube.com?watch?v=asasdsadsa [url] aisa [/url]
http://www.yourube.com?watch?v=asasdsadsa  aisa

The below is my code
        String s = "[quote]http://www.yourube.com?watch?v=asasdsadsa [url] aisa [/url][/quote]";
        String t = bbcode(s);
        System.out.println(t);
        String u = bbcode2(t);
        System.out.println(u);

 public static String bbcode(String text) {
        String html = text;

        HashMap<String,String> bbMap = new HashMap<String , String>();

        bbMap.put("\\[quote\\](.+?)\\[/quote\\]", "$1");

        for (Map.Entry entry: bbMap.entrySet()) {
            html = html.replaceAll(entry.getKey().toString(), entry.getValue().toString());
        }

        return html;
    }

       public static String bbcode2(String text) {
        String html = text;

        HashMap<String,String> bbMap = new HashMap<String , String>();

        bbMap.put("\\[quote\\](.+?)\\[/quote\\]", "$1");

        bbMap.put("\\[url\\](.+?)\\[/url\\]", "$1");

        for (Map.Entry entry: bbMap.entrySet()) {
            html = html.replaceAll(entry.getKey().toString(), entry.getValue().toString());
        }

        return html;
    }

A: This is the general Java regex to match pairs of BB Code tags:
\\[([^\\]]+)\\](.+?)\\[/\\1\\]

This will grab top level matches e.g. in [a][b] hi [/b] hello [/a][c] yo [/c], group 2 will match [b] hi [\b] hello and yo. (Demonstrated here)

Any regex solution is in my opinion going to require you to use recursion (outside of the regex) to find all matches. You're going to have to find all top level matches (add them to some array), then recursively use the same regex on each of the matches (adding them all to the same result array) until eventually no matches more matches can be found.
In that example you can see you'd need to then run the regex again on [b] hi [\b] hello to return the content of the [b] hi [/b] which is hi.
For example, for an input of :
[A] outer [B] [C] last one left [/C] middle [/B] [/A]  [A] out [B] in [/B] [/A]

First you, run the regex against that string and look at the group 2 matches:
outer [B] [C] last one left [/C] middle [/B]
out [B] in [/B]

Add those to the result array, then you run the regex against those matches and get:
 [C] last one left [/C] middle
 in

Add those to the result array, and again run it against those matches and get:
 last one left
 [no matches]

And finally you'd run it against last one left and get no more matches, so you're done.
Raju, if you're unfamiliar with recursion it would be very beneficial for you to stop reading at this point and attempt to solve the problem yourself - come back if you give up. That said...

A Java solution to this problem is:
public static void getAllMatches(Pattern p, String in, List<String> out) {
  Matcher m = p.matcher(in);           // get matches in input
  while (m.find()) {                   // for each match
    out.add(m.group(2));               // add match to result array
    getAllMatches(p, m.group(2), out); // call function again with match as input
  }
}

And here is a working example on ideone
ideone output:
[A]outer[B][C]last one left[/C]middle[/B][/A] [A]out[B]in[/B][/A]
-----------
- outer[B][C]last one left[/C]middle[/B]
- [C]last one left[/C]middle
- last one left
- out[B]in[/B]
- in

[quote]http://www.yourube.com?watch?v=asasdsadsa [url]aisa[/url] [/quote]
-----------
- http://www.yourube.com?watch?v=asasdsadsa [url]aisa[/url]
- aisa

A: Not neatest way, but a non reg-ex way...
int lastIndex = 0;
String startString = "[quote]";
String endString = "[/quote]";
int start;
int end;
while (lastIndex != -1) {
   start = string.indexOf(startString, lastIndex);
   lastIndex = start;
   if (lastIndex == -1) {
      break;
   }
   end   = string.indexOf(endString, lastIndex);
   lastIndex = end;
   if (lastIndex == -1) {
      break;
   }
   System.out.println(string.substring(
       start  + startString.length,
       end + 1));
}


text:
Q: How come my regex grouping is not grouping correctly? Example of a line in the file: "CIS 14A Visual Basic .NET Programming I x   x   x   x"
I'm trying to group lines in a file into three groups: group(0) should be the course number (14A), group(1) should be the topic (Visual Basic .NET Programming I), and group(2) should be the quarters the course is available in. However, when I tested the code, group(0) matched the whole line, group(1) was the course #, group(2) was empty..., and group(3) was a combination of the topic and quarters available. I can't find what's wrong with it because each set of parenthesis creates a group but all the groups are in the wrong order and "CIS" which I have no included in any parenthesis was included in group(0) for some reason. I'm new to regex so any advice on how to fix my code would be much appreciated.
    with open(filename) as infile:
        for line in infile:
            self._match = (re.search('^CIS\s(\d*\w*)(\w*)\s?[^x]*(.*)$', line, re.I))
            self._numb = self._match.group(0).strip()
            self._name = self._match.group(1).strip()
            self._quarter=self._match.group(2).strip().split('x')

A: Note there are always as many .group()s as there are capturing groups + 1 as the zeroth group is reserved for the entire match.
The regex you may use is
^CIS\s+([0-9A-Z]+)\s(.*?)\s(x\s.*)

See the regex demo
See Python snippet:
with open(filename, 'r') as infile:
    for line in infile:
        self._match = re.search(r'^CIS\s+([0-9A-Z]+)\s(.*?)\s(x\s.*)', line, re.I)
        if self._match:
            self._numb = self._match.group(1).strip()
            self._name = self._match.group(2).strip()
            self._quarter=self._match.group(3).strip().split('x')

Regex details

*

*^ - Start of string

*CIS - a literal substring

*\s+ - 1+ whitespaces

*([0-9A-Z]+) - Group 1: one or more digits or uppercase letters

*\s - a whitespace

*(.*?) - Group 2: any 0 or more chars other than line break chars as few as possible

*\s - whitespace

*(x\s.*) - Group 3: x, whitespace and any 0 or more chars other than line break chars as many as possible.

Also, check the regex graph:


text:
Q: HTML image tag problems

<!DOCTYPE html>

  <meta charset="utf-8">
  <title>How to make a basic website</title>

    <hgroup>

Trying to replicate newspage format.

Shouldn't be hard if persistent in effort.

    </hgroup>

Home

About

Contact

You can put news in here.

Introduction

News is usually propoganda to get the commonfolk distracted with false information unless they dive deeply.

This is a separate article.

Introduction

Cybersecurity is a field that all legitamate companies should invest in. Unfortunately, many modern technologies tend
to focus more on the appealing side of the audience than the security of their information. Hence, multibillion-dollar
companies have been hacked by mere young people who have just started to learn programming within the past decade.

I am not surprised by the carelessness of these multibillion dollar companies. They have secretly been selling our (the average customer's) data
to scammers and marketing agencies for a quick buck. Some have even been caught sending information of citizens to foreign (to a country) governments.
This should be a crime and illegal, because it is breaching basic human rights. However, they are able to get away with it, since the thirst of this generation for technology never seems to quench.
Just by clicking "Accept" for the Terms and Conditions as well as the Privacy Policies, these companies are able to do illegal business and make billions of it.
It is not fair to the citizens, especially to the minors using their parents' devices without a clue of what they are getting into. Such practices should be deemed illegal
by federal law of all countries. There are many ways that companies can make quick money, and they do not have to compromise the safety of innocent people for that.
One such way is surveys. Investing in surveys on a company's own website is a way to get market research done. However, what researchers fail to realize is that the average consumer would
not care to chip in without an incentive.

Copyright &copy 2021-2022 By me

Home

About

Contact

So basically, I've learned html before with no issues a few years ago and decided to go on to different programming languages such as C. I had been working hard on programming with minimal results within the past year, until I decided to take on web development again as a better start.
My problem is, sometimes my code does not work, and according to countless searches and videos, as well as many hours spent debugging, sometimes my code is correct but does not work.
I had learned html in depth years ago during self study. However, the file had gotten corrupted due to a virus, and all my hard work had gone to drain. So I had decided that I would try again when I am more advanced and have something noteworthy to publish a site for. I feel that although I am not much better than back then, I should focus on web development right now (if not C).
Here is an example of what I am facing (right now):

What blows my mind is that even W3C Validator has accepted my code, however, the browsers (Internet Explorer, Edge, Chrome) refuse to display my images (using notepad text editor on Windows 10). Even more ironic is the fact that I was successfully able to display multiple images on my (unofficial) site years ago.
Is there something I have forgotten? I mean, I've been watching videos of how to solve it for over two hours now.

A: If your image file Finance.png is in one of the sub-folder to the folder where your html file is present, then you need to provide the folder path in the src attribute for the img tag.  If your image file is in images folder, then make the img tag like so :

A: *

*One of the common issue may be the incorrect path of image in the src of  .

*

*Like you can save image in the same directory and access using

*

*Also you can save the image in a folder named images in the same directory and then access like this

*Secondly, check whether the type of the file is correct or not , if its jpeg or in some other format.

*Thirdly, check that  tag is properly closed,

A: You have to give the full path for the image like,

If you have your image in images folder.


text:
Q: ERP Operation not found error in WSO2EI DSS I have created a REST - data service in WSO2EI an tried accessing through postman client tool, but I am getting this error.
End Point: http://LAPTOP-T4F1HOAM:8280/services/getStudRecNo?user_id=test8
The endpoint reference (EPR) for the Operation not found is /services/getStudRecNo?user_id=test8 and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.
Can anyone please help.
Thanks
dss code.
<data name="getStudRecNo" transports="http https local">
   <description>get student unique id</description>
   <config enableOData="false" id="mySchoolDB">
      <property name="driverClassName">org.postgresql.Driver</property>
      <property name="url">jdbc:postgresql://localhost:5432/mySchool</property>
      <property name="username">admin</property>
      <property name="password">admin</property>
   </config>
   <query id="GetStudentRecordNo" useConfig="mySchoolDB">
      <sql>SELECT getstudentid FROM getstudentid(?)</sql>
      <result outputType="json">{"entries": {"entry": [ { "getstudentid": "$getstudentid"} ]}}</result>
      <param defaultValue="TEST" name="user_id" sqlType="STRING"/>
   </query>
   <operation name="getsrno">
      <call-query href="GetStudentRecordNo">
         <with-param name="user_id" query-param="user_id"/>
      </call-query>
   </operation>
   <resource method="GET" path="getsrno">
      <call-query href="GetStudentRecordNo">
         <with-param name="user_id" query-param="user_id"/>
      </call-query>
   </resource>
</data>

A: You have to append the resource path ("getsrno" in your case) to the URL. Then the URL would look like,
http://LAPTOP-T4F1HOAM:8280/services/getStudRecNo/getsrno?user_id=test8
Further, since the resource's HTTP method is GET, the request should also be a GET request.


text:
Q: mongoose findByIdAndUpdate instead of save I'm trying to update the value of an element inside an array of my document.
The common way of update via save works as expected, but trying to use an static method, like findByIdAndUpdate doesn't work as expected.
Here bellow I paste the code I'm currently using:
var UserSchema = new mongoose.Schema({
  nickname: { type: String, trim: true},
  username: { type: String, trim: true },
  notifications: [{
    a: {
      _id: { type: mongoose.Schema.Types.ObjectId, ref: 'x' },
      x: { type: mongoose.Schema.Types.ObjectId, ref: 'y' }
    },
    b: {
      _id: { type: mongoose.Schema.Types.ObjectId, ref: 'y' },
      x: { type: mongoose.Schema.Types.ObjectId, ref: 'y' }
    },
    read: { type: Number, default: 0 }, // 0 - Unread, 1 - read
    ts: { type: Date, default: Date.now }
  }]
}, { timestamps: { createdAt: 'created_at' } });

// This works as expected
UserSchema.statics.rNSave = function (user_id, notification_id) {
  var vm = this;
  return new Promise(function (resolve, reject) {
    vm.findById(user_id, function (err, data) {
      if (err) {
        reject(new Error(err));
      } else {
        var notifications = data.notifications, i = 0;
        for (i; i < notifications.length; i += 1) {
          if (data.notifications[i]._id.toString() === notification_id) {
            data.notifications[i].read = 1;
            data.save({ validateBeforeSave: false }, function (err, updatedData) {
              if (err) {
                reject(new Error(err));
              } else {
                resolve();
              }
            });
            return;
          }
        }
        return reject('Error');
      }
    });
  });
};

// This one is not working
UserSchema.statics.rNStatic = function (user_id, notification_id) {
  return this.findByIdAndUpdate({ _id: user_id, notifications: { $elemMatch: { _id: notification_id }}}, { $set: { 'notifications.$.read': 1 }}).exec();
};

Any help with this?
Thanks in advice.


text:
Q: Google places API not returning address components My program is trying to determine the City, state, and country based on some text, for example "New york yankee stadium" I want to get New york city, NY, USA. I am using Google places API to do this. According to the documentations, the API should return a list of address component https://developers.google.com/places/web-service/details. However, right now its only returning formatted address "1 E 161st St, Bronx, NY 10451, United States".
here is my web service url
https://maps.googleapis.com/maps/api/place/textsearch/json?key=MY_KEY&query=new%20york%20yankee%20stadium
Anyone familiar with google places API that can let me know if I am not writting the right query or parameter?
{
   "html_attributions" : [],
   "results" : [
      {
         "formatted_address" : "1 E 161st St, Bronx, NY 10451, United States",
         "geometry" : {
            "location" : {
               "lat" : 40.82964260000001,
               "lng" : -73.9261745
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 40.83279975,
                  "lng" : -73.92236575000001
               },
               "southwest" : {
                  "lat" : 40.82643674999999,
                  "lng" : -73.93052034999999
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "3d78036d61d35f48650bda737226432b57d82511",
         "name" : "Yankee Stadium",
         "opening_hours" : {
            "open_now" : true,
            "weekday_text" : []
         },
         "photos" : [
            {
               "height" : 540,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/101696810905045719819/photos\"\u003eYankee Stadium\u003c/a\u003e"
               ],
               "photo_reference" : "CoQBdwAAAIxmCLrNS_XZ2FcJqVvRVtBUlNYMBVTVKppOWBu7sICj2q70cqJARBoJlTcZpydbMTzURKWWMVJhYpVCqsnia5pjmDhjvjsTirrEnAc6gvmRYKuUwgewB9Re--FulXzXZ5DY3P9fkwIwuc4U9BJVbqHD5O-N6SbbHcqn4XHUj_OdEhCoNPZ3kiNJhxOCGdYG5O4DGhTqVfUjdq7JzasqYATvQxkL1-H3xg",
               "width" : 1242
            }
         ],
         "place_id" : "ChIJcWnnWiz0wokRCB6aVdnDQEk",
         "rating" : 4.4,
         "reference" : "CmRRAAAA5dHiw1YmLxW60_jITBZjMiUs48L4aVUqlPnPDpN_ySa7rw8kPp04WWk0qf8mG-kkMFSNzh39lP0YwfynW54tLcY4s_EYbAPvNWTMe6wXHm_FJiVbI0Lfenyxz4yOTzunEhDgI64EWoXkQe9k45y6qP3-GhSVSdCMPPZA3joFbnYGV-bqo2e0lw",
         "types" : [ "stadium", "point_of_interest", "establishment" ]
      }
   ],
   "status" : "OK"
}

A: Its a two step process, first search and get the place_id from google places search service,
use the returned place_id and pass it with another call to receive the individual address components,
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJcWnnWiz0wokRCB6aVdnDQEk&key=
{"html_attributions": [],
"result": {
"address_components": [
{
"long_name": "1",
"short_name": "1",
"types": [
"street_number"
]
},
{
"long_name": "East 161st Street",
"short_name": "E 161st St",
"types": [
"route"
]
},
{
"long_name": "Concourse",
"short_name": "Concourse",
"types": [
"neighborhood",
"political"
]
},
{
"long_name": "Bronx",
"short_name": "Bronx",
"types": [
"sublocality_level_1",
"sublocality",
"political"
]
},
{
"long_name": "Bronx County",
"short_name": "Bronx County",
"types": [
"administrative_area_level_2",
"political"
]
},


text:
Q: line break within cell for huxtable table I recently started using the huxtable R package for tables and I'm really impressed with it. One thing I can't seem to figure out, however, is how to get line breaks within a cell. Here's what I've tried
library(tidyverse)
library(huxtable)
cars <- mtcars %>%
  mutate(car = rownames(.),
         car = str_replace(car, " ", "\n")) %>%
  slice(1:5) %>%
  select(car, cyl, hp)

cars

# A tibble: 5 x 3
  car                    cyl    hp
  <chr>                <dbl> <dbl>
1 "Mazda\nRX4"          6.00 110
2 "Mazda\nRX4 Wag"      6.00 110
3 "Datsun\n710"         4.00  93.0
4 "Hornet\n4 Drive"     6.00 110
5 "Hornet\nSportabout"  8.00 175

ht <- as_hux(cars, add_colnames = TRUE)
escape_contents(ht) <- TRUE
ht

But this ends up without the line break, as in the screenshot below

The escape_contents part doesn't seem to make a difference.
I'm not sure if what I want is possible, but I know it is in other packages (e.g., DT::datatable). I'd really like to use huxtable, if possible, however, because I like the design and flexibility of the package.
Any thoughts would be great.
EDIT: I should have specified I'm hoping to get this to work for PDF.

A: According to Escaping HTML or LaTeX,
You should use escape_contents(ht) <- FALSE and use
 tag instead of \n
library(tidyverse)
library(huxtable)
cars <- mtcars %>% mutate(car = rownames(.),
                          car = str_replace(car, " ", "
")) %>%
                   slice(1:5) %>% select(car, cyl, hp)

 ht <- as_hux(cars, add_colnames = TRUE)
 escape_contents(ht) <- FALSE
 ht

note that the output is a Rmarkdown document and thanks for the package information. it looks good. following is the output of mine

A: Try this, which minimizes the amount of backslashes:
library(tidyverse)
library(huxtable)

cars <- mtcars %>% mutate(car = rownames(.))
cars$car <- str_replace(cars$car, " ", "\\\\newline ")
cars %>%
      as_hux(add_colnames = TRUE) %>%
      set_wrap(TRUE) %>%
      set_escape_contents(everywhere, "car",  FALSE) %>%
      quick_pdf()

The set_wrap() call is necessary for LaTeX tables to accept newlines, I believe.
If you want to escape different parts of the cells containing newlines, you can do that manually, e.g. with xtable::sanitize().

A: Okay, so combining insights from this LaTeX StackExchange post and this classic XKCD got me this:
library(tidyverse)
library(huxtable)
cars <- mtcars %>%
  mutate(car = rownames(.),
         car = str_replace(car, "(\\S*)\\s(.*)",
                           "\\\\vtop{\\\\hbox{\\\\strut \\1}\\\\hbox{\\\\strut \\2}}")) %>%
  slice(1:5) %>%
  select(car, cyl, hp)

ht <- as_hux(cars, add_colnames = TRUE) %>%
    set_escape_contents(1:6, 1, FALSE)
theme_article(ht)

which gives the following PDF output:

Of course, you won't need quite as many escapes if you're building your own cells by hand rather than using str_replace.  Note that putting set_escape_contents to FALSE for the cells with line breaks is crucial.


text:
Q: How to split and add a new line delimiter in an xml file (using linux bash) I have the following xml file. I actually made a mistake while I was constructing it. I didn't add a new line after the end of the queries. What command can I use in linux in order to modify it?
</query><query id="...">
        ^ split here. add new line delimiter

</query>
<query id="...">

input
    <queries>
    <query id="LFENT_1_1">
    <name>barack obama</name>
    <docid>LFDOC1</docid>
    <type>person</type>
    </query><query id="LFENT_1_2">
    <name>obama</name>
    <docid>LFDOC1</docid>
    <type>person</type>
    </query><query id="LFENT_1_3">
    <name>american</name>
    <docid>LFDOC1</docid>
    <type>misc</type>
   </query>
   </queries>

output
  <queries>
    <query id="LFENT_1_1">
    <name>barack obama</name>
    <docid>LFDOC1</docid>
    <type>person</type>
    </query>
    <query id="LFENT_1_2">
    <name>obama</name>
    <docid>LFDOC1</docid>
    <type>person</type>
    </query>
    <query id="LFENT_1_3">
    <name>american</name>
    <docid>LFDOC1</docid>
    <type>misc</type>
   </query>
   </queries>

Thank you.

A: give this line a try:
xmllint --format your.xml

A: For just adding the newline it would be like
sed -i -e 's#</query><query#</query>\n<query#' file.xml

But if you want a really nice formatted file I would suggest using
xmllint --format file.xml > newfile.xml

A: If you want a newline after the </query> closing tags, you can use the following sed command:
sed  "s/<\/query>/<\/query>\n/g" input.xml


text:
Q: How might we approach Collatz Conjecture by probabilistic method?
How might we approach Collatz Conjecture by probabilistic method - or similar?

I was thinking along the following lines.  Suppose we select some integer at random. What is the expected value of the number that it converges to?
Am I right in thinking if so much as a single number converges to infinity, this would set the answer to infinity?
Therefore if we can prove the expected value is finite we have proven no sequence ascends infinitely.  If we can prove the expected value is $>1$ there are nontrivial loops and if we can prove the expected value is $1$ we prove the conjecture in full.
We would have to define the lowest integer in some loop as the convergent point, or find some other general definition of the value of a loop.

A: Let $X_n = 1_{n \text{ is even}}$ so that $$f(n) =  \frac{n}{2} X_n+\frac{3n+1}{2}(1-X_n)$$
Clearly it is not true, but you can assume the $X_n$ are independent random variables with $P(X_n=1) =P(X_n=0) =\frac{1}{2}$.
In that case for every $n$, the sequence $Y(k) = Y_n(k) = \underbrace{f \circ \ldots \circ f}_k(n)$ is bounded with probability $1$.

Note if we look instead at $g(n) =  \frac{n}{2} X_n+(3n+1)(1-X_n)$ then the sequence grows without bound almost surely... So independence of the $X_n$ is really far from the truth.

Then you can compute the mean value and the variance of the random variable $Y_n(1),Y_n(2)$ and $Y_n(k)$ as well as $Z_K(n)=\max_{k \le K} Y_n(k)$. You'll get statement such as "with probability $p $, $\frac{Z_K(n)}{n} \le \epsilon$"

A: Up to some details, your intuition is correct. If we define the function $f(n)$ to mean the smallest number that occurs in the Collatz sequence starting from $n$, then the expected value of $f$ being greater than $1$ implies that the Collatz conjecture is false.
The challenge with this is that it is rather complicated to actually compute these expected values. The Collatz conjecture can be thought of as saying something about the relationship between the factors of $n$ and $3n+1$, and we don't know so much about this.

A: The convergence of the Collatz conjecture has already been proved probabilistically. Please see: https://doi.org/10.1155/2019/6814378 .
The approach is really simple and straight forward.
The new approach towards probabilistic proof of the convergence of the Collatz conjecture is described via identifying a sequential correlation of even natural numbers by divisions by 2 that follows a recurrent pattern of the form , 1, , 1 . . ., where  represents divisions by 2 more than once. The sequence presents a probability of 50:50 of division by 2 more than once as opposed to division by 2 once over the even natural numbers.The sequence also gives the same 50:50 probability of consecutive Collatz even elements when counted for division by 2 more than once as opposed to division by 2 once and a ratio of 3:1. Considering Collatz function producing random numbers and over sufficient number of iterations, this probability distribution produces numbers in descending order that lead to the convergence of the Collatz function to 1, assuming that the only cycle of the function is 1-4-2-1.
In other words, starting with an odd number,the function produces a random even integer on the even positive integers, which in tern either will be divisible by 2 once or more than once with probability 50:50 and higher counts for division by 2 more than once for all even integers to infinity, which leads to convergence of the function. This is clear since division by 2 once increases the start odd number while division by 2 more than once decreases it.


text:
Q: Zipping tuples and unpacking into same dimension Given two lists
A = ['a','b','c','d']
B = [(1,11),(2,22),(3,33),(4,44)]

I want to zip into the list [('a', 1, 11), ('b', 2, 22), ('c', 3, 33), ('d', 4, 44)].
Doing list(zip(a, b)) gives [('a', (1, 11)), ('b', (2, 22)), ('c', (3, 33)), ('d', (4, 44))].
Unpacking B doesn't work [('a', 1, 2, 3, 4), ('b', 11, 22, 33, 44)].

A: With python3.6, you can zip them and use the unpacking operator:
>>> [(a, *b) for a, b in zip(A, B)]
[('a', 1, 11), ('b', 2, 22), ('c', 3, 33), ('d', 4, 44)]

For older versions, perform tuple concatenation...
>>> [(a, ) + b for a, b in zip(A, B)]
[('a', 1, 11), ('b', 2, 22), ('c', 3, 33), ('d', 4, 44)]

...to the same effect.

A: Or try map:
>>> list(map(lambda x,y: (x,)+y,A,B))
[('a', 1, 11), ('b', 2, 22), ('c', 3, 33), ('d', 4, 44)]

A: Although coldspeed's answer is much better, here is my 2 cents
l = [(z[0], z[1][0], z[1][1]) for z in zip (A, B)]
print(l)


text:
Q: Bootstrap horizontal formatting I'm working on making a page to understand Bootstrap formatting better, but am having a very difficult time figuring out how to use the columns in association with the other types of classes. I want to create a window to hold a potential Javascript game. Next to it, I want to put a rectangular area for scores to be displayed. The thing that I would appreciate help with is understanding how to format the divs in HTML and Bootstrap to create the game area and scoreboard area. Here is a snippet of code that I was messing around with to space it, but I can't tell what to do with it.

Here is a column

Game container

Here is another column

This link has an image of the general layout I am aiming for. http://imgur.com/a/FMznH
Thank you for any help.

A: You can use this structure for your task.And you can customize(width of the column) it according to your requirement.

Here is a column

Javascript container

Score column

A: This look like the layout, right?

Here is a column

Here is another column

A: Each row in bootstrap can have upto 12 columns and xs, sm, md, lg specifies how many columns it will take in extra-small, small, medium and large devices respectively.
So if you write

this will create your first row with 1 column taking all space in all devices greater than and equal to an extra small device (-xs).
And if you write

</div

this will create your second row with column taking space equal to 8 columns and second column taking space equal to 4 columns. Notice sum 12 (8+4).And this will take this space in all devices greater than and equal to a medium device (-md) and in all smaller devies (-sm, -xs) it will break into 1 column taking space of 12 columns like your first row.
And third row can be created similar to first row.
I hope this helps, if you have any other queries you can comment on this :)

A: This would be the sample two column layout from the image you provided.

.custom {
  background: #eeeeee;
  height: 500px;
  padding: 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

        1st column

        2nd column


text:
Q: How to advance filter on multiple ranges I want to count the unique values of a column therefor I first used a autofilter to get the correct rows that I want to advanced filter.
The result I've assigned to a range using
intersect(Used.range,range.specialcells(xlCellTypeVisible))

This gave me a range say (B10:B20, B75) so it's actually 2 ranges B10:B20 and B75. Therefor I cannot directly apply a advancedfilter on it. Does someone know how to do achieve this?
I've thought of splitting the range into two seperates but then I cannot count the unique values correctly, I'll get a count of one range and a count of the other but it's possible that they have the same values. I've also thought to put the values in a array, but it's not a very efficient way to do it I think.
Thanks.

A: Advanced Filter is not required if you only need a count of the filtered uniques.
Consider:
Sub Xepos()
    Dim N As Long, c As Collection
    Dim colid As String, r As Range
    colid = "A"
    Set c = New Collection
    N = Cells(Rows.Count, colid).End(xlUp).Row
    On Error Resume Next
    For i = 2 To N
        Set r = Cells(i, colid)
        If r.EntireRow.Hidden = False Then
            v = r.Text
            c.Add v, CStr(v)
        End If
    Next i
    MsgBox c.Count
End Sub

This assumes that the column is column A and there is a header cell in A1


text:
Q: Magento 2: Cutom product attribute is not available for lyered navigation I have created product attribute using following code. But attribute is not available in layered navigation filter.
$eavSetup->addAttribute(
            \Magento\Catalog\Model\Product::ENTITY,
            'custom_dropdown',
            [
             'type'                    => 'varchar',
             'backend'                 => '',
             'frontend'                => '',
             'label'                   => 'Course Location',
             'input'                   => 'select',
             'class'                   => '',
             'source'                  => '',
             'global'                  => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
             'visible'                 => true,
             'required'                => true,
             'user_defined'            => true,
             'default'                 => '',
             'searchable'              => false,
             'filterable'              => false,
             'comparable'              => false,
             'visible_on_front'        => true,
             'used_in_product_listing' => true,
             'is_used_in_grid'         => true,
             'unique'                  => false,
             'apply_to'                => '',
            ]
        );

I have searched in back end there is no Use In Layered Navigation option available. This attribute is previously added and lot of data is filled for the same. Now requirement is to show this attribute in layered navigation.

A: Please Try This code to add Product attribute to Programatically . with possible options.
$eavSetup->addAttribute(
    \Magento\Catalog\Model\Product::ENTITY,
    'custom_dropdown',
    [
        'type' => 'varchar',
        'label' => 'Custom Dropdown',
        'input' => 'multiselect',
        'required' => false,
        'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
        'global' => Attribute::SCOPE_GLOBAL,
        'visible' => true,
        'user_defined' => false,
        'searchable' => false,
        'filterable' => true,
        'filterable_in_search' => true,
        'comparable' => false,
        'visible_on_front' => false,
        'unique' => false,
        'group' => 'General',
        'is_used_in_grid' => true,
        'is_visible_in_grid' => false,
        'is_filterable_in_grid' => true,
        'system' => 0,
        'label' => [
            'values' => [
                'Gluten',
                'Soy',
                'Otion1',
                'Otion2',
                'Otion3',
                'Otion4',
                'Otion5',
                'Otion6'
            ]
        ]
    ]
);

A: Follow This Step :-

1. Navigate to Stores > Attributes > Product in Magento admin panel.
2. Search for the needed attribute (the attribute you want to add to the layered navigation) and click on it to Edit it.
3. In Storefront Properties tab > Use in Layered Navigation select Filterable (with results).
4. Set Use in Search Results Layered Navigation to Yes.
5. Press the Save Attribute button and perform the same changes for all the needed attributes.
6. In order the layered navigation to appear on category pages you need to perform the following for each category:

*

*Open Products > Inventory > Categories and select the category to edit.

*In the Display Settings tab > Is Anchor select Yes.

*Click on the Save Category.
7. To make the changes appear on the store, make sure to reindex your store.

Magento 2. How to Display Product Attributes in Layered Navigation


text:
Q: Fundamentally doing something wrong with function calls. Functions do work in the console This is a solid, proper syntax set of functions, and for the life of me I can't figure out why, but the function ServiceHover() will not run unless I trigger it manually in the console, while it's almost exact equal CategoryHover() runs perfectly each time. It has to be something about the way that I'm calling the functions, and clearly there's something about functions that I fundamentally missed in javascript, because this happens to me often, where I'm unsure why my functions are not executing.
I keep my code all very well commented, so I shouldn't have to explain the functions's purposes, and furthermore, this is more a question of the fundamental execution of the functions rather than their inner functionality. Each function does work if called manually in the console.
//this function generates the content of the page based on which category the user selects,
//which services the user selects, and help maneuver through each stage of the feature selection
//so that the QuoteEngine function can display the user's selected hour count, price per hour
// and total cost of the needed service so that the user can see very clearly what services
//he is getting and where every dollar of his total cost is coming from so that the user can
//make a well informed purchase decision, and be able to clearly understand the services offered
//and related pricing.
$(document).ready(function () {

    function BasicDropdown() {
        //hide the drop-downs to begin with
        //hide element with class dropdown-category
        $(".dropdown-category").hide();
        //hide element with class dropdown-service
        $(".dropdown-service").hide();

        //when the category list title is hovered over, show the category drop-down list
        //when element with class category is hovered, do this:
        $(".category").hover(function () {
            //show the list
            $(".dropdown-category").show();
            //when element with class category is no longer hovered, do this:
        }, function () {
            //hide the list
            $(".dropdown-category").hide();
        });

        //when the service list title is hovered over, show the service drop-down list
        //when element with class service is hovered, do this:
        $(".service").hover(function () {
            //show the list
            $(".dropdown-service").show();
            //when element with class service is no longer hovered, do this:
        }, function () {
            //hide the list
            $(".dropdown-service").hide();
        });
    }

    //change the selected service based on an id input
    //create a function to change the selected service
    function ChangeService(id) {
        //clear the service list element
        $(".dropdown-service").empty();
        //make the name inside the service drop-down title show the new title
        $("#ServiceOutput").text(ServiceArray[id][0][1]);
        //loop through the chosen section of the service array for as many times as the
        //section is in length
        for (var i = 0; i < ServiceArray[id].length; i++) {
            //each loop, append a paragraph element with a data key equal to the current
            //loop count, an id equal to the id of the array area based on the loop count,
            //and also insert the element's text according to that loop count also.
            $(".dropdown-service").append('
' + ServiceArray[id][i][1] + "
");
        }
        //set the variable "Category" to be equal to the chosen id.
        Category = id;
    }

    function CategoryHover() {
        //make the category drop-down list open and show its list of services
        //when the user hovers over an element in the category drop-down, do this:
        $(".dropdown-category > p").hover(function () {
            //hide the welcome wrapper
            $(".welcomeWrapper").hide();
            //set the variable "thisKey" based on the value of the data "key" attached
            thisKey = $(this).data("key");
            //create a variable "outputList" and assign a value to it from "CategoryArray"
            outputList = CategoryArray[thisKey];
            //set the title of the category drop-down lists title to the currently hovered text
            $("#CategoryOutput").text($(this).text());
            //call the ChangeService function and pass the variable "thisKey" into it
            ChangeService(thisKey);
            //show the service drop-down list
            $(".dropdown-service").show();
            //show the ListOutput element (this shows a short description of the hovered element)
            $(".ListOutput").show();
            //append the variable "outputList" as the value of a paragraph element
            $(".ListOutput").append('
' + outputList + '
');
        }, function () {
            //hide the service drop-down list
            $(".dropdown-service").hide();
            //empty the ListOutput element
            $(".ListOutput").empty();
            //hide the ListOutput element
            $(".ListOutput").hide();
            //show the welcome wrapper again
            $(".welcomeWrapper").show();
        });
    }

    function ServiceHover() {
        //make the service drop-down  list open and show the list of services for the category
        //when the user hovers over an element in the service drop-down, do this:
        $(".dropdown-service > p").hover(function () {
            //hide the welcome wrapper
            $(".welcomeWrapper").hide();
            //set the variable "thisKey" based on the value of the data "key" attached
            thisKey = $(this).data("key");
            //create a variable "outputList" and assign a value to it from "CategoryArray"
            outputList = ServiceArray[Category][thisKey][2][0];
            //show the ListOutput element (this shows a short description of the hovered element)
            $(".ListOutput").show();
            //append the variable "outputList" as the value of a paragraph element
            $(".ListOutput").append('
' + outputList + '
');
        }, function () {
            //empty the ListOutput element
            $(".ListOutput").empty();
            //hide the ListOutput element
            $(".ListOutput").hide();
            //show the welcome wrapper again
            $(".welcomeWrapper").show();
        });
    }

    BasicDropdown();
    CategoryHover();
    ServiceHover();

    //initiate
    ChangeService(0);

});

What am I doing wrong with these calls?
JS Fiddle: http://jsfiddle.net/gbJcg/4/
Note: I mentioned in my question but for some reason the update didn't show up, that all of the arrays should be assumed defined. I'll now include them to remove confusion, but it will make the scripts extensively long
Added detail: ChangeCategory works. ChangeService doesn't appear to. If I copy and paste ChangeService, however, in the console, and call it, in the console, the functionality works perfectly. Does that help? I have no idea what I'm doing wrong here...

A: Check your console, you have Uncaught ReferenceError: ServiceArray is not defined
This Exception is thrown and the rest of the program is not ran
EDIT: after fiddle changed with the missing Arrays initialization is seems like the code works. I added alerts in the begining of 2 functions to make sure they are called (see http://jsfiddle.net/gbJcg/3/)
EDIT #2:
The call to $(".dropdown-service > p").hover(...) is done when you do not have any elements that respond to ".dropdown-service > p" selector, They are probably added later via ajax or some other html manipulation that is done by js
You should use the equivalent for jquery live instead:
$(document).on("mouseenter",".dropdown-service > p",function() {
    ....
});
$(document).on("mouseleave",".dropdown-service > p",function() {
    ....
});

A: Well what I know is, since your dropdown-service is added dynamically, you need to delegated it to closest static parent present in the document which is dropdown-service in your case.
 $(".dropdown-service").on("mouseenter" ,"p",function () {
     ..
 });

  $(".dropdown-service").on("mouseleave" ,"p",function () {
      ...
 });

Since live is deprecated in latest version of jQuery you need to use on delegated event and break the hover into mouseenter and mouseleave function.
fiddle here


text:
Q: How to get single backslash instead of double backslash with encode("unicode-escape")? Get unicode point of character Ä.
Python3 version.
>>> str="Ä"
>>> str.encode("unicode-escape")
b'\\xc4'

How to get the single backslash format b'\xc4' instead of b'\\xc4' as my output ?

A: It's not entirely clear to me what you want, so I'll give you a few options.
Get the (Unicode) code point of a character as an integer:
>>> ord('Ä')
196

Display the integer in hex notation:
>>> hex(ord('Ä'))
'0xc4'

or with string formatting:
>>> '{:X}'.format(ord('Ä'))
'C4'

However, you talk about backslashes and show the bytestring b'\xc4'.
This is the Latin-1 encoding of 'Ä' (all characters with a Unicode codepoint below 256 can be encoded with Latin-1, and their byte value equals the Unicode codepoint).
>>> 'Ä'.encode('latin-1')
b'\xc4'

This is a bytestring of length 1.
It is displayed in a way in which you could type this character, ie. using an escape sequence with backslash-x and a two-digit hex number.
The "unicode-escape" codec produces these four ASCII characters (\, x, c 4), but not as str, but as a bytes object (because str.encode() returns bytes by definition).
To get a backslash in a str/bytes literal, you need to type two backslashes, so the representation form also uses two backslashes:
>>> 'Ä'.encode('unicode-escape')
b'\\xc4'

The "unicode-escape" codec is very Python-specific and I don't see a lot of applications; maybe if you want to write your own pickle protocol or parse fragments of Python source code.


text:
Q: Android Studio - autocomplete within androidTest/res not working? When opening up .xml files under /src/androidTest/res/ the autocomplete doesn't seem to activate.  (ie. I start typing android:... and usually a menu will popup with completion suggestions)
Is there some setting that doesn't get turned on by default that I'm missing?


text:
Q: how redirect from https to http I need to redirect from https to http
this is my .haccess file :
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

A: The code you posted is an HTTP to HTTPS redirect, so you just need to reverse the logic:
RewriteCond %{HTTPS} =on
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

(I've also simplified the regex ^(.*)$ to ^.)
You do, however, still need to have a valid SSL cert installed on your server for the redirect to be effective, as otherwise the user-agent won't even reach your server to run your code.
And... redirecting from HTTPS to HTTP in the first place doesn't make a whole lot of sense in 2019.


text:
Q: composing commands to chain with parallel execution I am looking for a pattern(s) suitable for this scenario.
I need process files from HDD in this way.

*

*Load file

*Analyze file

*Validate file based on analyze result

*Import file to app based on validation result

This process can be change in future.
My idea is create command for each file action (Command pattern).

*

*LoadFileCommand : IFileCommand

*AnalyzeFileCommand : IFileCommand

*ValidateFileCommand : IFileCommand

*ImportFileCommand: IFileCommand

Code:
public interface IFileCommand
{
  FileCommandResult Execute();
  void Abort();
}
public class FileCommandResult
{
  FileInfo File{get;}
  bool Sucesss{get;}
  string Error{get;}
}

I need create process with commands (chain with commands).
I try use for this purpose Chain of resposibility pattern but maybe exist better pattern or design.
If it is possible I would like use Rx and also parallel execution will be nice.
I would like achieve this:
var data = new List<FileInfo>();

var process = new List<IFileCommand>{new LoadFileCommand(), new AnalyzeFileCommand(), new ValidateFileCommand(), new ImportFileCommand()};

var processor = new FileProcessor();

IEnumerable<IFileCommandResult> results = processor.Execute(process, data);

Any ideas.

A: Why do you want to use Rx for this?  If you want to represent your operations as a sequence of commands, then just use LINQ to apply the command chain.  If you want them to run in parallel, then just use PLINQ, TPL, or Parallel.ForEach.  You might also take a look at TPL Dataflow.
Here's 3 ways to solve your problem.  Note I did not implement error handling or mess with your Abort method and I took some liberties with your Execute method since what you had was unusable.  I now assume Execute has this signature: FileInfo Execute(FileInfo) and that it throws an exception if it fails.
IEnumerable<FileInfo> data = ...;
IEnumerable<IFileCommand> process = ...;

// PLINQ
var results = data
    .AsParallel()
    .Select(dataItem => process.Aggregate(dataItem, (d, p) => p.Execute(d)))
    .ForAll(dataItem => import(dataItem));

// Parallel.Foreach
Parallel.Foreach(data, dataItem => import(process.Aggregate(dataItem, (d, p) => p.Execute(d))));

// TPL
var tasks = data
    .Select(dataItem => Task.Run(() => import(process.Aggregate(dataItem, (d, p) => p.Execute(d)))));
await Task.WhenAll(tasks);