Posts

Showing posts from July 26, 2018

How to loop through array of multiple arrays in php

Image
Clash Royale CLAN TAG#URR8PPP How to loop through array of multiple arrays in php I am trying to loop through array of arrays in php. Usually get stalked with complex array sometimes but I need your kind assistance with this. var_dump($array) produced the array below: var_dump($array) $arrayVal = array(6) { ["item_id"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } ["request_explanation"]=> array(2) { [0]=> string(7) "Welcome" [1]=> string(11) "Hello World" } ["quantity"]=> array(2) { [0]=> string(1) "4" [1]=> string(1) "4" } ["unit_cost"]=> array(2) { [0]=> string(1) "4" [1]=> string(1) "3" } ["total_cost"]

Change order of rows

Image
Clash Royale CLAN TAG#URR8PPP Change order of rows I have a table like this: +-------+--------------------------------------+------------------+--------------------------------------------------------+ | SecID | SecGuid | LevelType | Description | +-------+--------------------------------------+------------------+--------------------------------------------------------+ | 1 | 550239E9-01A1-4403-8133-834DD0EBD7EA | Administrator | All Access Pass | | 2 | 181104C8-2241-4E51-B73D-59D5E4E8C22D | Advanced Author | Edit, create, delete, archive, pricing, and agreements | | 3 | 24E50493-854C-4C44-A074-E6D2EAAC5E5C | Mid Level Author | Edit, create, delete and archive | | 4 | 306C087D-F86A-43F6-B57A-8C65F9E8337D | Author | Edit and create | | 5 | 9B66AE7D-B704-4D75-8776-774A2CFC0C47 |

How to override the where method of ActiveRecord properly?

Image
Clash Royale CLAN TAG#URR8PPP How to override the where method of ActiveRecord properly? I already successfully overrode the where method. The behavior I want to achieve is, if a my hstore is accessed, it rewrites the where query in such a way, that the hstore items are treated as separate columns. Here is my where method: where hstore where hstore where def where(opts = :chain, *rest) if opts == :chain WhereChain.new(spawn) elsif opts.blank? return self elsif opts.is_a?(Hash) translated_attributes(opts).each do |attribute| return spawn.where!("'#{opts[attribute]}' = any(avals(#{attribute}))", rest) end else super(opts, rest) end end For that I wrote this minitest , which works great! minitest def test_where_query_with_translated_value PageWithFallbacks.create!(:title_raw => {'en' => 'English title', 'de' => 'Deutscher Titel'}) exp = PageWithFallbacks.create!(:title_raw => {'e

ASP.NET CORE 2.1 Preview “SharedCompilationId” parameter is not supported by the “Csc” task

Image
Clash Royale CLAN TAG#URR8PPP ASP.NET CORE 2.1 Preview “SharedCompilationId” parameter is not supported by the “Csc” task I am trying run the project with views in separate class library on Mac OSX as described in below article https://blogs.msdn.microsoft.com/webdev/2018/03/01/asp-net-core-2-1-razor-ui-in-class-libraries/ The problem is that I cannot build the class library project with Visual Studio Community 7.4 on Mac OS. Project builds with command line (donet build) without problems but when I try to build it with Visual Studio it throws two errors: /usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.razor.design/2.1.0-preview1-final/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets(10,10): Error MSB4064: The "SharedCompilationId" parameter is not supported by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property. (MSB4064) /usr/local/share/dotnet/sdk/NuGetFallbackFolder

Cannot set an IP address on Express JS app

Image
Clash Royale CLAN TAG#URR8PPP Cannot set an IP address on Express JS app Trying to test an endpoint in express But keep getting 404 error. var express = require("express") var app = express() //var http = require('http').Server(app) app.get('/', function(req,res){ res.send('ok from end point') }) var port = process.env.PORT|| 8080 var localhost = 'someLocalHost.med.gov' console.log({'localhost':localhost, 'post':port}) // app.listen(port,localhost,function(err){ if (err){ console.log('err') } else { console.log('Listening') } }) Look up the || operator. You are doing process.env.PORT OR 8080 . In other words, if process.env.PORT is set, that's the value that will be used, and 8080 will only be used if the former is not set. – Claies yesterday

JavaScript to input data and produce results bases on input [on hold]

Image
Clash Royale CLAN TAG#URR8PPP JavaScript to input data and produce results bases on input [on hold] I need help pls....i would like to create a script that creates different results when clicking on a button bases on if statements. For example....i need to have choices bases on radio buttons so if the first button is male or female then outcome is 'a customized statement. Then I would to continue the output statement based on their age whether under or over 21 so then the statement would be changed. And also if body mass index is greater or less than a particular number then a new statement would be produced when the button is clicked. So if the choices are male, over 21 and a bmi of 120 the the outcome is 'loose weight'. Can some somebody assist with a JavaScript for this please? Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help

What is best way to store custom user fields in ms sql for .net web application?

Image
Clash Royale CLAN TAG#URR8PPP What is best way to store custom user fields in ms sql for .net web application? I have a CRM application that has all commonly needed profiling fields that a user may need to store customers and related data. But, there are needs for additional related specialty data to be stored for each user's customers. I have been putting this off as I am still perplexed on the pros/cons of the ways to store user supplemental data in the database. IDEA 1: Framework of Permanent Application Tables I have created a framework that requires 5 tables (at least) that would store all supplemental data for all users as a permanent store. It limits the user to adding expanded fields only to tables we designate. It does not allow user to create a new custom table. User can: The framework knows the key field name (CustomerID, InventoryItemID) for that table and can join those fields into custom views (Just to give you an idea why this scares me, here are the tables...) UserD

How to install mayavi on Colab?

Image
Clash Royale CLAN TAG#URR8PPP How to install mayavi on Colab? I tried installing mayavi on Colab using pip: !pip install mayavi This threw the following error: Running setup.py bdist_wheel for mayavi ... error The rest of the error output is available at the Colab document. Solution: Work in Progress Following the response from @Bob-Smith, I found that his solution needed a slight change for installing the dependencies: !apt-get install vtk6 !apt-get install libvtk6-dev python-vtk6 !apt-get install vtk6 !apt-get install libvtk6-dev python-vtk6 Problems Faced and Workaround Found (PFWF) PFWF-001 !apt-get install python-vtk throws the following error: !apt-get install python-vtk Package 'python-vtk' has no installation candidate I found a command-reference for this: !apt-get install libvtk5-dev python-vtk !apt-get install libvtk5-dev python-vtk However, this command also did not work. The package name had changed from libvtk5-dev to libvtk6-dev and the python binding for

how to make PHP lists all Linux Users?

Image
Clash Royale CLAN TAG#URR8PPP how to make PHP lists all Linux Users? I want to build a php based site that (automate) some commands on my Ubuntu Server first thing I did was going to the file (sudoers) and add the user www-data so I can execute php commands with root privileges! # running the web apps with root power!!! www-data ALL=(ALL) NOPASSWD: ALL then my PHP code was <?php $command = "cat /etc/passwd | cut -d":" -f1"; echo 'running the command: <b>'.$command."</b><br />"; echo exec($command); ?> it returns only one user (the last user) !!! how to make it return all users? thank you This is an incredibly bad idea for security reasons. – Matt S May 22 '10 at 22:29 Will you tell us the address of your server afterwards? :-)

Espresso with Custom KeyboardView button press

Image
Clash Royale CLAN TAG#URR8PPP Espresso with Custom KeyboardView button press I am implementing a custom KeyboardView in my app and it's all working at the moment, however, when I attempt to press a key on the keyboard using Espresso ViewAction, I am getting an exception saying: android.support.test.espresso.PerformException: Error performing 'single click - At Coordinates: 1070, 2809 and precision: 16, 16' on view 'with id: com.example.app.mvpdemo:id/keyboardLayout'. The code throwing the exception is: @Test fun enter100AsPriceShouldDisplay120ForA20PercentTip(){ onView(withId(R.id.editTextCheckAmount)) .perform(typeText("100"), closeSoftKeyboard()) val appContext = InstrumentationRegistry.getTargetContext() val displayMetrics = appContext.resources.displayMetrics onView(withId(R.id.keyboardLayout)).perform(clickXY(displayMetrics.widthPixels - 10, displayMetrics.heightPixels - 10)) onView(withText("$120.00")).check(

p:autoComplete Complete Method returns the list in the backend but is not showing in the UI

Image
Clash Royale CLAN TAG#URR8PPP p:autoComplete Complete Method returns the list in the backend but is not showing in the UI I have this part in the file <p:autoComplete required="true" requiredMessage="Value required" valueChangeListener="#{xxxxx.updateListener}" id="yy" value="#{ybean.prop}" completeMethod="#{xxxxx.autoCompleteValues}" placeholder="Type a Name..." > </p:autoComplete> When I am trying to get the list from autoCompleteValues of xxxxx(RequestScoped) class I am able to return it in the backend but it is not displaying in the UI. Please find the below backend code whose class is RequestScoped: public List autoCompleteValues(String name) { List finalList = new ArrayList<>(); try { //BackingWorkBean is sessionScoped

Moving Dropdown DataFieldCategory to bottom of list

Image
Clash Royale CLAN TAG#URR8PPP Moving Dropdown DataFieldCategory to bottom of list I have a list of "Care Items" that possess a soft delete bool, an ID, a name, and a Category. Currently, I am querying for all! IsDeleted and it populates just fine under with each item grouped under their appropriate categories. I am now changing it so that items that are IsDeleted populate in a "Disabled Care Item" Category. That works fine, but "Disabled Care Item" is showing up where you would expect it to in the middle of a list with 10-20 categories each with at least a few items in each. So disabled gets lost. I would love to be able to move the disabled category and items to the bottom of the list, but each time I try I am getting implicit casting errors between my lists or errors against IQueryable since I'm LINQing for these results. I know there is somebody clever out there who has a solution for this complete noob. var query = CareItemFactory.Instance.GetByCa

High Distance Bluetooth Transmitter Microchip

Image
Clash Royale CLAN TAG#URR8PPP High Distance Bluetooth Transmitter Microchip I’m trying to develop a product and a bit new to this type of development and technology. As I continue to build a newer prototype, I’m looking for: 1) needs to be small, like the 1 inch x 1inch and 1/2 inch thick or smaller, assuming microchip is the way to go? 2) needs to transmit far, hoping for 100meters outdoors 3) needs to transmit to a mobile Android or IOS phone 4) low energy is preferred Thought someone might be able to point me in the right direction for the transmitter. Just a Newbie trying to provide value for mankind A half-cubic inch for power, transmitter, and antenna for 100m LoS is probably pushing it. But you say nothing about how much data how often, so nobody can help. Even if it was OT for SO, which it isn't. Maybe the embedded or IoT SE. – Dave Newton yesterday

How to use Spark with neo4j?

Image
Clash Royale CLAN TAG#URR8PPP How to use Spark with neo4j? I am a beginner for Neo4j. Recently i was creating graphes by loading the csv and creating in the main time nodes and their relationships. now my boss ,who wants a scalable solution,give me a Spark project and want me to process or load the java-pair-rdd and create a graph based on it. so how to use spark with neo4j ? Update : I found Cypher for Apache Spark but it's steel in Beta version and the Build dosen't succeed on windows 10. Search previous questions for how others are doing it stackoverflow.com/questions/tagged/… – cricket_007 Jul 10 at 14:06 By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your c

error storing data, {}- Redux Persist

Image
Clash Royale CLAN TAG#URR8PPP error storing data, {}- Redux Persist So I was able to successfully link up my store to my main App.js, but now I get this error about storing data. I tried to purge to see if that would do anything, and I got a similar error where it said it could not purge data stored store {}. UPDATE: The issue is relating to const storage and the redux-persist-sensitive-storage library. Still, don't know how to save the data with this library. const storage store.js: const initialState = {}; const storage = createSensitiveStorage({ keychainService: "myKeychain", sharedPreferencesName: "mySharedPrefs" }); const config = { key: "root", storage, }; const middleware = [thunk]; const reducer = persistCombineReducers(config, rootReducer); export default () => { let store = createStore( reducer, initialState, compose(applyMiddleware(...middleware)) ); let persistor = persistStore(store); return { store, persist

Why does clickable view gain ripple after being selected?

Image
Clash Royale CLAN TAG#URR8PPP Why does clickable view gain ripple after being selected? I'm trying to use the theme attribute colorControlHighlight to apply default ripples to all clickable views in my app. Setting this theme attribute does change the ripple colors for controls such as buttons, tabs, etc. colorControlHighlight My clickable views do not have a ripple effect on click initially. However, if I pass over the view by navigating with the arrow keys, pressing tab, etc., the view will then ripple when clicked. What changes in a view after being selected using the arrow keys? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.