问:
WiFi connection issues when BLE scan always on
I'm currently scanning BLE devices continuosly and undefenetily, but I noticed that my Samsung J1 loose wifi connections, and any atempt to reconect gives "Authentication Error":"Password incorrect". Stoping BLE scan gives access to the wifi networks again (without reentering password).

Theres know issues on that behaviour?

PS: My current Scanner has filters and currently the device just lost 50% battery in 14 hours (including itself running with screen of)

Logcat from system when the event happens: (Afterwards looks like only applications reporting errors cause of internet)

02-09 11:38:54.246 19629-19663/? D/ScanRecord: first manudata for manu ID
02-09 11:38:54.246 19629-19663/? D/BtGatt.GattService: result: ScanResult{mDevice=FC:8F:90:27:18:38, mScanRecord=ScanRecord [mAdvertiseFlags=-1, mServiceUuids=null, mManufacturerSpecificData={117=[66, 4, 1, -128, 0, -4, -113, -112, 39, 24, 56, -2, -113, -112, 39, 24, 55, 1, 0, 0, 0, 0, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-91, mTimestampNanos=90987161943833}
02-09 11:38:54.246 19629-19663/? D/BtGatt.GattService: filter: BluetoothLeScanFilter [mDeviceName=null, mDeviceAddress=null, mUuid=0000feaa-0000-1000-8000-00805f9b34fb, mUuidMask=null, mServiceDataUuid=null, mServiceData=null, mServiceDataMask=null, mManufacturerId=-1, mManufacturerData=null, mManufacturerDataMask=null]
02-09 11:38:54.356 19629-19640/? D/BtGatt.GattService: stopScan() - queue size =1
02-09 11:38:54.356 19629-20084/? D/BtGatt.ScanManager: stop scan
02-09 11:38:54.356 19629-20103/? D/BtGatt.GattService: unregisterClient() - clientIf=6
02-09 11:38:54.356 19629-20084/? D/BtGatt.ScanManager: configureRegularScanParams() - queue=0
02-09 11:38:54.356 19629-20084/? D/BtGatt.ScanManager: configureRegularScanParams() - ScanSetting Scan mode=-2147483648 mLastConfiguredScanSetting=2
02-09 11:38:54.356 19629-20084/? D/BtGatt.ScanManager: configureRegularScanParams() - queue emtpy, scan stopped
02-09 11:38:54.356 19629-20094/? D/bluedroid-mrvl: bt_vnd_mrvl_if_op(L95): opcode = 7
02-09 11:38:54.366 19629-20094/? D/bluedroid-mrvl: bt_vnd_mrvl_if_op(L95): opcode = 7
02-09 11:38:54.366 19629-20094/? D/bluedroid-mrvl: bt_vnd_mrvl_if_op(L95): opcode = 7
02-09 11:38:55.096 2414-2898/? D/Netd: Iface wlan0 link down
02-09 11:38:55.096 2839-2857/? D/BatteryService: !@BatteryListener : batteryPropertiesChanged!
02-09 11:38:55.096 2839-2857/? D/BatteryService: level:97, scale:100, status:2, health:2, present:true, voltage: 4271, temperature: 320, technology: Li-ion, AC powered:false, USB powered:true, POGO powered:false, Wireless powered:false, icon:17303201, invalid charger:0
02-09 11:38:55.096 2839-2857/? D/BatteryService: online:4, current avg:0, charge type:1, power sharing:false, high voltage charger:false, capacity:190000, current_now:80
02-09 11:38:55.106 2839-2931/? D/Tethering: interfaceLinkStateChanged wlan0, false
02-09 11:38:55.106 2839-2839/? D/BatteryService: Sending ACTION_BATTERY_CHANGED.
02-09 11:38:55.106 2839-2931/? D/Tethering: interfaceStatusChanged wlan0, false
02-09 11:38:55.106 2414-2898/? D/Netd: Iface wlan0 link down
02-09 11:38:55.106 20063-20063/? I/wpa_supplicant: CTRL-EVENT-DISCONNECTED bssid=C0.85.28 reason=3
02-09 11:38:55.106 20063-20063/? I/wpa_supplicant: wlan0: Setting scan request: 0 sec 500000 usec
02-09 11:38:55.106 2839-3135/? D/Tethering: InitialState.processMessage what=4
02-09 11:38:55.106 20063-20063/? I/wpa_supplicant: wlan0: State: COMPLETED -> DISCONNECTED
02-09 11:38:55.106 20063-20063/? I/wpa_supplicant: CTRL-EVENT-STATE-CHANGE id=13 state=0 BSSID=C0.85.28 SSID=494E41434C4956452032
02-09 11:38:55.106 2839-3135/? D/Tethering: Get OMC_SalesCode failed
02-09 11:38:55.106 2839-3131/? E/WifiConfigStore: setLastSelectedConfiguration -1
02-09 11:38:55.106 2839-2931/? D/Tethering: interfaceLinkStateChanged wlan0, false
02-09 11:38:55.106 2839-2931/? D/Tethering: interfaceStatusChanged wlan0, false
02-09 11:38:55.116 2839-3135/? E/Tethering: No numeric data
02-09 11:38:55.116 3214-3214/? D/KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
02-09 11:38:55.116 3214-3214/? D/KeyguardUpdateMonitor: handleBatteryUpdate
02-09 11:38:55.116 19629-19629/? V/HeadsetService: HeadsetService - Received Intent.ACTION_BATTERY_CHANGED
02-09 11:38:55.116 19629-20085/? D/HeadsetStateMachine: Disconnected process message: 10
02-09 11:38:55.126 3360-3360/? D/BroadcastReceiver 電池レベル:  LEVEL　　97 %
02-09 11:38:55.126 3360-3360/? D/BroadcastReceiver 電圧:  VOLT　　4271 mv
02-09 11:38:55.126 3360-3360/? D/BroadcastReceiver 温度:  TEMP　　320 ℃
02-09 11:38:55.126 3360-3360/? D/BroadcastReceiver 接続:  Plugged　　2

02-09 11:38:55.126 29974-29974/? D/WidgetProviderAssistiveLight: onReceive() PLUG:2 / STATUS:2 / LEVEL:97
02-09 11:38:55.126 29974-29974/? D/WidgetProviderAssistiveLight: onReceive() : cancel Timer
02-09 11:38:55.126 2839-3135/? D/Tethering: sendTetherStateChangedBroadcast 0, 0, 0
02-09 11:38:55.126 2839-3135/? D/Tethering: clearTetheredNotification()
02-09 11:38:55.126 3214-3214/? D/BatteryMeterView: ACTION_BATTERY_CHANGED : level:97 status:2 health:2
02-09 11:38:55.126 3214-3214/? D/BatteryMeterView: ACTION_BATTERY_CHANGED : level:97 status:2 health:2
02-09 11:38:55.126 3214-3214/? D/BatteryMeterView: ACTION_BATTERY_CHANGED : level:97 status:2 health:2
02-09 11:38:55.136 2839-3131/? E/WifiConfigStore: saveWifiConfigBSSID Setting BSSID for "INACLIVE 2"WPA_PSK to any
02-09 11:38:55.136 3214-3214/? D/HotspotTile: onReceive : android.net.conn.TETHER_STATE_CHANGED
02-09 11:38:55.136 3214-3214/? D/HotspotTile: updateTetherState():false, false
02-09 11:38:55.136 2839-3128/? V/NetworkStats: performPollLocked(flags=0x1)
02-09 11:38:55.136 2839-3128/? D/NetworkStatsFactory: UpdateStatsForKnox updated
02-09 11:38:55.136 2839-3128/? D/NetworkStatsFactory: UpdateStatsForKnox main else ---
02-09 11:38:55.136 2839-2839/? D/WifiNotificationController: SHOW_NOTI_MESSAGE : 12, visible : false, ssid : "INACLIVE 2"
02-09 11:38:55.136 2839-2839/? D/WifiNotificationController: SHOW_NOTI_MESSAGE : 12, visible : false, ssid : "INACLIVE 2", targetSSID : "INACLIVE 2", netId : -1, titleType : -1
02-09 11:38:55.136 2839-2839/? D/WifiNotificationController: showCaptivePortalSignInNotification with ssid/visible:"INACLIVE 2"/false
02-09 11:38:55.136 2839-2915/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
02-09 11:38:55.136 2839-2915/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
02-09 11:38:55.136 2839-2915/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
02-09 11:38:55.136 2839-2915/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
02-09 11:38:55.146 2839-3128/? V/NetworkStats: performPollLocked() took 10ms
02-09 11:38:55.146 2839-3130/? D/WifiP2pService: InactiveState{ what=143375 }
02-09 11:38:55.146 2839-3130/? D/WifiP2pService: P2pEnabledState{ what=143375 }
02-09 11:38:55.146 20063-20063/? I/wpa_supplicant: the nl80211 driver cmd is BTCOEXMODE 2
02-09 11:38:55.156 32697-32697/? E/Zygote: no v2
02-09 11:38:55.156 32697-32697/? I/SELinux: Function: selinux_compare_spd_ram, SPD-policy is existed. and_ver=SEPF_SM-J110M_5.1.1 ver=48
02-09 11:38:55.156 2839-2915/? I/ActivityManager: Start proc 32697:com.android.settings/1000 for broadcast-2 com.android.settings/.wifi.WifiStatusReceiver
02-09 11:38:55.156 2414-2904/? D/CommandListener: Clearing all IP addresses on wlan0
02-09 11:38:55.166 32697-32697/? I/SELinux: Function: selinux_compare_spd_ram , priority [1] , priority version is VE=SEPF_SM-J110M_5.1.1_0048
02-09 11:38:55.166 3746-29513/? V/NativeCrypto: Read error: ssl=0xab98f800: I/O error during system call, Connection timed out
02-09 11:38:55.166 3214-3214/? D/StatusBar.MSimNetworkController: getUpdateDataNetType(): 0
02-09 11:38:55.166 3214-3214/? D/StatusBar.MSimNetworkController: updateDataNetType sub = 0 mDataNetType = 0
02-09 11:38:55.166 3214-3214/? E/StatusBar.MSimNetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN
02-09 11:38:55.166 3214-3214/? D/StatusBar.MSimNetworkController: Nothing final, mRoamingIconId = 0 phoneId : 0
02-09 11:38:55.166 3214-3214/? D/StatusBar.MSimNetworkController: updateZTMDataNetType()
02-09 11:38:55.166 3746-29513/? V/NativeCrypto: SSL shutdown failed: ssl=0xab98f800: I/O error during system call, Broken pipe
02-09 11:38:55.166 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon mDataNetType= 0
02-09 11:38:55.176 2839-3134/? E/ConnectivityService: updateNetworkInfo()
02-09 11:38:55.176 2839-3134/? D/ConnectivityService: NetworkAgentInfo [WIFI () - 512] EVENT_NETWORK_INFO_CHANGED, going from CONNECTED to DISCONNECTED, reason = null, [ Transports: WIFI Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps]
02-09 11:38:55.176 2839-3134/? E/ConnectivityService: updateNetworkInfo()
02-09 11:38:55.176 2839-3134/? D/ConnectivityService: NetworkAgentInfo [WIFI () - 512] got DISCONNECTED, was satisfying 2
02-09 11:38:55.176 32697-32697/? E/SELinux: [DEBUG] get_category: variable seinfo: platform sensitivity: NULL, cateogry: NULL
02-09 11:38:55.176 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon phoneId =0 dataSub =0
02-09 11:38:55.176 2839-3131/? E/WifiConfigStore: saveWifiConfigBSSID Setting BSSID for "INACLIVE 2"WPA_PSK to any
02-09 11:38:55.176 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon( 0 )  GSM :  mMSimState= ABSENT mDataNetType= 0
02-09 11:38:55.176 2839-2839/? I/WifiTrafficPoller: evaluateTrafficStatsPolling
02-09 11:38:55.176 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon no sim
02-09 11:38:55.176 3746-29513/? E/GCM: Wifi connection closed with errorCode 20
02-09 11:38:55.176 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: ValidatedState{ when=0 what=532488 arg1=10006 target=com.android.internal.util.StateMachine$SmHandler }
02-09 11:38:55.176 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: DefaultState{ when=0 what=532488 arg1=10006 target=com.android.internal.util.StateMachine$SmHandler }
02-09 11:38:55.176 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: Forcing reevaluation
02-09 11:38:55.176 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: EvaluatingState{ when=0 what=532486 arg1=2 target=com.android.internal.util.StateMachine$SmHandler }
02-09 11:38:55.176 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: Checking http://connectivitycheck.android.com/generate_204 on
02-09 11:38:55.176 2839-29229/? I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
02-09 11:38:55.186 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon when mMSimDataConnected[0] =false mMSimMobileActivityIconId[0] = 0
02-09 11:38:55.186 2839-2935/? D/WifiDisplayController: WifiP2pReceiver::onReceive(): action=android.net.wifi.STATE_CHANGE
02-09 11:38:55.186 2839-3131/? E/WifiStateMachine: WifiStateMachine: Leaving Connected state
02-09 11:38:55.186 20063-20063/? I/wpa_supplicant: reset timer : RESET_TIMER 0
02-09 11:38:55.186 20063-20063/? I/wpa_supplicant: P2P: Current p2p state = IDLE
02-09 11:38:55.186 20063-20063/? I/wpa_supplicant: wlan0: State: DISCONNECTED -> SCANNING
02-09 11:38:55.186 20063-20063/? I/wpa_supplicant: CTRL-EVENT-STATE-CHANGE id=-1 state=3 BSSID=00.00.00 SSID=
02-09 11:38:55.186 20063-20063/? I/wpa_supplicant: Scan requested (ret=-11) - scan timeout 30 seconds
02-09 11:38:55.196 2839-3131/? D/SecContentProvider2: uri = 20 selection = getPromptCredentialsEnabled
02-09 11:38:55.196 2839-3131/? D/SecContentProvider2: mCursor = null
02-09 11:38:55.196 3214-3214/? D/STATUSBAR-WifiQuickSettingButton: onWifiSignalChanged enabled=true enabledDesc:"INACLIVE 2"
02-09 11:38:55.196 3214-3214/? D/StatusBar.MSimNetworkController: refreshViews connected={ wifi } phoneId = 0 level=4 mMSimcombinedSignalIconId=0x7f0202d4/com.android.systemui:drawable/stat_sys_wifi_signal_4 mMSimcombinedActivityIconId=0x7f0202a8 mAirplaneMode=false mMSimDataActivity=0 mMSimPhoneSignalIconId=0x7f020293/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mMSimDataDirectionIconId=0x0 mMSimDataSignalIconId=0x7f020293 mMSimDataTypeIconId=0x0/(null) mNoMSimIconId=0x7f020088/com.android.systemui:drawable/ic_qs_no_sim mMSimMobileActivityIconId=0x0/(null) mWifiIconId=0x7f0202d4 mBluetoothTetherIconId=0x7f0202b2 mRoamingIconId=0x 0/(null) mSimEnabled=true
02-09 11:38:55.196 3214-3214/? D/StatusBar.MSimNetworkController: getUpdateDataNetType(): 0
02-09 11:38:55.196 3214-3214/? D/StatusBar.MSimNetworkController: updateDataNetType sub = 1 mDataNetType = 0
02-09 11:38:55.196 3214-3214/? E/StatusBar.MSimNetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN
02-09 11:38:55.196 3214-3214/? D/StatusBar.MSimNetworkController: NoService, mRoamingIconId = 0phoneId : 1
02-09 11:38:55.196 3214-3214/? D/StatusBar.MSimNetworkController: isSIMOFFOfSlot simDBvalue0 = 1, simDBvalue1 =1
02-09 11:38:55.196 3214-3214/? D/StatusBar.MSimNetworkController: updateZTMDataNetType()
02-09 11:38:55.196 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon mDataNetType= 0
02-09 11:38:55.206 2839-3131/? D/WifiNetworkAgent: NetworkAgent: NetworkAgent channel lost
02-09 11:38:55.206 2839-3131/? E/WifiStateMachine: Error! unhandled message{ when=-19ms what=135188 target=com.android.internal.util.StateMachine$SmHandler }
02-09 11:38:55.206 2839-3131/? E/WifiStateMachine: Error! unhandled message{ when=-19ms what=135188 target=com.android.internal.util.StateMachine$SmHandler }
02-09 11:38:55.206 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon phoneId =1 dataSub =0
02-09 11:38:55.206 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon( 1 )  GSM :  mMSimState= ABSENT mDataNetType= 0
02-09 11:38:55.206 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon no sim
02-09 11:38:55.206 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon when mMSimDataConnected[1] =false mMSimMobileActivityIconId[1] = 0
02-09 11:38:55.216 2839-3131/? E/WifiStateMachine: Error! unhandled message{ when=-24ms what=135188 target=com.android.internal.util.StateMachine$SmHandler }
02-09 11:38:55.216 2839-3131/? D/SecContentProvider2: uri = 20 selection = getPromptCredentialsEnabled
02-09 11:38:55.216 2839-3131/? D/SecContentProvider2: mCursor = null
02-09 11:38:55.216 3214-3214/? D/StatusBar.MSimNetworkController: refreshViews connected={ wifi } phoneId = 1 level=0 mMSimcombinedSignalIconId=0x7f0202d4/com.android.systemui:drawable/stat_sys_wifi_signal_4 mMSimcombinedActivityIconId=0x7f0202a8 mAirplaneMode=false mMSimDataActivity=0 mMSimPhoneSignalIconId=0x7f020389/com.android.systemui:drawable/tw_stat_sys_signal_null mMSimDataDirectionIconId=0x0 mMSimDataSignalIconId=0x7f020389 mMSimDataTypeIconId=0x0/(null) mNoMSimIconId=0x7f020088/com.android.systemui:drawable/ic_qs_no_sim mMSimMobileActivityIconId=0x0/(null) mWifiIconId=0x7f0202d4 mBluetoothTetherIconId=0x7f0202b2 mRoamingIconId=0x 0/(null) mSimEnabled=false
02-09 11:38:55.216 3214-3214/? D/STATUSBAR-WifiQuickSettingButton: onWifiSignalChanged enabled=true enabledDesc:"INACLIVE 2"
02-09 11:38:55.216 3214-3214/? D/StatusBar.MSimNetworkController: getUpdateDataNetType(): 0
02-09 11:38:55.216 2839-19244/? D/ActivityManager: startService callerProcessName:com.whatsapp, calleePkgName: com.whatsapp
02-09 11:38:55.216 28448-28770/br.tv.inaclive.qridpresenca I/System.out: pool-2-thread-2 calls detatch()
02-09 11:38:55.216 32697-32697/? I/SAMP: ActivityThread() - SAMP_ENABLE : true
02-09 11:38:55.216 3214-3214/? D/StatusBar.MSimNetworkController: updateDataNetType sub = 0 mDataNetType = 0
02-09 11:38:55.216 3214-3214/? E/StatusBar.MSimNetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN
02-09 11:38:55.216 28448-28770/br.tv.inaclive.qridpresenca W/System.err: org.apache.http.conn.HttpHostConnectException: Connection to http://beacon.qrid.com.br refused
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:241)
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:172)
02-09 11:38:55.226 3214-3214/? D/StatusBar.MSimNetworkController: Nothing final, mRoamingIconId = 0 phoneId : 0
02-09 11:38:55.226 3214-3214/? D/StatusBar.MSimNetworkController: updateZTMDataNetType()
02-09 11:38:55.226 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon mDataNetType= 0
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:130)
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.client.DefaultRequestDirector.executeOriginal(DefaultRequestDirector.java:1317)
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:707)
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:696)
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:519)
02-09 11:38:55.226 28448-28770/br.tv.inaclive.qridpresenca W/System.err:     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:497)
02-09 11:38:55.236 2414-2900/? D/EnterpriseController: mIsMarkChainAdded is 0 mIsBlockChainAdded is 0 netId is 0
02-09 11:38:55.236 2414-2900/? D/Netd: getNetworkForDns: using netid 0 for uid 1000
02-09 11:38:55.236 2839-3134/? D/ConnectivityService: setProvNotificationVisibleIntent: E visible=false networkType=1 extraInfo=null
02-09 11:38:55.236 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: Probably not a portal: exception java.net.UnknownHostException: Unable to resolve host "connectivitycheck.android.com": No address associated with hostname
02-09 11:38:55.236 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: Validated
02-09 11:38:55.236 2839-3134/? V/NetworkStats: updateIfacesLocked()
02-09 11:38:55.236 2839-3134/? V/NetworkStats: performPollLocked(flags=0x1)
02-09 11:38:55.236 2839-3134/? D/NetworkStatsFactory: UpdateStatsForKnox updated
02-09 11:38:55.236 2839-3134/? D/NetworkStatsFactory: UpdateStatsForKnox main else ---
02-09 11:38:55.246 2839-3134/? V/NetworkStats: performPollLocked() took 5ms
02-09 11:38:55.266 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon phoneId =0 dataSub =0
02-09 11:38:55.266 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon( 0 )  GSM :  mMSimState= ABSENT mDataNetType= 0
02-09 11:38:55.266 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon no sim
02-09 11:38:55.276 2839-3212/? V/BroadcastQueue: [background] Process cur broadcast BroadcastRecord{393e1eb4 u0 com.samsung.android.net.wifi.SHOW_NOTI_MESSAGE} DELIVERED for app ProcessRecord{61add 32697:com.android.settings/1000}
02-09 11:38:55.276 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon when mMSimDataConnected[0] =false mMSimMobileActivityIconId[0] = 0
02-09 11:38:55.276 2839-3134/? D/ConnectivityService: getAllNetworkState networkCapability  = [ Transports: WIFI Capabilities: WIFI_P2P&NOT_RESTRICTED&TRUSTED&NOT_VPN LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps]
02-09 11:38:55.276 2839-3134/? D/ConnectivityService: getAllNetworkState networkCapability  = [ Transports: WIFI Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps]
02-09 11:38:55.276 2839-3134/? D/ConnectivityService: notifyType LOST for NetworkAgentInfo [WIFI () - 512]
02-09 11:38:55.276 2839-29229/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: ValidatedState{ when=0 what=532487 target=com.android.internal.util.StateMachine$SmHandler }
02-09 11:38:55.276 2839-3134/? D/ConnectivityService: Checking for replacement network to handle request NetworkRequest [ id=1, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
02-09 11:38:55.276 2839-3130/? D/WIFI_P2P: evalRequest evalRequest  = NetworkRequest [ id=1, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] n.requested= false
02-09 11:38:55.276 2839-3134/? D/CSLegacyTypeTracker: Removing agent NetworkAgentInfo{ ni{[type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: , roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false]}  network{512}  lp{{InterfaceName: wlan0 LinkAddresses: [192.168.0.104/24,fe80::2255:31ff:fe67:b8c8/64,]  Routes: [fe80::/64 -> :: wlan0,192.168.0.0/24 -> 0.0.0.0 wlan0,0.0.0.0/0 -> 192.168.0.1 wlan0,] DnsAddresses: [8.8.8.8,8.8.4.4,] Domains:  MTU: 0 TcpBufferSizes: 524288,1048576,4525824,524288,1048576,4525824}}  nc{[ Transports: WIFI Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps]}  Score{60}  everValidated{true}  lastValidated{true}  created{true}  explicitlySelected{false} }
02-09 11:38:55.276 2839-3134/? D/CSLegacyTypeTracker: Sending disconnected broadcast for type 1 NetworkAgentInfo [WIFI () - 512] isDefaultNetwork=false
02-09 11:38:55.276 2839-3134/? D/ConnectivityService: sendStickyBroadcast: action=android.net.conn.CONNECTIVITY_CHANGE_IMMEDIATE
02-09 11:38:55.276 2839-3131/? D/WIFI: evalRequest evalRequest  = NetworkRequest [ id=1, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] n.requested= true
02-09 11:38:55.286 3214-3214/? D/StatusBar.MSimNetworkController: Nothing final, mRoamingIconId = 0 phoneId : 0
02-09 11:38:55.286 3214-3214/? D/StatusBar.MSimNetworkController: refreshViews connected={ } phoneId = 0 level=4 mMSimcombinedSignalIconId=0x7f020293/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mMSimcombinedActivityIconId=0x0 mAirplaneMode=false mMSimDataActivity=0 mMSimPhoneSignalIconId=0x7f020293/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mMSimDataDirectionIconId=0x0 mMSimDataSignalIconId=0x7f020293 mMSimDataTypeIconId=0x0/(null) mNoMSimIconId=0x7f020088/com.android.systemui:drawable/ic_qs_no_sim mMSimMobileActivityIconId=0x0/(null) mWifiIconId=0x7f0202c8 mBluetoothTetherIconId=0x7f0202b2 mRoamingIconId=0x 0/(null) mSimEnabled=true
02-09 11:38:55.286 3214-3214/? D/STATUSBAR-WifiQuickSettingButton: onWifiSignalChanged enabled=true enabledDesc:null
02-09 11:38:55.286 2839-3134/? D/ConnectivityService: sendStickyBroadcast: action=android.net.conn.CONNECTIVITY_CHANGE
02-09 11:38:55.286 3214-3586/? D/ConnectivityManager.CallbackHandler: CM callback handler got msg 524292
02-09 11:38:55.286 3214-3214/? D/StatusBar.MSimNetworkController: refreshSignalCluster : called
02-09 11:38:55.286 2839-2934/? D/EntConnectivity: Not allowed due to - mEnabled false
02-09 11:38:55.286 2839-2839/? D/Tethering: Tethering got CONNECTIVITY_ACTION_IMMEDIATE
02-09 11:38:55.286 2839-3135/? D/Tethering: MasterInitialState.processMessage what=3
02-09 11:38:55.286 2839-3134/? D/ConnectivityService: setProvNotificationVisibleIntent: E visible=false networkType=0 extraInfo=null
02-09 11:38:55.286 2839-3134/? D/ConnectivityService: nai.networkMonitor.doQuit()
02-09 11:38:55.286 2839-3134/? D/NetworkMonitor/NetworkAgentInfo [WIFI () - 512]: doQuit - quitNow()
02-09 11:38:55.296 32697-32697/? W/ResourcesManager: getTopLevelResources: null for user  0
02-09 11:38:55.296 2839-2934/? D/EntConnectivity: Not allowed due to - mEnabled false
02-09 11:38:55.296 3214-3214/? E/StatusBar.MSimNetworkController: Error : mSimIconId is -1
02-09 11:38:55.316 2839-3129/? D/ConnectivityService: getAllNetworkState networkCapability  = [ Transports: WIFI Capabilities: WIFI_P2P&NOT_RESTRICTED&TRUSTED&NOT_VPN LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps]
02-09 11:38:55.316 3214-3214/? E/StatusBar.MSimNetworkController: Error : mSimIconId is -1
02-09 11:38:55.316 3214-3214/? D/StatusBar.MSimNetworkController: getUpdateDataNetType(): 0
02-09 11:38:55.316 2839-3129/? V/NetworkStats: advisePersistThreshold() given 9223372036854775, clamped to 2097152
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: NoService, mRoamingIconId = 0phoneId : 1
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: updateDataNetType sub = 1 mDataNetType = 0
02-09 11:38:55.326 3214-3214/? E/StatusBar.MSimNetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: isSIMOFFOfSlot simDBvalue0 = 1, simDBvalue1 =1
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: updateZTMDataNetType()
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon mDataNetType= 0
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon phoneId =1 dataSub =0
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon( 1 )  GSM :  mMSimState= ABSENT mDataNetType= 0
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon no sim
02-09 11:38:55.326 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon when mMSimDataConnected[1] =false mMSimMobileActivityIconId[1] = 0
02-09 11:38:55.336 3214-3214/? D/StatusBar.MSimNetworkController: NoService, mRoamingIconId = 0phoneId : 1
02-09 11:38:55.336 3214-3214/? D/StatusBar.MSimNetworkController: isSIMOFFOfSlot simDBvalue0 = 1, simDBvalue1 =1
02-09 11:38:55.336 3214-3214/? D/STATUSBAR-WifiQuickSettingButton: onWifiSignalChanged enabled=true enabledDesc:null
02-09 11:38:55.336 3214-3214/? D/StatusBar.MSimNetworkController: refreshViews connected={ } phoneId = 1 level=0 mMSimcombinedSignalIconId=0x7f020389/com.android.systemui:drawable/tw_stat_sys_signal_null mMSimcombinedActivityIconId=0x0 mAirplaneMode=false mMSimDataActivity=0 mMSimPhoneSignalIconId=0x7f020389/com.android.systemui:drawable/tw_stat_sys_signal_null mMSimDataDirectionIconId=0x0 mMSimDataSignalIconId=0x7f020389 mMSimDataTypeIconId=0x0/(null) mNoMSimIconId=0x7f020088/com.android.systemui:drawable/ic_qs_no_sim mMSimMobileActivityIconId=0x0/(null) mWifiIconId=0x7f0202c8 mBluetoothTetherIconId=0x7f0202b2 mRoamingIconId=0x 0/(null) mSimEnabled=false
02-09 11:38:55.336 32697-32697/? W/ResourcesManager: Asset path '/system/framework/sec_platform_library.jar' does not exist or contains no resources.
02-09 11:38:55.336 32697-32697/? W/ResourcesManager: Asset path '/system/framework/com.google.android.maps.jar' does not exist or contains no resources.
02-09 11:38:55.336 3214-3214/? D/StatusBar.MSimNetworkController: updateConnectivity: intent=Intent { act=android.net.conn.CONNECTIVITY_CHANGE_IMMEDIATE flg=0x4000010 (has extras) }
02-09 11:38:55.336 32697-32697/? W/ResourcesManager: Asset path '/system/framework/twframework.jar' does not exist or contains no resources.
02-09 11:38:55.336 32697-32697/? W/ResourcesManager: Asset path '/system/framework/com.broadcom.bt.jar' does not exist or contains no resources.
02-09 11:38:55.336 3214-3214/? D/StatusBar.MSimNetworkController: getUpdateDataNetType(): 0
02-09 11:38:55.336 3214-3214/? D/StatusBar.MSimNetworkController: updateConnectivity: networkInfo=null
02-09 11:38:55.336 3214-3214/? D/StatusBar.MSimNetworkController: updateConnectivity: connectionStatus=0
02-09 11:38:55.346 3214-3214/? D/StatusBar.MSimNetworkController: updateDataNetType sub = 0 mDataNetType = 0
02-09 11:38:55.346 3214-3214/? E/StatusBar.MSimNetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN
02-09 11:38:55.346 3214-3214/? D/StatusBar.MSimNetworkController: Nothing final, mRoamingIconId = 0 phoneId : 0
02-09 11:38:55.346 3214-3214/? D/StatusBar.MSimNetworkController: updateZTMDataNetType()
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon mDataNetType= 0
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon phoneId =0 dataSub =0
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon( 0 )  GSM :  mMSimState= ABSENT mDataNetType= 0
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon no sim
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateDataIcon when mMSimDataConnected[0] =false mMSimMobileActivityIconId[0] = 0
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateTelephonySignalStrength: phoneId =0
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: getNumberOfActiveSim:1
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateTelephonySignalStrength iconLevel = 4 mInetCondition = 0
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: getPhoneSignalIconList: mMaxLevelOfSignalStrengthIndicator = 4 inetCondition = 0
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: updateTelephonySignalStrength: iconLevel=4
02-09 11:38:55.356 3214-3214/? D/StatusBar.MSimNetworkController: getUpdateDataNetType(): 0
02-09 11:38:55.366 3214-3214/? D/StatusBar.MSimNetworkController: NoService, mRoamingIconId = 0phoneId : 1
02-09 11:38:55.366 3214-3214/? D/StatusBar.MSimNetworkController: updateDataNetType sub = 1 mDataNetType = 0
02-09 11:38:55.366 3214-3214/? E/StatusBar.MSimNetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN
02-09 11:38:55.366 3214-3214/? D/StatusBar.MSimNetworkController: isSIMOFFOfSlot simDBvalue0 = 1, simDBvalue1 =1
02-09 11:38:55.366 3214-3214/? D/StatusBar.MSimNetworkController: updateZTMDataNetType()

答: Well since BLE and WiFi shares the same radio, and the only scan parameters you can use in KitKat is 100% duty, it's not that strange you see decreased WiFi performance. Try a newer phone which might have a smarter scheduler that divides BLE time and WiFi time for the radio better. With Lollipop and forward you can also change the scan window to a more restrictive one with the new BluetoothLeScanner API (https://developer.android.com/reference/android/bluetooth/le/ScanSettings.html#SCAN_MODE_LOW_POWER).</p>


来源: stackexchange

问:
Cannot do source-level debugging on running DLL
I am trying to debug my DLL Class Library on Windows, but I am not able to get the debugger to stop in the source code.

Environment: Windows 10 Pro x64, Visual Studio Premium 2013 Update 5. Project is a .NET 4.5 Class Library. The executable is actually instantiated by another .exe before it calls my .dll. (I don't have source access to either of these .exes.) The .dll is in the same dir as its calling .exe, but that is not the Class Library project directory. I know my .dll code is executing, as I create new windows in my code, which are opening.

I have tried Debug->Attach to Process... in VS2013, and I connect to the calling .exe process, but the breakpoint I have set in my code never is hit, despite that code definitely being called. What am I missing here?

EDIT: This is not a duplicate of another question:

Not getting any error message

Not intermittently working

The assembly is confirmed as being loaded and executed

答: Your assembly might be compiled for release or compiled without any debug info. If you do things correctly, you should be able to debug by attaching to process. Another thing that can be, your code executes before you can attach to it. sometimes, especially in services, you put thread.Sleep into code, so this buys you some time to attach.

ContentLicense: CC BY-SA 3.0


问:
obtain a Google OAuth 2.0 Bearer token from a client and secret
I have a client id and client secret for my Google Container Engine app obtained via Credentials and I just want to do some local testing of the JSON API endpoints.

How can I convert this into a Bearer token so that I can just get some work done? Is there a Google page where I provide these things and get a token that I can use in my app?

I don't want to have to write an entire OAuth handling mechanism at this point in time (which would use the flow described in oauthplayground). It's an app to be run only for my account, in headless mode, on a trusted machine, to manage my cluster.

NOTE: must not require any proprietary software installations (e.g. the Google SDK).

答:
I have a client id and client secret for my Google Container Engine app obtained via Credentials and I just want to do some local testing of the JSON API endpoints.

Good start. I guess by "the JSON API endpoints" you mean the Google APIS. Make sure you created OAuth Client IDs and not one of the other options.

How can I convert this into a Bearer token so that I can just get some work done? Is there a Google page where I provide these things and get a token that I can use in my app?

Yes the OAuth Playground will do that for you. The detailed steps and sample code to consume the token is at How do I authorise an app (web or installed) without user intervention? (canonical ?)

I don't want to have to write an entire OAuth handling mechanism at this point in time (which would use the flow described in oauthplayground).

Follow the steps linked to above and you will see that you don't need to write any code at all. Once you have the refresh token (a one time procedure), you're all set. I exaggerate slightly, you do need one line of code to post the refresh token to the Google Oauth endpoint to fetch an access token. See the bottom of the linked answer for an example. Or you could just compose a curl to do it from the command line and put the Access Token into an environment variable.

I just wanted to avoid the whole thing and get a code printed on the screen

A bit like https://youtu.be/hfWe1gPCnzc?t=198


问:
How to independently use single Zend Framework component like XML-RPC or REST?
Zend framework is well known for loosely coupled components.

I would like to use XML-RPC from zend framework, is there any dependency for XML-RPC? Like if I had taken out XML-RPC folder off Zend Framework Library and try to instantiate RPC object, would it throw error?

Where can I find the proper way of separating component from the framework?

Thanks

答: You should literally be able to copy the XmlRpc folder from your copy of Zend Framework and use it in your own projects. The only dependency that I can see is in XmlRpc/Exception.php as it requires a file in the root directory of Zend/ (Exception.php) you could simply copy this file along with the XmlRpc folder keeping the directory structure the same and it should work....</p>

ContentLicense: CC BY-SA 2.5


问:
Enter export password to generate a P12 certificate
I would like to generate a P12 certificate from a .key and .pem.
I'm running this command and get prompted to enter a export password:

```<code>pkcs12 -export -inkey private-key.key -in developer_identity.pem -out iphone_dev.p12
</code>```

I can't enter a password at this point, it seems that the keyboard input is not recognized.

What do I miss? (I'm new to the Command Line tool and openSSL)

答:
I know this thread has been idle for a while, but I just wanted to add my two cents to supplement jariq's comment...

Per manual, you don't necessary want to use -password option.

Let's say mykey.key has a password and your want to protect iphone-dev.p12 with another password, this is what you'd use:

```<code>pkcs12 -export -inkey mykey.key -in developer_identity.pem -out iphone_dev.p12 -passin pass:password_for_mykey -passout pass:password_for_iphone_dev
</code>```

Have fun scripting!!

ContentLicense: CC BY-SA 4.0

Body:
I would like to generate a P12 certificate from a .key and .pem.
I'm running this command and get prompted to enter a export password:

pkcs12 -export -inkey private-key.key -in developer_identity.pem -out iphone_dev.p12

I can't enter a password at this point, it seems that the keyboard input is not recognized.

What do I miss? (I'm new to the Command Line tool and openSSL)

Body:
I know this thread has been idle for a while, but I just wanted to add my two cents to supplement jariq's comment...

Per manual, you don't necessary want to use -password option.

Let's say mykey.key has a password and your want to protect iphone-dev.p12 with another password, this is what you'd use:

pkcs12 -export -inkey mykey.key -in developer_identity.pem -out iphone_dev.p12 -passin pass:password_for_mykey -passout pass:password_for_iphone_dev

Have fun scripting!!


问:
Three.js: ExtrudeGeometry: Problems setting different material for front and back side
I'm creating an ExtrudeGeometry of a hexagon shape and trying to set a different material for the front side and back side, as it is stated in this thread.

```<code>let shape = new THREE.Shape();
/*...*/

let geometry = new THREE.ExtrudeGeometry(shape, {
    steps: 2,
    amount: 0.05,
    bevelEnabled: false,
    material: 0,                //frontMaterial = green
    extrudeMaterial: 1          //sideMaterial  = gray
});

//Searching for the back side and setting the marialIndex accordingly
for (let face of geometry.faces) {
    if (face.normal.z == 1) {
        face.materialIndex = 2; //backMaterial  = red
    }
}

let mesh = new THREE.Mesh(geometry, new THREE.MultiMaterial([frontMaterial, sideMaterial, backMaterial]));
</code>```

The problem now is, that this method (iterating over the faces and looking for those with normal.z == 1) does not work correctly with a extrudeGeometry.amount = 0.05. A value of 0.1 works fine.

See this jsfiddle

Is there another method for setting a different material for front and back side or am I doing it just wrong?

Thanks for your help!

答:
The problem is due to rounding. Do this, instead

```<code>if ( face.normal.z < - 0.99999 ) { // instead of == - 1

    face.materialIndex = 2;

}
</code>```

Also, the back face normal is in theory (0, 0, - 1 ).

updated fiddle: https://jsfiddle.net/xhbu2e01/3/

three.js r.84

Body:
I'm creating an ExtrudeGeometry of a hexagon shape and trying to set a different material for the front side and back side, as it is stated in this thread.

let shape = new THREE.Shape();
/*...*/

let geometry = new THREE.ExtrudeGeometry(shape, {
    steps: 2,
    amount: 0.05,
    bevelEnabled: false,
    material: 0,                //frontMaterial = green
    extrudeMaterial: 1          //sideMaterial  = gray
});

//Searching for the back side and setting the marialIndex accordingly
for (let face of geometry.faces) {
    if (face.normal.z == 1) {
        face.materialIndex = 2; //backMaterial  = red
    }
}

let mesh = new THREE.Mesh(geometry, new THREE.MultiMaterial([frontMaterial, sideMaterial, backMaterial]));

The problem now is, that this method (iterating over the faces and looking for those with normal.z == 1) does not work correctly with a extrudeGeometry.amount = 0.05. A value of 0.1 works fine.

See this jsfiddle

Is there another method for setting a different material for front and back side or am I doing it just wrong?

Thanks for your help!

Body:
The problem is due to rounding. Do this, instead

if ( face.normal.z < - 0.99999 ) { // instead of == - 1

    face.materialIndex = 2;

}

Also, the back face normal is in theory (0, 0, - 1 ).

updated fiddle: https://jsfiddle.net/xhbu2e01/3/

three.js r.84


问:
Merging two ul menus that contain child ul with jQuery
I'm trying to merge two unordered lists using jQuery. The second list contains child lists. How would I go about doing this? My HTML looks like this.

```<code><ul class="Menu A">
    <li><a href="#">Item One</a></li>
    <li><a href="#">Item Two</a></li>
    <li><a href="#">Item Three</a></li>
    <li><a href="#">Item Four</a></li>
</ul>

<ul class="Menu B">
    <li><a href="#">Item A</a></li>
    <li><a href="#">Item B</a>
        <ul class="childMenu">
            <li><a href="#">Item B1</a></li>
            <li><a href="#">Item B2</a></li>
            <li><a href="#">Item B3</a></li>
            <li><a href="#">Item B4</a></li>
        </ul>
    </li>
    <li><a href="#">Item C</a></li>
    <li><a href="#">Item D</a></li>
</ul>
</code>```

I tried the solution here merge 2 separate menus into a single menu but it won't work for child lists.

答:
You need to listen to see if there is a child item for every this element in your each statement.

var my_merged_list = "";
$('ul li').each(function() {
  var count = $(this).find('ul').length;
  var ll = $(this).find('a:first').text();
  ll = "" + ll + "";
  my_merged_list = my_merged_list + "
" + ll + "
";
});
$('ul').remove();
$('body').append('
' + my_merged_list + '
');```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<ul class="Menu A">
  <li>Item One</li>
  <li>Item Two</li>
  <li>Item Three</li>
  <li>Item Four</li>
</ul>

<ul class="Menu B">
  <li>Item A</li>
  <li>Item B
    <ul class="childMenu">
      <li>Item B1</li>
      <li>Item B2</li>
      <li>Item B3</li>
      <li>Item B4</li>
    </ul>
  </li>
  <li>Item C</li>
  <li>Item D</li>
</ul></code>```

Body:
I'm trying to merge two unordered lists using jQuery. The second list contains child lists. How would I go about doing this? My HTML looks like this.

Item One

Item Two

Item Three

Item Four

Item A

Item B

Item B1

Item B2

Item B3

Item B4

Item C

Item D

I tried the solution here merge 2 separate menus into a single menu but it won't work for child lists.

Body:
You need to listen to see if there is a child item for every this element in your each statement.

var my_merged_list = "";
$('ul li').each(function() {
  var count = $(this).find('ul').length;
  var ll = $(this).find('a:first').text();
  ll = "<a href='#'>" + ll + "</a>";
  my_merged_list = my_merged_list + "<li>" + ll + "</li>";
});
$('ul').remove();
$('body').append('<ul>' + my_merged_list + '</ul>');

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<ul class="Menu A">
  <li><a href="#">Item One</a></li>
  <li><a href="#">Item Two</a></li>
  <li><a href="#">Item Three</a></li>
  <li><a href="#">Item Four</a></li>
</ul>

<ul class="Menu B">
  <li><a href="#">Item A</a></li>
  <li><a href="#">Item B</a>
    <ul class="childMenu">
      <li><a href="#">Item B1</a></li>
      <li><a href="#">Item B2</a></li>
      <li><a href="#">Item B3</a></li>
      <li><a href="#">Item B4</a></li>
    </ul>
  </li>
  <li><a href="#">Item C</a></li>
  <li><a href="#">Item D</a></li>
</ul>


问:
limited text chunks splitted by new line
I have string in python containing a large text file (over 1MiB).
I need to split it to chunks.

Constrains:

chunks can be splited only by newline character, and

len(chunk) must be as big as possbile but smaller than LIMIT (i.e. 100KiB)

Lines longer than LIMIT can be ommited.

Any idea how to implement this nicely in python?

Thank you in advance.

答:
Following the suggestion of Linuxios you could use rfind to find the last newline within the limit and split at this point. If no newline character is found the chunk is too large and can be dismissed.

```<code>chunks = []

not_chunked_text = input_text

while not_chunked_text:
    if len(not_chunked_text) <= LIMIT:
        chunks.append(not_chunked_text)
        break
    split_index = not_chunked_text.rfind("\n", 0, LIMIT)
    if split_index == -1:
        # The chunk is too big, so everything until the next newline is deleted
        try:
            not_chunked_text = not_chunked_text.split("\n", 1)[1]
        except IndexError:
            # No "\n" in not_chunked_text, i.e. the end of the input text was reached
            break
    else:
        chunks.append(not_chunked_text[:split_index+1])
        not_chunked_text = not_chunked_text[split_index+1:]
</code>```

rfind("\n", 0, LIMIT) returns the highest index where a newline character was found within the bounds of your LIMIT.

not_chunked_text[:split_index+1] is needed so that the newline character is included in the chunk

I interpreted the LIMIT as the biggest length of a chunk that is allowed. If a chunk with the length of LIMIT should not be allowed you have to add a -1 after ever LIMIT in this code.

Body:
Following the suggestion of Linuxios you could use rfind to find the last newline within the limit and split at this point. If no newline character is found the chunk is too large and can be dismissed.

chunks = []

not_chunked_text = input_text

while not_chunked_text:
    if len(not_chunked_text) <= LIMIT:
        chunks.append(not_chunked_text)
        break
    split_index = not_chunked_text.rfind("\n", 0, LIMIT)
    if split_index == -1:
        # The chunk is too big, so everything until the next newline is deleted
        try:
            not_chunked_text = not_chunked_text.split("\n", 1)[1]
        except IndexError:
            # No "\n" in not_chunked_text, i.e. the end of the input text was reached
            break
    else:
        chunks.append(not_chunked_text[:split_index+1])
        not_chunked_text = not_chunked_text[split_index+1:]

rfind("\n", 0, LIMIT) returns the highest index where a newline character was found within the bounds of your LIMIT.

not_chunked_text[:split_index+1] is needed so that the newline character is included in the chunk

I interpreted the LIMIT as the biggest length of a chunk that is allowed. If a chunk with the length of LIMIT should not be allowed you have to add a -1 after ever LIMIT in this code.


问:
Best Practice to generate uuid ? php OR MySql
What is the best practices to generate UUID (PRIMARY KEY)
let it generate at Mysql end OR
let it generate at PHP end

doing some performances test i find generating it at php end is a bit faster

but doing some Google i find many are practicing it to generate at MySQL end
http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram

so what would be the right way to do so for an continuously growing data ?

答: Using native database UUID functions will probably cause problems if the database is replicated.  At the same time I would confirm that any pre-written UUID generators used be tested to confirm the that the least significant byte of the UUID changes faster than most significant byte (to accommodate database index clustering).</p>


问:
npm babel ES2015: Getting command lines in the converted/output JS file
I've installed npm (v4.4.4) and babel (v6.24.0) and babel preset 2015.
All running OK when converting ES6 JS to ES5...except a couple of oddities. Maybe someone can see what this newbie is doing wrong.

1) I run babel from npm (see below) which runs OK. I added some script entries into package.JSON to make it work.
But, UNWANTED oddity...npm inserts the commands into the output JS file. (See below) Is there an npm option to say, don't put the command in the output file.

Yet....if I copy input.JS to the folder with babel.cmd and run it there, I get a clean output.JS. So it looks like npm is inserting the command lines into the output.js file.
How do I prevent the npm commands being written to output.js. (Obviously I don't want to have my JS files having to share a folder with the .bin files)

2) When I type > babel on the command line in my project folder, I get:
babel: not a command.

I EXPECT THIS. After all, I have not added node_modules/.bin to my PATH env var. Yet every YouTube video I watch about npm and babel, it works. How? No one seems to edit the PATH env var. Am I missing something?

Thanks
Milton.

INPUT JS FILE (input.js)

```<code>class House {
constructor(v) {
        this.name = v;
}
}
</code>```

OUTPUT JS (TRANSPILED) FILE (output.js) Note 1st 2 lines below...

```<code>> milton@1.0.0 babel C:\Projects1\01InstallReact4Dev
> babel.cmd "--presets" "es2015" "input.js"

"use strict";

function _classCallCheck(instance, Constructor)
{ if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var House = function House(v) {
  _classCallCheck(this, House);
  this.name = v;
};
</code>```

PACKAGE.JSON

```<code>"scripts": {
"babel": "babel.cmd",
"babelv": "babel.cmd -V",
"babelh": "babel.cmd -help"
}
</code>```

COMMAND

```<code>> npm run babel -- --presets es2015 input.js > output.js
</code>```

Thanks Again.
Milton.

答:
You're redirecting the output of stdout to the file output.js, this includes everything that is displayed. Instead of using the stdout output of babel you can use the --out-file or -o option. This will write the output to the specified file instead of printing it to stdout (see Compile Files).

Your command would be:

```<code>npm run babel -- --presets es2015 input.js --out-file output.js
</code>```

When I type > babel on the command line in my project folder, I get: babel: not a command.

You don't have node_modules/.bin/ in your shells PATH. You could add it or run it directly with ./node_modules/.bin/babel. But this is not necessary if you do it in an npm script, because npm will automatically look into node_modules/.bin/ without it being in your PATH. In this case you could define the following script:

```<code>"scripts": {
  "build": "babel --presets es2015 input.js --out-file output.js"
}
</code>```

And then you can simply run:

```<code>npm run build
</code>```

If you'd like to transpile more than one file you should use --out-dir instead of --out-file otherwise they will be concatenated into one file. See also Compile Directories

Body:
I've installed npm (v4.4.4) and babel (v6.24.0) and babel preset 2015.
All running OK when converting ES6 JS to ES5...except a couple of oddities. Maybe someone can see what this newbie is doing wrong.

1) I run babel from npm (see below) which runs OK. I added some script entries into package.JSON to make it work.
But, UNWANTED oddity...npm inserts the commands into the output JS file. (See below) Is there an npm option to say, don't put the command in the output file.

Yet....if I copy input.JS to the folder with babel.cmd and run it there, I get a clean output.JS. So it looks like npm is inserting the command lines into the output.js file.
How do I prevent the npm commands being written to output.js. (Obviously I don't want to have my JS files having to share a folder with the .bin files)

2) When I type > babel on the command line in my project folder, I get:
babel: not a command.

I EXPECT THIS. After all, I have not added node_modules/.bin to my PATH env var. Yet every YouTube video I watch about npm and babel, it works. How? No one seems to edit the PATH env var. Am I missing something?

Thanks
Milton.

INPUT JS FILE (input.js)

class House {
constructor(v) {
        this.name = v;
}
}

OUTPUT JS (TRANSPILED) FILE (output.js) Note 1st 2 lines below...

> milton@1.0.0 babel C:\Projects1\01InstallReact4Dev
> babel.cmd "--presets" "es2015" "input.js"

"use strict";

function _classCallCheck(instance, Constructor)
{ if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var House = function House(v) {
  _classCallCheck(this, House);
  this.name = v;
};

PACKAGE.JSON

"scripts": {
"babel": "babel.cmd",
"babelv": "babel.cmd -V",
"babelh": "babel.cmd -help"
}

COMMAND

> npm run babel -- --presets es2015 input.js > output.js

Thanks Again.
Milton.

Body:
You're redirecting the output of stdout to the file output.js, this includes everything that is displayed. Instead of using the stdout output of babel you can use the --out-file or -o option. This will write the output to the specified file instead of printing it to stdout (see Compile Files).

Your command would be:

npm run babel -- --presets es2015 input.js --out-file output.js

When I type > babel on the command line in my project folder, I get: babel: not a command.

You don't have node_modules/.bin/ in your shells PATH. You could add it or run it directly with ./node_modules/.bin/babel. But this is not necessary if you do it in an npm script, because npm will automatically look into node_modules/.bin/ without it being in your PATH. In this case you could define the following script:

"scripts": {
  "build": "babel --presets es2015 input.js --out-file output.js"
}

And then you can simply run:

npm run build

If you'd like to transpile more than one file you should use --out-dir instead of --out-file otherwise they will be concatenated into one file. See also Compile Directories


问:
php artisan: Call to undefined function App\Http\Services\mcrypt_get_block_size()
I have checked for this solution on other threads but no solution yet. This scenario is different from the ones i saw so hopefully i would get a solution and not marked as a repeat question.

I cloned a laravel5.3 app and ran the necessary migrations and all that good stuff to set it up.
The task is now to run a custom artisan command. Running that i get this mcrypt error

First thing i did was to install mcrypt extension using brew

```<code>brew install mcrypt php70-mcrypt
</code>```

Then i added extension=mcrypt.so to my php.ini file

From the command line i typed php --ini and got

I can see the loaded configuration file. That was where the extension=mcrypt.so was added. I am using homestead so i ran vagrant halt and then vagrant up.

With all these done, i have mcrypt installed with brew, the extension added to php.ini file and restarted vagrant - all these i saw on other threads but none of these worked for me.

Any ideas how i could make this work? Thanks

答:
the code is trying to call the current namespace's mcrypt_get_block_size, you probably meant the global namespace's mcrypt_get_block_size , which you can access by prepending \  to it, so it looks like \mcrypt_get_block_size(?)

this question gotta be a duplicate though, probably

Body:
I have checked for this solution on other threads but no solution yet. This scenario is different from the ones i saw so hopefully i would get a solution and not marked as a repeat question.

I cloned a laravel5.3 app and ran the necessary migrations and all that good stuff to set it up.
The task is now to run a custom artisan command. Running that i get this mcrypt error

First thing i did was to install mcrypt extension using brew

brew install mcrypt php70-mcrypt

Then i added extension=mcrypt.so to my php.ini file

From the command line i typed php --ini and got

I can see the loaded configuration file. That was where the extension=mcrypt.so was added. I am using homestead so i ran vagrant halt and then vagrant up.

With all these done, i have mcrypt installed with brew, the extension added to php.ini file and restarted vagrant - all these i saw on other threads but none of these worked for me.

Any ideas how i could make this work? Thanks


问:
Login to the API manager through Eclipse Developer Tools
I'm unable to connect to the API Manager when using Developer Tools for WSO2. I'm following the instructions on this page. When I try to log in to the publisher I get this error

When I try connecting to the publisher through port 9443 I get this error.

The environment I'm running is APIM 2.1.0 with the IDS 5.3.0 as key manager. I'm using a clustered environment as well with two gateway workers and the gate manager on the APIM side. Then two IDS servers.

I'm trying to connect from my Windows device, so I'm not on the actual Linux server. Also, I have a secondary user store added and when I login to the store and publisher I use those credentials. I tried both my secondary user store credentials and the admin credentials both return same error.

What are some possible fixes I can do? Or I'm I off with some configurations?

答: I had to download a fresh installation of Eclipse IDE for Java EE Developers (Mars 2). Then added the plugins manually from http://product-dist.wso2.com/p2/developer-studio-kernel/4.1.0/apim-tools/releases/2.0.0/ repo. I originally had the eclipse download from the wso2 website http://wso2.com/products/developer-studio/. I thought that it had all the right plugins, but I guess there is something missing in it.</p>


问:
How can i hide the status bar in the browser?
I have a simple question, how can I hide a link in the status bar in my browser.

I've tried with this:

```<code><a href="http://www.sell.com/?referrer=225"
   onMouseOver="window.status='http://www.sell.com';
               return true" onMouseOut="window.status=''">Click here</a>
</code>```

(Taken from a tutorial)
But it doesn't work, if somebody would help me, I would be very happy! ;-)

答: You can't (at least in current browsers), which is a good thing.  It would help phishing attacks a great deal to disguise the link.</p>

Body:
I have a simple question, how can I hide a link in the status bar in my browser.

I've tried with this:

Click here

(Taken from a tutorial)
But it doesn't work, if somebody would help me, I would be very happy! ;-)


问:
best practice to backup config files Jenkins
I am using Jenkins on remote Debian 7.8 . I want to update Debian 7.8 to 8.7. I tried to update and it went fine however Jenkins was broken and could not start the service. I tried everything but could find any solution. Finally I used purged command and it deleted previous configurations and builds.

Now I restore the server and want to update again but I want a complete Jenkins backup of config  and builds so restore it from last running instance.

What's the best practice to backup the configs as simple as possible (with less effort and problems) and configure and then merge the backuped files.

Which data / config files I have to backup?

答:
I'd suggest using the ThinBackup plugin. https://wiki.jenkins-ci.org/display/JENKINS/thinBackup

You can set it to run on a schedule using standard cron notation. There's a few configuration options, depending how extensive (large) you want your backup to be.


问:
Romanian diacritics in database
I'm inputting Romanian diacritics in some of my database fields and they are not showing up as expected.

Romanian diacritics are: Ă ă Â â Î î Ș ș Ț ț

The whole line above displays as: Ä‚ Äƒ Ã‚ Ã¢ ÃŽ Ã® È˜ È™ Èš È›

When I save a word containing ã it displays as Ã£

I'd like to know what collation should I set for the table for this to work

or

just stop using them all together and just save them as normal letters when they are inputed, in which case:

Inputing

ã would get saved as a

â would get saved as a

î would get saved as i

ș would get saved as s

ț would get saved as t

Any thoughts? I've tried setting multiple utf-8 as collation for the table, including utf_8_unicode_ci, as well as latin1 but that doesn't solve the problem.

Current collation set for the tables in question is utf_8_general_ci

Using MysQL.

Please do let me know in a comment if I left anything out and you require more details

答:
"ã it displays as Ã£" -- That's Mojibake; see Trouble with utf8 characters; what I see is not what I stored

Mojibake is a common problem; utf16 is not the solution.  (It may have accidentally worked.)

Title: Romanian diacritics in database