text:
Q: DHCP renew fail - internet drops every 2 hours Every 2nd hour all workstations lose internet connection for 10 seconds. The ISP tech support seems to be reluctant to resolve the issue so I am trying to fix it myself. Here is a diagram of our network:

I wrote a shell script to log the dropouts. The script (on a remote server) pings our external IP address every second and logs the periods where pings fail. Here is an excerpt from the log:
=======================================
Failure Start           Length
=======================================
2016-08-16 17:52:11     10 sec
2016-08-16 19:52:23     10 sec
2016-08-16 21:52:34     10 sec
2016-08-17 23:52:46     10 sec

Also, here is an excerpt from the router log:
50 2016-08-16 17:29:03 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
51 2016-08-16 17:31:07 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
52 2016-08-16 17:33:11 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
53 2016-08-16 17:35:15 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
54 2016-08-16 17:36:51 <5> : WAN1:DHCP lease timeout, beging a new one.
55 2016-08-16 17:38:51 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
56 2016-08-16 17:40:55 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
57 2016-08-16 17:42:59 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
58 2016-08-16 17:45:03 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
59 2016-08-16 17:47:07 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
60 2016-08-16 17:49:11 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
61 2016-08-16 17:51:15 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
62 2016-08-16 17:51:51 <5> : WAN1:DHCP renew fail, begin a new discovery.
63 2016-08-16 17:52:02 <5> : WAN1:DHCP getting IP succeeded, and IP addr:XX.XX.XX.97, mask:255.255.254.0, gateway:XX.XX.XX.1.
64 2016-08-16 18:54:06 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
65 2016-08-16 18:56:10 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
66 2016-08-16 18:58:14 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
67 2016-08-16 19:00:18 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
68 2016-08-16 19:02:22 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
69 2016-08-16 19:04:26 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
70 2016-08-16 19:06:30 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
71 2016-08-16 19:08:34 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
72 2016-08-16 19:10:38 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
73 2016-08-16 19:12:42 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
74 2016-08-16 19:14:46 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
75 2016-08-16 19:16:50 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
76 2016-08-16 19:18:54 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
77 2016-08-16 19:20:58 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
78 2016-08-16 19:23:02 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
79 2016-08-16 19:25:06 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
80 2016-08-16 19:27:10 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
81 2016-08-16 19:29:14 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
82 2016-08-16 19:31:18 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
83 2016-08-16 19:33:22 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
84 2016-08-16 19:35:26 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
85 2016-08-16 19:37:02 <5> : WAN1:DHCP lease timeout, beging a new one.
86 2016-08-16 19:39:02 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
87 2016-08-16 19:41:07 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
88 2016-08-16 19:43:10 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
89 2016-08-16 19:45:14 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
90 2016-08-16 19:47:19 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
91 2016-08-16 19:49:22 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
92 2016-08-16 19:51:26 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
93 2016-08-16 19:52:02 <5> : WAN1:DHCP renew fail, begin a new discovery.
94 2016-08-16 19:52:14 <5> : WAN1:DHCP getting IP succeeded, and IP addr:XX.XX.XX.97, mask:255.255.254.0, gateway:XX.XX.XX.1.
95 2016-08-16 20:54:18 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
96 2016-08-16 20:56:22 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
97 2016-08-16 20:58:26 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
98 2016-08-16 21:00:30 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
99 2016-08-16 21:02:33 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
100 2016-08-16 21:04:37 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
101 2016-08-16 21:06:41 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
102 2016-08-16 21:08:46 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
103 2016-08-16 21:10:50 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
104 2016-08-16 21:12:54 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
105 2016-08-16 21:14:58 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
106 2016-08-16 21:17:02 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
107 2016-08-16 21:19:06 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
108 2016-08-16 21:21:09 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
109 2016-08-16 21:23:14 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
110 2016-08-16 21:25:17 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
111 2016-08-16 21:27:22 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
112 2016-08-16 21:29:26 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
113 2016-08-16 21:31:30 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
114 2016-08-16 21:33:34 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
115 2016-08-16 21:35:38 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
116 2016-08-16 21:37:14 <5> : WAN1:DHCP lease timeout, beging a new one.
117 2016-08-16 21:39:14 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
118 2016-08-16 21:41:18 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
119 2016-08-16 21:43:22 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
120 2016-08-16 21:45:26 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
121 2016-08-16 21:47:30 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
122 2016-08-16 21:49:34 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
123 2016-08-16 21:51:38 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
124 2016-08-16 21:52:14 <5> : WAN1:DHCP renew fail, begin a new discovery.
125 2016-08-16 21:52:25 <5> : WAN1:DHCP getting IP succeeded, and IP addr:XX.XX.XX.97, mask:255.255.254.0, gateway:XX.XX.XX.1.
126 2016-08-16 22:54:29 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
127 2016-08-16 22:56:33 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
128 2016-08-16 22:58:37 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
129 2016-08-16 23:00:41 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
130 2016-08-16 23:02:45 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
131 2016-08-16 23:04:49 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
132 2016-08-16 23:06:54 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
133 2016-08-16 23:08:58 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
134 2016-08-16 23:11:02 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
135 2016-08-16 23:13:05 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
136 2016-08-16 23:15:09 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
137 2016-08-16 23:17:13 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
138 2016-08-16 23:19:17 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
139 2016-08-16 23:21:21 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
140 2016-08-16 23:23:26 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
141 2016-08-16 23:25:30 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
142 2016-08-16 23:27:34 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
143 2016-08-16 23:29:38 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
144 2016-08-16 23:31:42 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
145 2016-08-16 23:33:46 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
146 2016-08-16 23:35:50 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
147 2016-08-16 23:37:25 <5> : WAN1:DHCP lease timeout, beging a new one.
148 2016-08-16 23:39:25 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
149 2016-08-16 23:41:29 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
150 2016-08-16 23:43:33 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
151 2016-08-16 23:45:37 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
152 2016-08-16 23:47:41 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
153 2016-08-16 23:49:45 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
154 2016-08-16 23:51:49 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
155 2016-08-16 23:52:25 <5> : WAN1:DHCP renew fail, begin a new discovery.
156 2016-08-16 23:52:37 <5> : WAN1:DHCP getting IP succeeded, and IP addr:XX.XX.XX.97, mask:255.255.254.0, gateway:XX.XX.XX.1.
157 2016-08-17 00:54:42 <5> : WAN1:DHCP send DHCP-REQUEST timeout.
158 2016-08-17 00:56:46 <5> : WAN1:DHCP send DHCP-REQUEST timeout.

Each time we get a dropout the router logs "DHCP renew fail" and "DHCP getting IP succeeded". What could be the issue? Does it have to do with lease time of the external IP address?
Also what are all these "DHCP send DHCP-REQUEST timeout" logs?
Thanks!

A: Looks like your ISP network admin has a broken config on DHCP.  Standard setup for DHCP client is to call in when lease is half over to renew, and to keep trying until renewal takes place.  The log tells me that your ISP has a 2 hour lease.  But the halfway renewal is failing.  Possibly blocked.
I also see that DHCP discovery is working, DHCP renew is not.
Keep after them.  I suspect they have an opening for network administrator and someone else is trying to fill the role.  Or they have a new one who is inexperienced.  Read up on the DHCP RFC, and get on the phone with their support tech.


text:
Q: After changing the version to Androidx, it does not become mqtt connect After changing version to Androidx and can not connect to mqtt server.
It worked well in other versions than Androidx.
Is this a version problem?
My source code and build information is on the link->  I added it when I made the project. AndroidX Artifact has not been mqt communication since then. What is the problem?
My error Logs↓
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.adfdffffaaaaaaa, PID: 28371
java.lang.NoClassDefFoundError: Failed resolution of:
Landroidx/localbroadcastmanager/content/LocalBroadcastManager;
    at
org.eclipse.paho.android.service.MqttAndroidClient.registerReceiver(MqttAndroidClient.java:450)
    at org.eclipse.paho.android.service.MqttAndroidClient.connect(MqttAndroidClient.java:428)
    at org.eclipse.paho.android.service.MqttAndroidClient.connect(MqttAndroidClient.java:358)
    at org.eclipse.paho.android.service.MqttAndroidClient.connect(MqttAndroidClient.java:313)
    at com.example.adfdffffaaaaaaa.MqttKt.connect(Mqtt.kt:15)
    at com.example.adfdffffaaaaaaa.MainActivity.onCreate(MainActivity.kt:12)
    at android.app.Activity.performCreate(Activity.java:7159)
    at android.app.Activity.performCreate(Activity.java:7150)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3001)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3156)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at
android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1864)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:205)
    at android.app.ActivityThread.main(ActivityThread.java:6993)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)
 Caused by: java.lang.ClassNotFoundException: Didn't find class
"androidx.localbroadcastmanager.content.LocalBroadcastManager" on path: DexPathList[[zip file
"/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/base.apk", zip file
"/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_dependencies_apk.apk", zip
file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_resources_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_0_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_1_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_2_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_3_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_4_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_5_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_6_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_7_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_8_apk.apk",
zip file "/data/app/com.example.adfdffffaaaaaaa-
anRxYlYVlgY0rXwazlHcYg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=
[/data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/lib/arm64, /system/lib64,
/system/product/lib64, /system/vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at
 org.eclipse.paho.android.service.MqttAndroidClient.registerReceiver(MqttAndroidClient.java:450)
    at org.eclipse.paho.android.service.MqttAndroidClient.connect(MqttAndroidClient.java:428)
    at org.eclipse.paho.android.service.MqttAndroidClient.connect(MqttAndroidClient.java:358)
    at org.eclipse.paho.android.service.MqttAndroidClient.connect(MqttAndroidClient.java:313)
    at com.example.adfdffffaaaaaaa.MqttKt.connect(Mqtt.kt:15)
    at com.example.adfdffffaaaaaaa.MainActivity.onCreate(MainActivity.kt:12)
    at android.app.Activity.performCreate(Activity.java:7159)
    at android.app.Activity.performCreate(Activity.java:7150)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3001)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3156)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at
 android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1864)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:205)
    at android.app.ActivityThread.main(ActivityThread.java:6993)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)
    Suppressed: java.io.IOException: No original dex files found for dex location
 /data/app/com.example.adfdffffaaaaaaa-anRxYlYVlgY0rXwazlHcYg==/split_lib_resources_apk.apk
    at dalvik.system.DexFile.openDexFileNative(Native Method)
    at dalvik.system.DexFile.openDexFile(DexFile.java:354)
    at dalvik.system.DexFile.<init>(DexFile.java:101)
    at dalvik.system.DexFile.<init>(DexFile.java:75)
 E/AndroidRuntime:     at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
    at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
    at dalvik.system.DexPathList.<init>(DexPathList.java:164)
    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
    at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
    at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
    at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
    at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
    at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
    at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:733)
    at android.app.LoadedApk.getClassLoader(LoadedApk.java:816)
    at android.app.LoadedApk.getResources(LoadedApk.java:1038)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2391)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6040)
    at android.app.ActivityThread.access$1100(ActivityThread.java:208)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
            ... 6 more

A: Try setting android.enableJetifier=true in gradle.properties file. If that doesn't work, try adding implementation 'androidx.legacy:legacy-support-v4:1.0.0' to build.grade.
This problem has been solved before in the next links, I highly recommend checking them out, specially 420:
https://github.com/eclipse/paho.mqtt.android/issues/321
https://github.com/eclipse/paho.mqtt.android/issues/420

A: I had the same problem.
I solved it. my solution:

*

*Add this dependency to the build.gradle(:app)

implementation 'androidx.legacy:legacy-support-v4:1.0.0'

*Use these implementations for paho mqtt in the build.gradle(:app)

implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'

*Add these permissions to the manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

*add this line to gradle.properties

android.enableJetifier=true

It worked for me. I hope works for you too.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to display json file data to UICollectionView Here I tried to get data from my URL used base64,shaa256 for authorize Header and I just tried to display in my console. It's worked well. But  I need to convert to NSDictionary and to display to my UICollectionView. And my data having 3 sections with different data. Each section having 12 - 20 files.
So my question are:

*

*How to convert my url to json to NSDictionary ?

*Hoe to display with 3 section & each section should have 12 to 20 data files?

*I used only this code in my viewdidload to get data.does i need to add 1.Connection did receive response 2.Connection did receive data 3.connection didFailWithError 4.connectionDidFinishLoading to my code or don't want these 4 method to add in to my code

Here is my code:
I use to insert my below code to my above code after
NSString *str = [[NSString alloc] initWithData:returnData
                                      encoding:NSUTF8StringEncoding];

NSError * error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:str
                                                     options: NSJSONReadingMutableContainers
                                                       error: &error];

NSLog(@"%@",json);

But it din't work.if any useful answer for my 3 question is very useful for me.i am new to ios.help me out.Thanks in advance !

A: The data will most probably be JSON and not plain text? So convert the response straight to NSDictionary:
// show loading indicators when you are fetching data
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
    // hide loading indicators when you received a response
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

    if (connectionError) {
        // Handle error
    } else {
        NSDictionary *jsonResults = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
        NSLog(@"jsonResults: %@", jsonResults);
        // reload your views
        // [self.myCollectionView reloadData];
    }
}];

To make the collectionView with 3 sections you would need to have an NSArray containing the 3 sections, each of these 3 arrays would contain the 12-20 dictionaries with keys and values that will populate each cell.
NSArray *sectionOne = @[@{@"Section":@"1", @"Object":@"1"}, @{@"Section":@"1", @"Object":@"2"}];
NSArray *sectionTwo = @[@{@"Section":@"2", @"Object":@"1"}, @{@"Section":@"2", @"Object":@"2"}];
NSArray *sectionThree = @[@{@"Section":@"3", @"Object":@"1"}, @{@"Section":@"3", @"Object":@"2"}];
NSArray *collectionData = @[sectionOne, sectionTwo, sectionThree];

NSLog(@"collectionData: %@", collectionData);


text:
Q: Swapping this click function to a select list function There's a lot of other stuff going on, but I have this working code which uses a click function on two divs which does a bunch of other stuff, like this:

Single

Regular

Here's the function:
$(document).on('click', '#Single , #Regular', singleToDDSwitch);

I need to keep the same functionality but use a select list as the trigger instead. Here's the example select list:
<select><option id='Single'>Single</option><option id='Regular'>Regular</option></select>

Can anyone help, I'm not that hot at jQuery?

A: Try  this:

$(document).ready(function() {
  $(document).on('change', '#sel', function() {
    alert($(this).find(":selected").text());
  });
});

<select id="sel">
  <option>Single</option>
  <option>Regular</option>
</select>

In select you dont neet the individual ids.

A: You can use the .change event on the <select> element.


text:
Q: Need return value from SweetAlert for confirm an action delete I have a button for deleting one row
<a href="<?php echo base_url('sekertaris_controller/f1_delete/'); echo $row->kode_f1;?>" onclick="return dialog()"><button class="btn btn-danger btn-sm"></button>

and using javascript dialog() for trigger link

the problem is SweetAlert closed and data in row deleted without confirm

A: function dialog() {
    swal({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, delete it!'
        cancelButtonText: 'Cancel',
        closeOnConfirm: false,
        closeOnCancel: false
    }, function (isConfirm) {
        if (isConfirm) {
            swal("Deleted!", "Your imaginary file has been deleted.", "success");
        } else {
            swal("Cancelled", "Your imaginary file is safe :)", "error");
        }
    });
}


text:
Q: Best way to set the permissions for a specific user on a specific folder on a remote machine? We have a deployment system at my office where we can automatically deploy a given build of our code to a specified dev environment (dev01, dev02, etc.).
These dev environments are generalized virtual machines, so our system has to configure them automatically. We have a new system requirement with our next version; we need to give certain user accounts read/write access to certain folders (specifically, giving the ASPNET user read/write to a logging folder).
I'm pretty sure we could do this with WMI or scripts (we use Sysinternals PSTools in a few places for deployment), but I'm not sure what is the best way to do it. The deployment system is written in C# 2.0, the dev environment is a VM with Windows XP. The VM is on the same domain as the deployment system and I have administrator access.
Edit: There's not really a right answer for this, so I'm hesitant to mark an answer as accepted.

A: Another option would be to investigate using a Powershell script There are a lot powershell community snap ins to support VMs and active directory.
Active Directory Script Rescources
Powershell Script Library
Microsoft Script Resources
VMWARE VI Toolkit (for Windows)

A: If you can run scripts, it might be as simple as runing the CACLS command on the VM. Perhaps just have your deployment script read in a config and run the appropriate CACLs commands.


text:
Q: How to normalize group by count results? How can the results of a "group by" count be normalized by the count's sum?
For example, given:
User     Rating (1-5)
----------------------
1        3
1        4
1        2
3        5
4        3
3        2
2        3

The result will be:
User    Count   Percentage
---------------------------
1       3      .42         (=3/7)
2       1      .14         (=1/7)
3       2      .28         (...)
4       1      .14

So for each user the number of ratings they provided is given as the percentage of the total ratings provided by everyone.

A: SELECT DISTINCT ON (user) user, count(*) OVER (PARTITION BY user) AS cnt,
       count(*) OVER (PARTITION BY user) / count(*) OVER () AS percentage;

The count(*) OVER (PARTITION BY user) is a so-called window function. Window functions let you perform some operation over a "window" created by some "partition" which is here made over the user id. In plain and simple English: the partitioned count(*) is calculated for each distinct user value, so in effect it counts the number of rows for each user value.

A: Without using a windowing function or variables, you will need to cross join a grouped subquery on a second "maxed" subquery then select again to return a subset you can work with.
SELECT
    B.UserID,
    B.UserCount,
    A.CountAll
FROM
(
    SELECT
        CountAll=SUM(UserCount)
    FROM
    (
        SELECT
            UserCount=COUNT(*)
        FROM
            MyTable
        GROUP BY
            UserID
    ) AS A
)AS C
CROSS JOIN(
        SELECT
            UserID,
            UserCount=COUNT(*)
        FROM
            MyTable
        GROUP BY
            UserID
)AS B


text: Q: Cordova 4 and Ripple I have a problem emulating my applications in cordova. I have found ripple when it was still Cordova 3 but since the update to Cordova 4 ripple seems not working. With this problem at hand and a very low specs device, I would like to ask for recommendation of emulator that I could use, Or is it just me that don't know how to make ripple work with Cordova 4?


text:
Q: Blank page of next website url in selenium chrome driver I am automating  https://www.cleartrip.com/ website using java in selenium framework. After filling all the form details, when the selenium clicks on "searchBtn" button, then a blank page loads with the next page url. It remains blank every time I refresh. But if I copy paste the final website in my chrome browser then the results is showing. And this is happening in both firefox and chrome driver.
I have added a picture also. https://i.stack.imgur.com/VZHPG.png
Can anyone tell me where am I taking the wrong step?
Thanks..
My code is below:
public void formFilling() throws Exception {

        driver.findElement(By.id("OneWay")).click();
        driver.findElement(By.id("FromTag")).sendKeys("Delhi");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.findElement(By.xpath("//*[contains(text(),'Del') and contains(text(), 'Indira')]")).click();
        driver.findElement(By.id("ToTag")).sendKeys("Hyderabad");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.findElement(By.xpath("//*[contains(text(),'Hyd') and contains(text(), 'Rajiv')]")).click();
        driver.findElement(By.id("DepartDate")).sendKeys("Fri, 16 Apr,2021");
        driver.findElement(By.xpath("//*[@title=\"More search options\"]")).click();
        Select s = new Select(driver.findElement(By.id("Class")));
        s.selectByVisibleText("Economy");
        driver.findElement(By.id("SearchBtn")).submit();
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2]/div[2]/div[7]/div[1]/div[3]/a/span")).click();
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.findElement(By.xpath("/html/body/div[1]/div/main/div/div/div[2]/div[2]/div[8]/div[1]/div[1]/div[1]")).click();
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        TakesScreenshot ts = (TakesScreenshot) driver;
        ts.getScreenshotAs(OutputType.FILE);

  [1]: https://i.stack.imgur.com/VZHPG.png

A: Your code is just too fast. You enter all the values, then you click on the search button and immediately your try to take a screenshot.
After clicking on "save changes" or "submit" buttons you need to give the browser time to refresh the data and load the updated page:
In your case do this:
driver.findElement(By.id("SearchBtn")).submit();
Thread.Sleep(5000);
// continue your test

If 5 seconds wait is not enough - rise it up.


text:
Q: Questions about servers, databases, and android Ok so I'm trying to develop a server for an android app that I'm developing.
Basically it's an application that needs to connect with other phones through a database system.
I was thinking of using an sql database to store the simple data I need to exchange.
What type of server should I be using?
What language should I be writing the database code in (if besides SQL)?
How do I get the android application to communicate and exchange information with the database?
Is there a type of virtual server I can use to test my app?

A: The server type and language choices very much depend on your skillset and environment. However, I'd suggest exposing queries to your database either through JSON or XML, and presenting through a web server.
PHP & MySQL are as good a choice as any, as you can run the same code on UNIX, Linux, Solaris, or MacOS servers. Of course, using a J2EE environment with JDBC drivers to a generic server is also a good choice, especially if you need to share any classes between Android and your server.
By 'virtual server' I assume you mean 'virtual handset', in which case the Android emulator in the SDK might be good enough (although it is painfully slow), or just use a real Android device plugged in to your development machine.
Hope this helps,
Phil Lello


text:
Q: how to use 'else if' in my jQuery properly? I have a function with 'click' event. After 'click' is being trigerred I need a conditional statement to do some things based on what button has been clicked. I put some code to make it clearer:
The ul and The a:

The jQuery:
$('.menu, .logo').on('click','a',function(e){
        var href = $(this).attr('href');
        $(this).data('clicked', true);
        if ($('.first a').data('clicked')) {
        // do things reserved only for .first button
        }
        else if ($('.logo a').data('clicked')) {
        // do things reserve only for .logo link
        }
        else {
        // do things reserved for every other buttons
        }
        goTo(href);
});

function goTo(href) {
    $.ajax({
        url: href,
        success: function(data) {
          // some code
        }
    });
}

My problem is, when I click on a menu button, it just doesn't work. I want it to do something, depedning on which button has been clicked. When I click on '.first' it works, when I click on '.logo' it also works but the third one, 'else', is being omitted.

A: That whole deal with the .data() seems like a round-about way to do this:
if ($(this).is('.menu a')) {
  // menu button, or ".first a" for just the first one, etc
}
else if ($(this).is('.logo')) {
  // the logo button
}

A: else if ($('.logo a').data('clicked')) {

And close your original .on() event:
$('.menu, .logo').on('click','a',function(e){
  //DO STUFF

}); //Closing curly brace and paren

A: If you are trying to do things based on which was clicked using the data element then you are stporing up trouble.  You are loading pages with ajax without appaently reseting the data - if you click the first then the second then the first could still have data('clicked') true.
Plus the missing bracket as already pointed out.
Suggest instead:
$('.menu, .logo').on('click','a',function(e){
        var href = $(this).attr('href');
        if ( $(this).hasClass('first') ) {
        // do things reserved only for .first button
        }
        else if( $(this).hasClass('logo') ) {
        // do things reserve only for .logo link
        }
        else {
        // do things reserved for every other buttons
        }
        goTo(href);
}

A: Rewriting your code:
Not sure why you are checking data when you set it to true before. Makes no sense to me right now and perhaps you want to check if a user has already clicked on it before?
// declare outside event as it is not clear from your provided code where this belongs
function goTo(href) {
    $.ajax({ url: href }).done(function(){
        // some code
    });
}

$('.menu, .logo').on('click','a',function(ev){
    var el = $(this), // let's do this once
        hasClicked = el.data('clicked'), // let's do this once
        parent = el.parent(),
        href = el.prop('href'); // use .prop() when dealing with actual properties

    ev.preventDefault(); // prevent the link from it's intentional behaviour

    // why mess with data here? Do it after you've done whatever it is you have to do or it doesn't makes sense you're gonna check it?
    //el.data('clicked', true);

    // use !hasClicked to reverse the condition(s)
    if (parent.hasClass('first') && hasClicked) {
        // do things reserved only for .first button
    } else if (parent.hasClass('.logo') && hasClicked) {
        // do things reserve only for .logo link
    } else {
        // do things reserved for every other buttons
    }

    // wild guess this belongs here
    el.data('clicked', true);

    goTo(href);

});


text:
Q: Grouping data by whether or not the data's feature intersects Suppose we have a table:
id  | aliases
-------------
0   | ['a0', 'a1', 'a4', 'a11']
1   | ['a3', 'a5']
2   | ['a16', 'a18']
3   | ['a6', 'a8', 'a10']
4   | ['a7', 'a8', 'a9']
5   | ['a3', 'a12', 'a14']
6   | ['a5', 'a16', 'a17']

and I'd like to group all id's together that map to the same aliases; in other words, the end result groups together all id's that have aliases that intersect, applied recursively. In the above case, we would have:

*

*0 maps to ['a0', 'a1', 'a4', 'a11']

*1, 2, 5, and 6 map to ['a3', 'a5', 'a12', 'a14', 'a16', 'a17', 'a18']

*3 and 4 map to ['a6', 'a7', 'a8', 'a9', 'a10']
Is there an efficient way to do this? In my actual use case I have around 15M rows.
There is a naïve approach of streaming the rows and checking if each element of aliases in each new row is in the aliases processed so far; if so, collecting the id's together of all rows with matching aliases, and mapping them to the union of the aliases matched.
However, this approach seems computationally impractical.

A: To run a O(n*len(groupcount) complexity code on this table shouldn't be that hard, just off the top of my mind:
Assume you have id as a list of id and aliases as list of lists, you can do:
bins = []
sets = []
for i in id: # Assume from (0 - n)
    alias = aliases[i]
    in_set = False
    for j in range(len(sets)):
        if len(sets[j].intersection(set(alias))) > 0:
            sets[j].update(set(alias)) # add alias to set, if any difference
            in_set = True
            bins[j].append(i) # append id to bins
            break
    if not in_set:
        bins.append([i])
        sets.append(set(alias))

bins will contain the id groups, and corresponding element in sets will contain the alias groups, you can use list() to convert these sets back to list. And since all set operations are hash based this ensure your program runs in O(n*groupcount) time.


text:
Q: Doublet derivation I'm just following these notes. I am not sure how they went from the third line to the fourth line where it is expanded. Any chance someone could point me in the right direction? Thanks :-)

A: Examining the log term we have
$\large\log\left(\frac{1+\epsilon/z}{1-\epsilon/z}\right)=\log\left((1+\epsilon/z)\frac{1}{1-\epsilon/z}\right)$
Now the fraction $\frac{1}{1-\epsilon/z}$ has the following Taylor series expansion
$\large \frac{1}{1-\epsilon/z}=1+\sum_{n=1}^{\infty}(\epsilon/z)^n\sim 1+(\epsilon/z)+O\left((\epsilon^2/z^2\right))$
Interestingly, as per the OP's comment, the left hand side of the above equation can be regarded as a sum to infinity of a geometric progression of the terms on the right.
Thus we have
$\large\log\left(\frac{1+\epsilon/z}{1-\epsilon/z}\right)=\log\left\{(1+\epsilon/z)\left[1+(\epsilon/z)+O\left((\epsilon^2/z^2\right)\right]\right\}$


text:
Q: Why promise always returns same data over and again? I am running into trouble and it seems like promise is caching variable.
const num = Math.random()
const fun = () => new Promise(resolve => resolve(num))
// Now, calling fun again and again, it gives me same result
await fun()
await fun()
await fun()

If I put use it like below. Then it works as expected:
const fun = () => new Promise(resolve => resolve(Math.random()))

How can I solve this problem using constant variable as in preceding example?

A: In the first example, you are generating a random number once, then you return that same number from the "fun" promise function. In the second example you generate a new random number every time you call "fun".

A: "How can I solve this problem using constant variable as in preceding example?"
You cannot. If you use a constant variable, you will get a constant result. To get a different result you need to generate a new number every time, as in the second example you gave.

A: Simple, you have to watch carefully how function & variable works.

*

*Example 1: In num constant variable you call the function random() that returns a floating-point and stores it as num value.
Then you call fun() that returns a Promise and resolves an already INITIALIZED value from num
    const num = Math.random() // <= HERE!
    const fun = () => new Promise(resolve => resolve(num))
    // Now, calling fun again and again, it gives me same result
    await fun()
    await fun()
    await fun()

*

*Example 2: Again when you call fun() you get the resolved value in the Promise. But, this time is not an already initialized value from a variable. You are calling random() method each time a new Promise is setted.

  const fun = () => new Promise(resolve =>
                                       resolve(Math.random())) // <= HERE!


text:
Q: See all information about all processes, daemons, etc. running on Mac OS X I like to view information about all processes (including every daemon etc etc) that are running on Mac OS X.
I use:
sudo ps -A

Update: I also tried Activity Monitor as suggested by Alex.
My questions:

*

*Is there a better way?

*How do I identify which of processes are native (shipped with the OS), belong to my installed applications (I.e. Thunderbird, Parallels Desktop etc) or cannot be classified?

*How do I find out which processes sending information into the Internet or local network?
Background:
The system responds slowly and the Terminal tends to hang up after I start the Terminal application for the first time after start up. I tried to remove unused applications, run all of Maintenance.app's maintenance scripts, disabled startup items, disabled all eye candy, bought max. RAM - but still everything is slow.

A: Why not try using Activity Monitor? It's buit-in, has a GUI and offers plenty of information.
Here's how it looks:

A: If I were trying to find out why Terminal or bash were slow at starting up, I would first double-check for directories in PATH that are network-based (do you have any AFP or NFS shares mounted on your machine? Not so common on desktop Macs, but that's a 'Unix-SA-101'-taught cause.)
I would then try sourcing the script into a separately executed shell, to see if they were slow then. I might also either log in remotely, via SSH, or use a second different 'term' type program, to execute 'sudo dtruss -d -f -p ' on the newly started Terminal.app process ID and see if there were any clues there as to what it was busy doing (or not doing!)
If I could reproduce the problem just by starting a bash process, then I'd dtruss that directly.

A: Assuming you're running some variant of Leopard, this script will dump out a big long list of all the aftermarket system augmentations it can find on your system:
http://www.khiltd.com/Downloads/ConsultantsCanary.tar.gz
And this one will dump out a big long list of all the processes with open network connections (very, very slowly):
http://www.khiltd.com/Downloads/lwt.sh
The first one is a double-clickable AppleScript wrapper, the second must be run from the command line and may spew a few errors as well under 10.6. Neither actually does anything beyond reporting the files' existence, so if you want something removed you have to do it yourself.


text:
Q: SQL server - advanced grouping I have at table containing procurement contracts that looks like this:
+------+-----------+------------+---------+------------+-----------+
| type | text      | date       | company | supplierID | name      |
+ -----+-----------+------------+---------+------------+-----------+
| 0    | None      | 2004-03-29 | 310     | 227234     | HRC INFRA |
| 0    | None      | 2007-09-30 | 310     | 227234     | HRC INFRA |
| 0    | None      | 2010-11-29 | 310     | 227234     | HRC INFRA |
| 2    | Strategic | 2011-01-01 | 310     | 227234     | HRC INFRA |
| 0    | None      | 2012-04-10 | 310     | 227234     | HRC INFRA |
+------+-----------+------------+---------+------------+-----------+

In this example the first three rows the contract is the same. So I only want the first one.
The row with type = 2 is a change in procurement contract with the given supplier. I want to select that row as well.
On the last row the contract changes back to 0, so I want to select that row as well.
Basically I want to select the first row and the rows where the contract type changes. So the result should look like this:
+------+-----------+------------+---------+------------+-----------+
| type | text      | date       | company | supplierID | name      |
+ -----+-----------+------------+---------+------------+-----------+
| 0    | None      | 2004-03-29 | 310     | 227234     | HRC INFRA |
| 2    | Strategic | 2011-01-01 | 310     | 227234     | HRC INFRA |
| 0    | None      | 2012-04-10 | 310     | 227234     | HRC INFRA |
+------+-----------+------------+---------+------------+-----------+

Any suggestions to how I can accomplish this?

A: I don't have SQL server in front of me to test it out so I'm not going to attempt the actual solution for it right now, but fyi there are few things you need:
1) A way to make sure the records are ordered properly.  I don't see any kind of an id here which means you have no guarantee that they will appear in that order.  I assume there is one so just make sure you order by it
2) You need to do an outer join on the table to itself on whatever the index is, but instead of "table1.index = table2.index" it will look like "table1.index = table2.index + 1".  If your indexes aren't sequential then it will make joining them this way more complex than that though.
3) In the where clause you'll specify something like
where table1.type <> table2.type

That will get you most the way there.  That won't pick up the very first record though since there is no record before the first record to compare to so you'll need an OR addition to compensate for that.  And I'm assuming that type has no NULL values.
Sorry I couldn't be more help with an actual implementation but maybe someone else will take care of that shortly.

A: might be what you want. Presumingly you dont have type < 0.
SELECT *
FROM [TABLE] as ot where ot.type <>
(select top 1 coalesce(it.type, -1) from [TABLE] as it where it.date < ot.date order by it.date desc)

Also, take not of brandon note to make shure tables are ordered, due i dont see PK.

A: ;WITH cte AS
 (
  SELECT ROW_NUMBER() OVER (ORDER BY date) AS Id,
         type, text, date, company, supplierId, name
  FROM your_table
  )
  SELECT c1.type, c1.text, c1.date, c1.company,
         c1.supplierId, c1.name
  FROM cte c1 LEFT JOIN cte c2 ON c1.id = c2.id + 1
  WHERE c2.text IS NULL OR c1.text != c2.text

Demo on SQLFiddle


text:
Q: In swift, when one property has no default value, the default values held by other properties become useless? In swift, I have the following code:
struct Person {
    var name: String
    var nose: Int = 1
}

var mike = Person(name: "mike", nose: 1)
var john = Person(name: "john") //error: missing argument for parameter 'nose' in call

Although nose has a default value, I have to specify a value for it. My question is, does default value of nose become totally useless and I can simply write the declaration as the following?
struct Person {
    var name: String
    var nose: Int
}

Thanks!

A: From The Swift Programming Language

Structure types automatically receive a memberwise initializer if they
  do not define any of their own custom initializers. This is true even
  if the structure's stored properties do not have default values.
The memberwise initializer is a shorthand way to initialize the member
  properties of new structure instances. Initial values for the
  properties of the new instance can be passed to the memberwise
  initializer by name.

As you haven't declared any initialisers for your struct, the only initialiser that is available is the memberwise initialiser.
You can declare an initialiser that just takes a name in order to use the default value for nose.  This then requires you to explicitly declare the memberwise initialiser -
struct Person {
    var name: String
    var nose: Int = 1

    init(_ name:String) {
        self.name=name;
    }

    init (name:String, nose:Int){
        self.name=name;
        self.nose=nose;
    }
}

var mike = Person(name: "mike", nose: 1)
var john = Person("john")

A: I like this form because it is so flexible:
struct Person {
    var name: String
    var nose: Int

    init(name: String = "Anon", nose: Int = 1) {
        self.name=name;
        self.nose=nose;
    }
}

var sally = Person(nose: 2, name: "Sally")
var anon1 = Person(nose: 1)
var anon2 = Person()
var mike = Person(name: "mike", nose: 1)
var john = Person(name: "john")

Note 5 different initialiser combinations possible. Essentially it allows you to treat Person like a person builder (Builder pattern).


text:
Q: PySide (Qt) signal not reaching my slot I have this simplified code that doesn't work and I can't understand why... I expect MySlot.slt() to be called every time i press a key in my QTextEdit but it doesn't! Could you please have a look?
#!/usr/bin/env python2

import sys
from PySide import QtGui, QtCore

class MySlot(object):
    def __init__(self, qte):
        qte.textChanged.connect(self.soc)

    def slt(self):
        print("got signal")

class MainWid(QtGui.QWidget):
    def __init__(self, parent=None):
        super(MainWid, self).__init__(parent)
        self.initgui()

    def initgui(self):
        lay = QtGui.QVBoxLayout()
        txt = QtGui.QTextEdit(self)
        MySoc(txt)

        lay.addWidget(txt)
        self.setLayout(lay)
        self.show()

def main():
    app = QtGui.QApplication(sys.argv)
    wid = MainWid()
    sys.exit(app.exec_())

if __name__=="__main__":
    main()

A: Your MySoc object in initgui has local scope and is therefore destroyed at the end of initgui.
Assign the object to a variable:
...
self.soc = MySoc(txt);
...

and you will see the "got signal" output each time you press a key.


text:
Q: Barcode Fonts in MS WORD are different I Have googled a lot but do not know the proper way to describe it. not native english
I have made a macro in MS Word that generates a Barcode, very simple and it works. i am not a programmer. For generating the macro you need to have a font installed.
If I install the same font on two different computers i get different results.
I get the following result like in this picture on computer 1
Result 1
I get the following result like in this picture on computer 2
Result 2
The one is with text beneath the barcode the otherone has not.
but installing the same font on 2 computers i get this different result. i wish to get the barcode without the text beneath.
if anyone has an idea how i should google this  or knows a fix where i need to look please let me know.
it would be greatly appreciated.
thank you
Chris


text:
Q: How to get the intersection points of an Arc and a line? I need to place several number of line segments inside an arc, but to do that i need to have intersection points so that i can place the lines inside the arc perfectly;

I thought about a way to calculate the distance and check if it is less than radius, but the thing is i need to know the C,D & E points so that i can place the line segments, so i'm lost here, any one can help please?
EDIT

*

*The radius is specified

*Number of line segments may vary, but there are 2 lines at least

*Lines start at starting border, end at the ending border; e.g: Start is C, end point is D
EDIT
In order to be clear about what i'm trying to do, i'm uploading another illustration;

I need to get the coordinates of [CD],[EI],[JK] lines,

A: Ok... Here we go. The following snippet should work for any arc (defined with an angle and a radius) and for any number of equally spaced segments you want.
Currently, it assumes that the arc is perfectly placed horizontally (like in your example), but it can be "easily" extended to allow translated/rotated arcs.
The getLinesCoords() function will return an object whose x and y properties contains arrays with the corresponding coordinates for each segment.
"y" coordinates are the "height" of the segment from the center (G in your image) and "x" are the start/end position, always from center (left/right depends on sign +/-).
If you have any question, please ask.

// *** ARC ***
const R = 100; // RADIUS
const PHI = 180; // ANGLE (DEG)

// *** LINES ***
const LINES = 10; // NUMBER OF LINES TO BE PLACED

// *** CALCULATIONS ***
const coords = getLinesCoords(R, PHI, LINES);

console.log(coords);

function getLinesCoords(radius, angle, linesNum) {

  let i = 0;
  let arcAvailHeight = 0;
  let linesSep = 0;
  let linesYCoords = [];
  let linesXCoords = [];
  let angleRad = angle * Math.PI / 180;

  // GET AVAILABLE HEIGHT FOR PLACING LINES
  arcAvailHeight = radius * (1 - Math.cos(angleRad / 2));

  // GET LINES SEPARATION
  linesSep = arcAvailHeight / (linesNum + 1);

  // GET Y COORDINATES FOR LINES
  for (i = 0; i < linesNum; i++) {
    linesYCoords[i] = linesSep * (i + 1);
  }

  // GET CORRESPONDING X COORDINATES FOR LINES
  linesYCoords.forEach((y) => {
    linesXCoords.push(Math.sqrt(radius**2 - (radius * Math.cos(angleRad / 2) + y)**2));
  });

  return ({x: linesXCoords, y: linesYCoords});

}


text: Q: Matlab multiple linear least squares using vectorization I regularly have upwards of 10^8 sets of linear least squares to solve (heaps of Ax = B) coming out of monte-carlo simulations. Until now I have been using a simple loop, but obviously this is slow. Is there a way of vectorizing the process, so that I can send the lot at once to the function and it returns 10^8 solutions to the 10^8 sets? I have looked extensively online. All I can find is a python code that does what I want stacked_lstsq, but I don't know how to translate this into Matlab. Any help appreciated.


text:
Q: Paper checkbox and -webkit-column-count This is something I have been researching for a while already but I am not able to find out what's happening here.
On this example you can see how there is a list of check boxes that are spread over a div using the css rule -webkit-column-count.
The problem is that the check-mark is hidden for some reason on all the columns but the first one. Do you have any tip to fix this?
Here I attach an small example but please check my jsfiddle for a better descriptive view of the situation. Thanks!

.valueLabel {
  /* height: 24px; */
  padding: 7px 12px;
  width: 400px;
}
.valueLabel paper-checkbox {
  margin-right: 12px;
}
.valueLabel paper-checkbox::shadow #ink[checked] {
  color: #f39200;
}
.valueLabel paper-checkbox::shadow #checkbox.checked {
  border-color: #f39200;
  background-color: #f39200;
  /* Version 0.7 paper-checkbox */
}
/* COLUMNS */

.valuesContainer {
  overflow-y: scroll;
  padding: 0px 16px;
}
.valuesContainer > #valuesDiv {
  -webkit-column-break-inside: avoid;
  -moz-column-break-inside: avoid;
  column-break-inside: avoid;
  -webkit-column-count: 4;
  -moz-column-count: 4;
  column-count: 4;
  -webkit-column-gap: 0px;
  -moz-column-gap: 0px;
  column-gap: 0px;
}
.valuesContainer > #valuesDiv .valuesGroup {
  display: inline-block;
}
.valuesContainer > #valuesDiv .valuesGroup > span {
  text-transform: uppercase;
}
/* LAYOUT WRAP */

.valuesContainer > core-label {
  width: 30%;
  /* 3 COLUMNS */
  line-height: 16px;
  font-size: small;
}
.valuesContainer > #valuesDiv core-label.valueLabel {
  display: inline-flex;
}
/* FIX THAT I USED TO SHOW ALL CHECKS WHEN THEY ARE ON COLUMNS, USED ON PAPER ELEMENTS >= v0.7 */

/* IT DOES NOT WORK ANYMORE */

.valueLabel paper-checkbox::shadow #checkbox.checked #checkmark {
  position: fixed;
  margin-top: 2px;
  margin-left: 2px;
}

<link rel="import" href="https://www.polymer-project.org/0.5/components/polymer/polymer.html">
<link rel="import" href="https://www.polymer-project.org/0.5/components/paper-elements/paper-elements.html">
<link rel="import" href="https://www.polymer-project.org/0.5/components/core-elements/core-elements.html">

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-0">
      <paper-checkbox id="1" checked></paper-checkbox>

January

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-1">
      <paper-checkbox id="2"></paper-checkbox>

February

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-2">
      <paper-checkbox id="3" checked></paper-checkbox>

March

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-3">
      <paper-checkbox id="4" checked></paper-checkbox>

April

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-4">
      <paper-checkbox id="5"></paper-checkbox>

May

    </core-label>

A: You're running into a rendering bug.  One way to try to correct this is to force GPU rendering.  There are a few ways to do that, and my favorite is to use transform:translate3d(0,0,0). The issue with that, however, is that the element that needs it (#checkbox.checked #checkmark) already has a transform.  You can achieve the same results by setting the backface visibility.  I do that in the demo below with the following rule:
.valueLabel paper-checkbox::shadow #checkbox.checked #checkmark {
   ...
   -webkit-backface-visibility: hidden;
   -moz-backface-visibility: hidden;
   -ms-backface-visibility: hidden;
   backface-visibility: hidden;
}

Demo

.valueLabel {
  /* height: 24px; */
  padding: 7px 12px;
  width: 400px;
}
.valueLabel paper-checkbox {
  margin-right: 12px;
}
.valueLabel paper-checkbox::shadow #ink[checked] {
  color: #f39200;
}
.valueLabel paper-checkbox::shadow #checkbox.checked {
  border-color: #f39200;
  background-color: #f39200;
  /* Version 0.7 paper-checkbox */
}
/* COLUMNS */

.valuesContainer {
  overflow-y: scroll;
  padding: 0px 16px;
}
.valuesContainer > #valuesDiv {
  -webkit-column-break-inside: avoid;
  -moz-column-break-inside: avoid;
  column-break-inside: avoid;
  -webkit-column-count: 4;
  -moz-column-count: 4;
  column-count: 4;
  -webkit-column-gap: 0px;
  -moz-column-gap: 0px;
  column-gap: 0px;
}
.valuesContainer > #valuesDiv .valuesGroup {
  display: inline-block;
}
.valuesContainer > #valuesDiv .valuesGroup > span {
  text-transform: uppercase;
}
/* LAYOUT WRAP */

.valuesContainer > core-label {
  width: 30%;
  /* 3 COLUMNS */
  line-height: 16px;
  font-size: small;
}
.valuesContainer > #valuesDiv core-label.valueLabel {
  display: inline-flex;
}
/* FIX THAT I USED TO SHOW ALL CHECKS WHEN THEY ARE ON COLUMNS, USED ON PAPER ELEMENTS >= v0.7 */

/* IT DOES NOT WORK ANYMORE */

.valueLabel paper-checkbox::shadow #checkbox.checked #checkmark {
  position: fixed;
  margin-top: 2px;
  margin-left: 2px;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -ms-backface-visibility: hidden;
  backface-visibility: hidden;
}

<link rel="import" href="https://www.polymer-project.org/0.5/components/polymer/polymer.html">
<link rel="import" href="https://www.polymer-project.org/0.5/components/paper-elements/paper-elements.html">
<link rel="import" href="https://www.polymer-project.org/0.5/components/core-elements/core-elements.html">

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-0">
      <paper-checkbox id="1" checked></paper-checkbox>

January

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-1">
      <paper-checkbox id="2"></paper-checkbox>

February

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-2">
      <paper-checkbox id="3" checked></paper-checkbox>

March

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-3">
      <paper-checkbox id="4" checked></paper-checkbox>

April

    </core-label>

    <core-label class="valueLabel" horizontal="" layout="" id="core-label-4">
      <paper-checkbox id="5"></paper-checkbox>

May

    </core-label>


text:
Q: my android studio crashes when i convert string into int So I'm making a tinder like app I'm doing a coin system in which a user has 20 coins by default and after he swipes right 1 coin will be added to the total, I'm using an edittext to show the coins amount , I read articles on how to convert string to int but it doesn't seem to help and the app crashes after I do what most articles say I need to do, this is some of my code and thanks !
private DatabaseReference usersDb;

ListView listView;
List<cards> rowItems;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mCoins = (EditText) findViewById(R.id.coins);
    String myEditValue = mCoins.getText().toString();
    final int myEditNum = Integer.parseInt(myEditValue);

    usersDb = FirebaseDatabase.getInstance().getReference().child("Users");

    mAuth = FirebaseAuth.getInstance();
    currentUId = mAuth.getCurrentUser().getUid();

    checkUserSex();

    rowItems = new ArrayList<cards>();

    arrayAdapter = new arrayAdapter(this, R.layout.item, rowItems );

    SwipeFlingAdapterView flingContainer = (SwipeFlingAdapterView) findViewById(R.id.frame);

    flingContainer.setAdapter(arrayAdapter);
    flingContainer.setFlingListener(new SwipeFlingAdapterView.onFlingListener() {
        @Override
        public void removeFirstObjectInAdapter() {
            Log.d("LIST", "removed object!");
            rowItems.remove(0);
            arrayAdapter.notifyDataSetChanged();
        }

        @Override
        public void onLeftCardExit(Object dataObject) {

            cards obj = (cards) dataObject;
            String userId = obj.getUserId();
            usersDb.child(userId).child("connections").child("nope").child(currentUId).setValue(true);
            Toast.makeText(MainActivity.this, "Left", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRightCardExit(Object dataObject) {
            cards obj = (cards) dataObject;
            String userId = obj.getUserId();
            usersDb.child(userId).child("connections").child("yeps").child(currentUId).setValue(true);
            isConnectionMatch(userId);
            Toast.makeText(MainActivity.this, "Right", Toast.LENGTH_SHORT).show();

            mCoins.setText(myEditNum+ "1");

        }

`

A: This way you are concatenating
myEditNum+ "1"

Move your string and int to onRightCardExit method, and make the sum:
String myEditValue = mCoins.getText().toString();
final int myEditNum = Integer.parseInt(myEditValue);
mCoins.setText(String.valueOf(myEditNum+1));


text:
Q: apache airflow execution date has microseconds I have been deploying my DAGs with the default settings, but sometimes the DAG gets out of sync and starts running with a weird execution date such as
11-21T11:12:33.877171 but all but other runs have the execution date with the format MM-DDT00:00:00
I have not set the schedule interval so it uses the default:
schedule_interval=datetime.timedelta(1)
I also always set my start date to be a datetime such as:
'start_date': datetime(2017, 9, 6)
Once the first run happens with the new weird execution date then all the subsequent runs run one schedule interval after that execution date instead of at midnight like I would like.
Also, sometimes this issue also happens when I deploy a new DAG and the first execution date is not MM-DDT00:00:00
I have two questions:

*

*If the execution date gets messed up how do I fix it so that it goes back to the normal schedule of starting right after midnight ?

*When I deploy a new DAG how can I ensure that it starts right after midnight ?


text:
Q: Akénéo service pim_catalog.saver.product is private and can't be used in my bundle's Controller According to the docs, https://docs.akeneo.com/4.0/manipulate_pim_data/product/save.html, I should be able to call $saver = $this->get('pim_catalog.saver.product'); in my bundle's controller, like this:
<?php
namespace XXX\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class ExportController extends Controller
{
    public function exportProduct($id): Response
    {
        $saver = $this->get('pim_catalog.saver.product');
        $saver->save($id);

        return new Response(
            'foo'
        );
    }

}

However I get this error:

[2020-11-05 13:44:58] request.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: "The "pim_catalog.saver.product" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead." at /var/www/html/pim/vendor/symfony/dependency-injection/Container.php line 275 {"exception":"[object] (Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException(code: 0): The "pim_catalog.saver.product" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead. at /var/www/html/pim/vendor/symfony/dependency-injection/Container.php:275)"} []

So I would want to override the declaration of this service by adding a services.YML file into my bundle's configuration directory (mybundle/Resources/config/services.YML) :
services:
  pim_catalog.saver.product:
    public: true
    priority: 999

However it still doesn't work.
According to the documentation of Symfony 4,  I should create an Extension class maybe. It should have the same name than Akénéo's one, but I don't find the latter.
What should I do?

A: You have some hints in the error message.

The "pim_catalog.saver.product" service or alias has been removed or
inlined when the container was compiled. You should either make it
public, or stop using the container directly and use dependency
injection instead

As a best practice, I would discourage making it public since you are not the service provider and there is a better and easier way to solve your issue. So you are left with the second option which is the way to go in my humble opinion.
I don't know specifically about Akeneo but I do know about Symfony and dependency injection. So I would suggest using the argument typehint in your controller méthod.
1. Check the autowiring class/interface to use for service 'pim_catalog.saver.product'
List all defined autowiring and look for the one mentioning 'pim_catalog.saver.product'
console debug:autowiring

OR just check for all autowired class/interface with akeneo in the name (this is likely)
console debug:autowiring akeneo

2. Update your controller code to add the type-hinted argument
Something in the lines of the following
<?php
namespace XXX\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

// I just picked that interface after looking it up in Akeneo documentation
// But there is another one that can be used if you want to save multiple
// products, so beware.
use Akeneo\Tool\Component\StorageUtils\Saver\SaverInterface;

class ExportController extends Controller
{
    public function exportProduct($id, SaverInterface $saver): Response
    {
        $saver->save($id);

        return new Response(
            'foo'
        );
    }

}

The process is documented here https://symfony.com/doc/4.4/controller.html#fetching-services
3. (Hopefully) Enjoy a working code !
;-)


text:
Q: Java Basic Operator Return Type Is Java Operators return int type?
short a = 1;
short b = 2;

short c = a&b;
short d = a+b;
long e = a&b;

in case of 'c', 'd' they have type mismatch error. why?
and case of 'e' no error. why??

A: Any operation between two variables of integer type that are smaller than int results in an int. So:
short + short -> int
short + byte -> int

etc. It's mentioned in the Java Language Specification.
Therefore you have to cast the result of a + b to short in order to assign it back to a variable of type short. Please note, that you may lose data if you do so.
However long is bigger than int. The assigment ist valid.

A: What you are seeing is binary numeric promotion. This is specified in the Java Language Specification §5.6.2:

When an operator applies binary numeric promotion to a pair of
  operands, each of which must denote a value that is convertible to a
  numeric type, the following rules apply, in order:

*

*If any operand is of a reference type, it is subjected to unboxing conversion (§5.1.8).

*Widening primitive conversion (§5.1.2) is applied to convert either or both operands as specified by the following rules:

*

*If either operand is of type double, the other is converted to double.

*Otherwise, if either operand is of type float, the other is converted to float.

*Otherwise, if either operand is of type long, the other is converted to long.

*Otherwise, both operands are converted to type int.

Then it goes on to list the operators for which this applies to, which I won't quote here.
In all cases, both operands are short, so according to the last bullet, they are both converted to int. An int plus an int is another int, which can't be implicitly converted to a short. Hence the error in c and d. int is implicitly convertible to a long, though, so no error for e.


text:
Q: A Question About Linq To Sql When I write a code like below, I take this error message: "The query operator 'ElementAtOrDefault' is not supported."
How can I fix it?
Dim tmpQuestion As New UIData
    Dim strViews = From t In tmpQuestion.LU_QUESTIONs _
                      Where t.ID_QUESTION = Request.QueryString("IdQuestion") _
                      Select t
    Dim mtViews = strViews(0).MT_VIEWS

A: Have you tried using the FirstOrDefault() then check to make sure it is not null.  My VB syntax is probably suspect, but you get the idea.
Dim strView = (From t In tmpQuestion.LU_QUESTIONS _
                    Where t.ID_QUESTION = Request.QueryString("IdQuestion") _
                    Select t).FirstOrDefault()

Dim mtViews as ...
If Not strView Is Nothing
   mtViews = strView.MT_VIEWS
EndIf

A: You haven't really queried yet.
strViews isn't the result set, it is the query. You need to actually retrieve some data.
var chosen = strViews.FirstOrDefault();

A: I am no expert in VB or LINQ2SQL but does this not have anything to do with the fact that you say strViews(0).MT_VIEWS while there is a chance that strViews can be null?


text:
Q: excel file which has a small table with the title on a single sheet. I need csv file of each table with the name of it Title I have an excel file that has a small table with the title on a single sheet. (Like this)

Requirement
For each table, I need a CSV file with its title.
Try this code.
First, I try to get data in dataframe but getting null value dataframe

import pandas as pd
# Install the openpyxl library
from openpyxl import load_workbook
import re
excelList=[]
# Loading our Excel file
wb = load_workbook("AD1.xlsx")

# creating the sheet 1 object
ws = wb.worksheets[0]

# Iterating rows for getting the values of each row
for row in ws.iter_rows(min_row=1, max_row=500, min_col=1, max_col=100):
  excelList.append([cell.value for cell in row if cell.value is not None])

# using list comprehension
res = [ele for ele in excelList if ele != []]

df=pd.DataFrame(res)

Any one have suggestion How i achieved my goal
Example excel link :https://github.com/aleem75321/excle_mutiple_table-/blob/main/AD.XLSX

A: Given an excel sheet which has the following sub-table properties:

*

*All Table Titles are in the First row.

*All Tables are of equal width.

*The sub-tables within the sheet are not defined by excel ranges or tables.

You can employ the following approach to create a list of tables in the form of tuples where the first tuple entry is the table title, the second tuple is the resulting dataframe.

*

*First load the file into a single dataframe, and extract the sub-table titles and there starting columns.

*Then reload the file for each sub-table limiting the columns read to only the columns needed for each individual table.

The following function will implement the above approach
import pandas as pd
from dataclasses import dataclass
def extractTables(filepath: str, tableWidth: int=3,
                  startRow: int=2) -> list[tuple[str, pd.DataFrame]]:
    """
       Given a path to an excel file with multiple tables on a single sheet
       Return a list of tuples containing the Table Name and Table contents
       as a dataframe, the width of each table is defined by tablewidth,
       the start od table data is defined by startRow
    """
    @dataclass
    class Table:
        start: int  # Starting column of Table
        name: str   # Table Title

    def getTableTitles(df: pd.DataFrame) -> list[Table]:
        # return list of table titles and column number where table starts
        tlts = []
        for c, n in enumerate(df.columns):
            if 'Unnamed' not in n:
                tlts.append(Table(c, n))
        return tlts
    rslt = []                    # response repository
    titles = getTableTitles(pd.read_excel(filepath))
    for tbl in titles:
        df = pd.read_excel(filepath, skiprows=startRow,
                          usecols=[tbl.start + x for x in range(tableWidth)])
        for i, ct in enumerate(list(df.columns)):
            if '.' in ct:
                df.columns.values[i] = ct[:ct.index('.')]
        df.dropna(axis=0, how='all', inplace=True)
        rslt.append((tbl.name, df))
    return rslt

If the sub-table names are 'Site 1', 'Site 2', and 'Site 3' using the above function on the excel file will produce something similar to:
[('Site 1',
      Pages  From   To
  0      12     0   16
  1      14    17   34
  2      16    35   48
  3      18    49   64
  4      20    65   80
  5      22    81   96
  6      24    97  112
  7      26   113  128
  8      28   129  144
  9      30   145  160
  10     32   161  176
  11     34   177  192
  12     36   193  224
  13     38  225+    -),
 ('Site 2',
      Pages  From   To
  0      12     0   16
  1      14    17   34
  2      16    35   48
  3      18    49   64
  4      20    65   80
  5      22    81   96
  6      24    97  112
  7      26   113  128
  8      28   129  144
  9      30   145  160
  10     32   161  176
  11     34   177  192
  12     36   193  224
  13     38  205+    -),
 ('Site 3',
      Pages  From   To
  0    12.0     0   16
  1    14.0    17   34
  2    16.0    35   48
  3    18.0    49   64
  4    20.0    65   80
  5    22.0    81   96
  6    24.0    97  112
  7    26.0   113  128
  8    28.0   129  144
  9    30.0   145  160
  10   32.0  161+    -)]


text:
Q: Why is all content on my home page overflowing the body border? On my home page Kendall_Gregory.html, my body border is ignoring the contents in the body and setting an arbitrary border around the page. It ignores every image that is on the page and the divs around them. The same code works on other pages and i can't figure out why this is the exception.

https://jsfiddle.net/hgaLsaz6/3/
HTML

CSS
body{
    margin: 0px;
    border: black 10px solid;
    font-family: 'brandon_grotesque_regularRg', Arial, sans-serif;
    line-height: normal;
}

a{
    text-decoration: none;
    color: black;
}

#topMenu{
    right: 20px;
    position: fixed;
    letter-spacing: 4px;
    z-index: 24;
    -webkit-font-feature-settings: "kern";
    -moz-font-feature-settings: "kern";
    -moz-font-feature-settings: "kern=1";

}

.MenuBar{
    text-align: center;
    width: 65%;
    margin:17 auto;
    text-decoration: none;
    letter-spacing: 2px;
    -webkit-font-feature-settings: "kern";
    -moz-font-feature-settings: "kern";
    -moz-font-feature-settings: "kern=1";

}
.consocials{
    bottom: 40;
    margin-left: 70px;
    margin-right: 70px;
    width: 80%;
    text-decoration: none;
}

.consocials:hover{
    border-bottom:solid black 2px;
    padding-bottom: 20px;
    text-decoration: none;
    color: black;
}

.socials{
    margin-right: 20px;
    margin-left: 20px;
    color: black;
    text-decoration: none;
    text-transform: uppercase;
}
.socials:hover{
    border-bottom:solid black 2px;
    padding-bottom: 15px;
    text-decoration: none;
    color: black;

}

.socials:active{
    text-decoration: none;
    color: black;
}

.center{
    text-align: center;
    margin: 0 auto;
}

.left{
    float: left;
    margin-left: 70px;
}

.right{
    float: right;
    margin-right: 70px;
}
.rightNoMargin{
    float: right;
}

.bottom{
    bottom: 30px;
}

.hide{
    display: none;
}

.m0a{
    margin: 0 auto;
}
.m10a{
    margin: 10 auto;
}
.h100{
    height: 100%;
}

.w100{
    width: 100%;
}
.w85{
    width: 85%;
}

.w50{
    width: 50%;
}
.w49{
    width: 49%;
}

.w40{
    width: 40%;
}
.mb200{
    margin-bottom: 200px;
}

.mb100{
    margin-bottom: 100px;
}

.pb30{
    padding-bottom: 30px;
}

.FloatL{
    float: left;
}

.FloatR{
    float: right;
}

.tAc{
    text-align: center;
}

.iLb{
    display: inline-block;
}

.m3{
    margin-top: 3px;
}

.h90{
    height: 90%;
}
.h850p{
    height: 850px;
}

.vA{
    vertical-align: center;
    height: 100%;
}

.h75{
    height: 60%
}

.pl20p{
    padding-left: 19%;
}

.pR100px{
    padding-right: 75px;
}

.w450{
    width: 450px;
}

.absolute{
    position: absolute;
}
.relative{
    position: relative;
}

.mnh100{
    min-height: 100px;

}

.mt100px{
    margin-top: 100px;
}

.mt200px{
    margin-top: 200px;
}
.h700{
    height: 700px;
}

.h800{
    height: 800px;
}

.w89{
    width: 89%;
}

.mT20{
    margin-top: 20%;
}

.mt50p{
    margin-top: 50%;
}

A: The reason your border isn't wrapping the image elements is because the image elements are floated and the container hasn't been cleared.
Anytime you float an image or any other object you take it out of the normal flow. This means that the parent container doesn't even know it exists.
There are several ways to address this issue – known as clearfix methods. In this case I've used the overflow property. Add overflow: auto to the container divs.
.no-hover {overflow: auto;}
.on-hover {overflow: auto;}

I tested this code and it solves the problem.
DEMO
Just keep in mind that when using the overflow property you can have different values (auto, hidden, scroll) each of which will have a different effect when content overflows the container. To understand what each value does you can refer to this article: MDN - CSS Overflow Property
Hope this helps. Good luck!


text:
Q: Using Azure function CLI 2x to create EvenHubTrigger I try to migrate Azure function EventHubTrigger 1x to 2x. But, My Azure function CLI 2x cant binding my Trigger and my output is No job functions found. Try making your job classes and methods public.. This is my project

I don't know what config I miss
Thanks for your help

A: First of all there's no binding in your code. First you miss the Function Binding as well as there is no Trigger binding. So here's a simple example for EventHubTriggered Azure Function
public static class Function2
    {
        [FunctionName("Function2")]
        public static async Task Run([EventHubTrigger("samples-workitems", Connection = "ConnectionString")] EventData[] events, ILogger log)
        {
            var exceptions = new List<Exception>();

            foreach (EventData eventData in events)
            {
                string messageBody = Encoding.UTF8.GetString(eventData.Body.Array, eventData.Body.Offset, eventData.Body.Count);

                // Replace these two lines with your processing logic.
                log.LogInformation($"C# Event Hub trigger function processed a message: {messageBody}");
            }

        }
    }


text:
Q: "500 OOPS: vsftpd: refusing to run with writable root inside chroot()" - login failed on Debian I installed vsFTPd for running an FTP server on Debian 7.3 (Wheezy). I checked the vsFTPd version was 2.3.5, and I configured it like so:
listen=YES
local_enable=YES
write_enable=YES
chroot_local_user=YES
pasv_min_port=15000
pasv_max_port=15200
allow_writeable_chroot=YES

I followed these articles for solving this problem:

*

*http://blog.waja.info/2013/05/13/500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/

*http://www.mikestechblog.com/joomla/operating-systems-section/operating-systems-ubuntu/155-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot.html
And many others on Google and forums, but my problem was not solved.
NOTE: I have solved this problem on Ubuntu 12.04 (Precise Pangolin), but that solution does not work on Debian 7.3.
I really mixed up on it?!

A: I searched for it toooooooooo much, and I really mixed up, so I decided to change vsFTPd to SFTP or something else, till I found a link about this bug.
Then I found out this problem was solved in vsFTPd version 3. So I searched how to upgrade it and could find to add the jessie repository to my Debian 7.3 installation and upgrade it so:
echo "deb http://ftp.us.debian.org/debian jessie main contrib non-free" >> /etc/apt/sources.list
aptitude update
aptitude upgrade vsftpd
echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
service vsftpd restart

Now it works correctly for me.

A: Just add
seccomp_sandbox=NO

to the configuration and restart the service with service vsftpd restart
Then "allow_writeable_chroot=YES" will work also with newer vsFTPd versions
(found in 500 OOPS: vsftpd: refusing to run with writable root inside chroot() Keep user jailed).

A: From the default vsftpd.conf:

Warning! chroot'ing can be very dangerous. If using chroot, make sure that the user does not have write access to the top level directory within the chroot

That's why your solution should not involve allow_writeable_chroot=YES when applicable. Instead, refactor your filesystem in order to avoid writable FTP top level directories.


text: Q: Is there a simple example of converting image data into a transferrable data type that Javascript can read? Currently I'm using Python Websockets as a server and using Pure JS as the client. I want to be able to read an image in python, convert it into a data type like Base64 which is transferred to the client in JS, and decode that image into a readable format that I can use canvas for.


text:
Q: Модель подписчиков и подписок в EF Мне надо сделать что-то типо модели подписок и подписчиков на YouTube. Есть юзер он может иметь подписчиков, так же он может и сам подписываться на юзеров.
public class User : BaseId
{
    public string Login { get; set; }
    public virtual List<Subscription> Subscribers { get; set; }
    public virtual List<Subscriber> Subscription { get; set; }
}

public class Subscription : BaseId
{
    //info about publisher
    public int? UserId { get; set; }
    public virtual User User { get; set; }
    //info about subscriber
    public virtual User Subscriber { get; set; }
    public int? SubscriberId { get; set; }
}

public class Subscriber : BaseId
{
    //info about subscriber
    public virtual User User { get; set; }
    public int? UserId { get; set; }
    // link to subscription -> publisher
    public virtual Subscription Subscription { get; set; }
    public int? SubscriptionId { get; set; }
}

Сделал что-то такое, но при такой модели база не создается, вылетает ексепшинSystem.InvalidOperationException: "Unable to determine the relationship represented by navigation property 'Subscription.User' of type 'User'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'."
Как сделать такую модель правильно ? Чтобы все работало

A: Вам достаточно хранить в базе одну таблицу (помимо дефолтной Users): на кого подписались.
public class User
{
    // Кто подписан на User
    public virtual List<Subscription> MySubscribers  { get; set; }

    // На кого подписан User
    public virtual List<Subscription> MySubscriptions { get; set; }
}

public class Subscription
{
    // Кто подписался
    public int WhoId { get; set; }
    public User Who { get; set; }

    // На кого подписался
    public int ToWhomId { get; set; }
    public User ToWhom { get; set; }
}

При этом важно указать связи между сущностями:
public class SubscriptionConfiguration : IEntityTypeConfiguration<Subscription>
{
    public void Configure(EntityTypeBuilder<Subscription> builder)
    {
        builder.HasOne(x => x.ToWhom)
               .WithMany(x => x.MySubscribers)
               .OnDelete(DeleteBehavior.Restrict);

        builder.HasOne(x => x.Who)
               .WithMany(x => x.MySubscriptions)
               .OnDelete(DeleteBehavior.Restrict);
    }
}


text:
Q: ACE Editor Autocomplete tooltip I'm actually trying to use the ACE Editor Autocomplete function.
I have added custom functions (and objects) to my script and I want to display them in my autocompletion.
I could display use the "caption", "value" and "meta" property. But I did not very well understand how the "score" work precisely.
And (the objective of this post) I would like to know how to display a tooltip (like the ones pre-registred).
For your information, I am using Lua mode and I need custom autocomplete, because I am using proxy objects for Moonsharp.
Thank's and best regards.

A: add getDocTooltip method to your completer similar to https://github.com/ajaxorg/ace/blob/v1.2.8/lib/ace/ext/language_tools.js#L73


text:
Q: Cordova splash screen visible while navigation in multipage Android app We have a Multipage Cordova App for Android and iOS platform.
We have installed a few plugins like:

*

*cordova-plugin-network-information 0.2.15

*cordova-plugin-splashscreen - 2.1.1

*cordova-plugin-geolocation  0.3.12

*cordova-plugin-whitelist  1.1.1

*cordova-plugin-inappbrowser 1.0.2

All plug-ins are working fine on iOS platform. But, in Android cordova-plugin-splashscreen behaviour different. When we open the App, the splash screen is visible that is what the expected behaviour of that plug-in is.
But, when we navigate from one page to other there is a little delay in transition. During this transition the Splash screen is visible and this is very weird behaviour. Can anyone please help in this issue?
Technology stack:

*

*Cordova 4.2.0

*Installed Platform Android 4.0.2

*iOS 8.2

*Android 5.1.1

*API 22 Java 1.7 + Spring  for REST API

A: A splash-screen appears while your app is loading i.e. it depends on the complexity of the code. If it's running well on your iOS platform but showing up on Android platform - well the device that you are using to test has a slower performance rate?
If you are running on simulators, and not devices, then switch over to considering testing on devices.
UPDATE 1: Make sure you have this in your config.xml -
<param name="onload" value="true" />


text:
Q: Robot Framework HTML format for several MESSAGE in report I would like to define the * HTML * format of the "message" field in the robotframework report
For example: If I have a 1st error message defined with the message field of the Keyword 'Page should contains element'
The 2nd message will be defined in 'Set Test Message'
Code example:
Page should contains element | locator | message=Error message1

Another Keyword
Set test message | * HTML * <b>Error message2</b> | append=True

In report message block i have :
Error message1 < b >Error message2< /b >

If i set * HTML * in message= * HTML *Error message1 i can see * HTML * label in report
I would like define ${TEST MESSAGE}=* HTML * + ${TEST MESSAGE}

A: Ok .. need just to insert Set Test Message  | * HTML *${TEST MESSAGE} in teardown


text:
Q: Image Cropping/Resizing Solution I am looking into building an image uploading interface within Visualforce. I really want it to work similar to how the interface works when you upload your Chatter profile picture. The user should be able to upload an image, then crop the image to a thumbnail that has a locked aspect ratio. The file should then be resized to 120x120. Once the image is cropped, I need to send this to the server and save as an attachment. I only need to save the cropped version.
I know that there is no server-side Apex support for image manipulation. I'm looking at JS and image resize/cropping services to see if there is a decent solution.
Has anyone done something like this? Any recommended libraries and/or services to use?
P.S. If you want to see Apex support for image manipulation you should vote up this idea.

A: jcrop appears to do (link to google because github is down at the time of writing) what you're looking for, I doubt image manipulation would every be directly supported in Apex as it's not a feature likely to get a whole lot of use, but maybe it will happen!
I would definitely do this in javascript anyway as it would minimise the amount of back-and-forth with relatively large chunks of data if using the controller for updates which would be very slow relative to processing locally on the user's machine. Also I forget how big the heap is these days but it'd be easy to blow out with large image sizes since all manipulations would happen on decompressed image data, and bitmap data gets big fast.


text:
Q: OMR BubbleSheet Test Recognization I'm handling my last homework for the university in Spain (Business Adminstration), and I decided create a system that the Teacher insert the Exam correct answer, then download a model to give to the students do the exam, and after recieve the exams, he uploads it and the system compare the correct answers with the answers that the students did.
The model is this one:
answers sheet model

The model with correct answers: answer sheet correct:

Wrong answer exam: wrong answer exam:

I could develop the backend in Django, they can do everything before the test corrector.
Of course I tried multiple ways (Bubblesheet OMR on google and we have a lot of people doing the same test using the same example: https://pyimagesearch.com/2016/10/03/bubble-sheet-multiple-choice-scanner-and-test-grader-using-omr-python-and-opencv/ ), I found more examples, but the most closer one was : Detect All Circles in an image (Optical Mark Recognition) using Python OpenCV , but not worked in my example file.
Can someone help me please?
Here you have the three options. The Idea is that the teacher will upload all the PDF files, then is transformed into img (i did it using pdf2image), and then the corrector system loop in all the images/pdf correcting and given the scores of the students.


text:
Q: Card Game Program: Design First some background...
I'm currently working on a "practice project" to keep up and refine my programming skills. The project is a card game system (similar to MTG and other trading card games). I currently have the following concepts implemented:
There are Players that can be created/saved/loaded, which contain profile information, win/loss statistics, and a list of Decks. Each Deck contains a list of Cards (they are actually instantiations of the four different Card types, not the abstract Cards themselves), which have all the attributes needed for game-play.
The issue...
Saving Players, Decks, and Cards is unnecessarily redundant. If there are multiple Decks with the same Cards or multiple Players with similar Decks, then the program will be saving the same Cards over and over again. For Example: If Card A is very popular, then Players will put multiple copies into multiple Decks. So, the same card will be saved over and over again.
Conceptual solution...
The idea is that Players and Decks are unique, but Cards are from a common pool (a set or collection that everyone can use to build Decks). Therefore, I have created a directory for saving/loading Players and their Decks and a separate directory for storing individual Cards that are part of a set. I would like saving and loading of Players and Decks to utilize Card IDs, which will then reference the Card directory for loading and instantiating the actual objects. Additionally, the reverse needs to happen upon saving (not saving the Deck with Cards, but with Card IDs).
The question(s)...
Is there a design pattern I should be utilizing to help with the saving/loading based on IDs? Should I break up Decks into Decks for game-play and Deck lists for storage? Should I created and store PlayerProfiles with DeckLists and use those to save/load Players and Decks?
NOTE: If you would like to see the code, let me know. It's just too much to post right here.

A: What you are looking for is the flyweight design pattern.  Instead of storing a full copy of whatever a card is, you're just storing something like 5C, 8D etc.  Your application should be able to "decode" that into the full object.


text:
Q: Mongo project test if value is in array In a project step of a mongo aggregation, I'd like to create a boolean field like:
{
  $project: {
    isInArray: { $cond: [
      { $in: ['$_id', ids] },
      { $const: true },
      { $const: false },
    ] },
  },
},

but this is failing with
 invalid operator $in

I could not find documentation on the correct syntax

A: You can use $setIsSubset operator
db.people.aggregate([
 { $project: {
    isInArray: { $cond: [ {$setIsSubset: [['$_id'], ids]}, true, false ] }
 }}
])


text:
Q: Não consigo exibir minhas informações no banco de dados? segue abaixo meu código. Quando eu coloco minhas informações e clico em cadastra. porque minhas informações não aparecem no banco de dados?
---------Registrar.php-----------
<?php

    require_once "db.php";

    if(@$_GET['go'] == 'registrar'){
    $Nome = $_POST['Nome'];
    $Sobrenome = $_POST['Sobrenome'];
    $Email = $_POST['Email'];
    $Senha = $_POST['Senha'];

     $sql = "INSERT INTO `mycrush (`Nome`, `Sobrenome`, `Email`, `Senha`) VALUES ('$Nome', '$Sobrenome', '$Email', '$Senha')";
     $result = mysqli_query($sql);

      if (!$result) {
        echo "
Desculpe, houve um erro ao registrar...
";

      }else{
        echo("Dados inseridos com sucesso!");
        setcookie($Email,"login");
        echo "";
        header("Location: login.php");
     }
   }
?>

---------login.php-----------
<?php
    require_once "db.php";

        if(@$_GET['go'] == 'login'){
        $Email = $_POST['Email'];
        $Senha = $_POST['Senha'];
        $verifica = mysqli_query("SELECT * FROM 'mycrush' WHERE Email = '$Email' AND password='$Senha'");
        if (mysqli_num_rows($verifica)<0) {
            echo "
Palavra-passe ou e-mail errados!
";
        }else{
            setcookie($Email,"login");
            header("location: index.php");
        }
    }

?>

---------index.php-----------
<?php

include("db.php");
echo "Se você conseguiu abrir está página é porque deu certo!!!!";

?>

---------db.php-----------
<?php

$con = mysqli_connect("127.0.0.1", "root", "");
$db = mysqli_select_db($con, "clientes");

if(!$con) {
    die("Não foi possível conectar ao banco de dados; " . mysqli_error());
}

?>


text:
Q: I am using angular 2 angular-cli and try to use ng2-datetime,but it give error "TypeError: Cannot read property 'jQuery' of undefined" I installed the angular2 cli using command "npm install -g angular-cli" and I want to use ng2-datetime in my project.But it is showing error "TypeError: Cannot read property 'jQuery' of undefined".How can I use ng2-datetime in angular2 cli.
Here is link for ng2-datetime enter link description here
I want to include above ng2-datetime.
I got the following error.

Here is my app.module
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { Ng2PlayRoutingModule } from './app.routing'; import { AppComponent } from './app.component'; import { GridviewComponent } from './dashboard/gridview/gridview.component'; import { DetailsComponent } from './dashboard/details/details.component'; import { Logincomponent } from './login/login.component'; import { DashboardComponent } from './dashboard/dashboard.component'; import { DrilldownComponent } from './dashboard/drilldown/drilldown.component'; import { DropdownModule } from 'ng2-bootstrap'; import { WorkbenchComponent } from './workbench/workbench.component'; import { TasksComponent } from './workbench/tasks/tasks.component'; import { TaskdetailsComponent } from './workbench/taskdetails/taskdetails.component'; import { TopnavComponent } from './shared/topnav/topnav.component'; import { FieldfilterPipe } from './shared/pipes/fieldfilter.pipe'; import { LimitFirstNPipe } from './dashboard/details/limit-first-n.pipe'; import { DatepickerDirective } from './shared/directives/datepicker.directive'; import { CalendarComponent } from './workbench/calendar/calendar.component'; import { DateFilterPipe } from './workbench/calendar/date-filter.pipe'; import { StopscrollDirective } from './shared/directives/stopscroll.directive'; import { CapitalizePipe } from './workbench/tasks/capitalize.pipe'; import { ConfirmDeleteDirective } from './shared/directives/confirm-delete.directive'; import { NumberPipe } from './shared/pipes/number.pipe'; import { FilterPipe } from './shared/pipes/filter.pipe'; import { PriorityPipe } from './shared/pipes/priority.pipe'; import { TopnextnavComponent } from './shared/topnextnav/topnextnav.component'; import { ActiveTabDirective } from './shared/topnextnav/active-tab.directive'; import { AtozPipe } from './shared/pipes/atoz.pipe'; import { ExcludePipe } from './shared/pipes/exclude.pipe'; import { AddtaskComponent } from './workbench/addtask/addtask.component'; import { MomentFormatPipe } from './shared/pipes/moment-format.pipe'; import { JqteEditorDirective } from './shared/directives/jqte-editor.directive'; import { MultiselectComponent } from './shared/md2-comp/multiselect/multiselect.component'; import { TimepickerComponent } from './shared/md2-comp/timepicker/timepicker.component'; import { JquerydatepickerDirective } from './shared/directives/jquerydatepicker.directive'; import { DatefilterPipe } from './shared/pipes/datefilter.pipe'; import { Injectable } from '@angular/core'; import { EventService } from './shared/service/event.service'; import { DrilldownService } from './dashboard/drilldown/drilldown.service'; import { ActiveTab } from './shared/directives/activetab.directive'; import { NKDatetime } from 'ng2-datetime/ng2-datetime';

//import { NKDatetimeModule } from 'ng2-datetime/ng2-datetime';

@NgModule({   declarations: [
    AppComponent,
    GridviewComponent,
    DetailsComponent,
    Logincomponent,
    DashboardComponent,
    DrilldownComponent,
    WorkbenchComponent,
    TasksComponent,
    TaskdetailsComponent,
    TopnavComponent,
    FieldfilterPipe,
    LimitFirstNPipe,
    DatepickerDirective,
    CalendarComponent,
    DateFilterPipe,
    StopscrollDirective,
    CapitalizePipe,
    ConfirmDeleteDirective,
    DateFilterPipe,
    NumberPipe,
    FilterPipe,
    PriorityPipe,
    TopnextnavComponent,
    ActiveTabDirective,
    AtozPipe,
    ExcludePipe,
    AddtaskComponent,
    MomentFormatPipe,
    JqteEditorDirective,
    MultiselectComponent,
    TimepickerComponent,
    JquerydatepickerDirective,
    JquerydatepickerDirective,
    ActiveTab,
    NKDatetime   ],   imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    Ng2PlayRoutingModule,
    DropdownModule   ],   // exports: [NKDatetime],   providers: [EventService,DrilldownService],   bootstrap: [AppComponent] }) export class AppModule { }

drilldown.component.html

                <datetime [timepicker]="false" [(ngModel)]="date"></datetime>

A: Try the below steps:

*

*install "ng2-datetime": "1.2.1"

*install "@types/jquery": "^2.0.33"

*specify "types": ["jquery"] within tsconfig.json
This worked for me.


text:
Q: Unable to push metrics in prometheus I am trying to push metrics in Prometheus using Pushgateway but not able to complete the task.
This is the code:
var  client = require('prom-client');
var gateway = new client.Pushgateway('http://localhost:9091');
gateway.pushAdd({ jobName: 'test', group : "production" }, function(err, resp, body){

});

Prometheus config:
scrape_interval:     15s
evaluation_interval: 15s

external_labels:
      monitor: 'codelab-monitor'

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

scrape_configs:
  - job_name: 'example-random'
    scrape_interval: 5s

static_configs:
  - targets: ['localhost:8080', 'localhost:8081']
    labels:
      group: 'production'

  - targets: ['localhost:8082']
    labels:
      group: 'canary'

scrape_configs:

  - job_name: 'test '
    static_configs:
      - targets: ['localhost:9091']

A: You've a few problems with your prometheus config - check out the Prometheus github repo example and the docs for future reference.
One issue is that you have multiple scrape_configs.
You can only have one scrape_configs in your configuration for Prometheus.
Another issue is that each job can only have one static_configs.
The rest is mainly due to incorrect formatting.
The edited config below should work for you now:
global:
  scrape_interval:     15s
  evaluation_interval: 15s

  external_labels:
    monitor: 'codelab-monitor'

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'production'
    static_configs:
      - targets: ['localhost:8080', 'localhost:8081']
        labels:
          group: 'production'

  - job_name: 'canary'
    static_configs:
      - targets: ['localhost:8082']
        labels:
          group: 'canary'

  - job_name: 'test'
    static_configs:
      - targets: ['localhost:9091']

It's also important to note that the metrics from the Pushgateway are not pushed to Prometheus. Prometheus is pull based and will pull the metrics from the Pushgateway itself. The metrics the Pushgateway collects are pushed to it by ephemeral and batch jobs.