text:
Q: How to update only one Fragment (page/item) of a ViewPager? I have a ViewPager with a PagerTitleStrip which is filled with a FragmentStatePagerAdapter which is filled with fragments which contains just a single text. These texts are stored in a array of texts with 11 positions, one per each fragment of the ViewPager.
The problem is that some of the texts in the array are being updated each X seconds, so I must find the way of update ONLY the fragment corresponding to that text. When I update the array of texts, I know the position of that array, so i know the number of the fragment inside the viewpager which must be updated. but there is a problem, I don't know a way to update just that fragment.
I only know how to update all of them at same time, using notifyDataSetChanged() and returning POSITION_NONE at getItemPosition of my FragmentStatePagerAdapter. This strategy does not work, because all of them are updated and the same time and this generates an abnormal behaviour (scroll is lost in the page you are seeing, if you are swipping between pages when the notifyDataSet function is called you loss your swip movement, etc...)
So I need help with this, because I'm totally lost with how to solve this.
This is my current source code:
This is my adapter:
public class CollectionPagerAdapter extends FragmentStatePagerAdapter {
    public CollectionPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int i) {
        Fragment fragment = new ObjectFragment();
        Bundle args = new Bundle();
        args.putString(ObjectFragment.ARG_TEXT, children[i]);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public int getCount() {
        return infoTitlesArray.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return infoTitlesArray[position];
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }
}

The ViewPager which has the problem:
<android.support.v4.view.ViewPager
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v4.view.PagerTitleStrip
            android:id="@+id/pager_title_strip"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:paddingTop="4dp"
            android:paddingBottom="4dp"
            style="@style/CustomPagerTitleStrip"/>
    </android.support.v4.view.ViewPager>

Layout of the fragment:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbarSize="5dip"
    style="@style/CustomScrollBar">
    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="left"
        android:textSize="16sp"
        android:padding="5dp"
        style="@style/CustomTextView"/>
</ScrollView>

Thank you very much.

A: Fragment of a ViewPager can be found by using tag,
In Activity
Fragment fragmentToShow = getSupportFragmentManager().findFragmentByTag(
              mCollectionPagerAdapter.getFragmentTag(R.id.pager, position));

In FragmentStatePagerAdapter
 public String getFragmentTag(int viewPagerId, int fragmentPosition) {
    // This is the format in which FragmentStatePagerAdapter internally set's  the fragment tag.
    return "android:switcher:" + viewPagerId + ":" + fragmentPosition;
  }


text:
Q: Jave getparameter with # in it Say I have the URL:
http://185.112.249.77:9999/Api/Search?search=#9QLU9CY8
And then code:
String search = request.getParameter("search");
Then search is blank...
I need a way to get around this. The url is visited directly. Is there something I can do in Tomcat's config to make this work?
I tried replacing "#" with "%23" with a search.replace but that also didn't work.
Thanks!

A: That's because the '#' character is not part of the parameter but is a fragment identifier. So your parameter is actually empty
see this link to get more info about url params structure
[https://www.rfc-editor.org/rfc/rfc3986#section-3.5]
Or
[https://www.rfc-editor.org/rfc/rfc3986#appendix-A]
For the formal definition

redpajama_set_name: RedPajamaStackExchange


text:
Q: PHP Function stopped with PHP 7.4 I used to use this function inside a form on my site.
<input
  id="domainPageLimit"
  name="domainPageLimit"
  class=""
  type="text"
  value="<?= display_form_value($domain['domainPageLimit'], ($_SESSION['form_data']['domainPageLimit'] ?: null )) ?>"
  <?= admin_edit_only() ?>
/>

My function display_form_value() would pull data if it existed in the database for this particular user.  The $_SESSION['form_data'][domainPageLimit] was the info the user submitted on a form, in case they were sent back due to validation errors.
What I wanted to happen was if the display_form_value() was not set and the form_data was not set, it would return the value of NULL to the form to eliminate the "variable not set" error PHP was throwing.
With PHP 7.3, it was working fine.
With PHP 7.4, I receive this error in the browser: "Trying to access array offset on value of type null".
Has the (value ? value ?: value) function changed from 7.3 to 7.4?


text:
Q: Problem with fontspec and LuaLaTeX I want to write in french, using Lualatex using TexStudio. Therefore, I need to use characters like é, è or à.
As Lualatex uses UTF-8 there should not be any problem, but those characters are not displayed. As a workaround, I use \usepackage[T1]{fontenc} but the compiler gives me a warning message (with or without the fontenc package) :
Add \usepackage{fontspec} to the(frenchb.ldf) preamble of your document

Here is a MWE :
\documentclass[a4paper]{article}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\begin{document}
    Hi, I want to use characters like :  é, à, è, ï, î.
\end{document}

The problem is : when I add the package fontspec, the compiler gives me an error and the compilation never reaches an end. The error message is the following :
tput: No value for $TERM and no -T specified

Here is a code that generates the error :
\documentclass[a4paper]{article}
\usepackage{fontspec}
\begin{document}
    Hi, I want to use characters like :  é, à, è, ï, î.
\end{document}

EDIT: The problem seems to come from the external call of LuaTex (-shell-escape) needed, in my case, for PGFPlots externalization.

A: Too long for a comment and partially an answer:
I'm using this MWE for Emacs:
\documentclass[a4paper]{article}
\usepackage{fontspec}
\begin{document}
    Hi, I want to use characters like :  é, à, è, ï, î.
\end{document}

%%% Local Variables:
%%% TeX-master: t
%%% TeX-PDF-mode: t
%%% TeX-engine: luatex
%%% TeX-command-extra-options: "-shell-escape"
%%% End:

Please make sure that -- after saving the file -- you run the command TeX-normal-mode, usually bound to C-c C-n . Then compile. Works here on Windows...


text:
Q: Slideshows not working, what is the issue with my code? HTML CSS Javascript I use a Slideshow on my website to post images for blog articles. When I went to add more than one slideshow to my article, the slideshows stopped working altogether. Currently, if this code is ran as is, it will not load any of the images onto the screen. It would only show the arrows that can be clicked with no action occurring thereafter. I have below the code used for this in HTML, CSS, Javascript. If someone can somehow get this working for me, I would greatly appreciate it.
HTML:

1 / 2

Text here

2 / 2

Text here

❮❮
❯❯

1 / 2

caption here

2 / 2

caption .

❮❮
❯❯

CSS:

    /* Article Image */

.the-article-imgs {
  height: 100%;
  max-width: 990px;
  min-width: 100%;
  width: 100%;
}

.the-article-imgs-caption {
  text-align: center;
}

.the-article-imgs-vert {
  height: 45%;
  max-width: 456px;
  min-width: 54%;
  width: 100%;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Slideshow Image Code */

* {box-sizing: border-box}

.mySlides, .mySlides1, .mySlides2, mySlides3, .mySlides4, .mySlides5, .mySlides6:first-of-type, {display: block;}

.mySlides, .mySlides1, .mySlides2, mySlides3, .mySlides4, .mySlides5, .mySlides6 {display: none;}

/* Slideshow container */
.slideshow-container {
  max-width: 1000px;
  position: relative;
  margin: auto;
}

/* Next & previous buttons */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  padding: 16px;
  margin-top: -22px;
  color: blue;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
}

/* Position the "next button" to the right */
.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

/* On hover, add a black background color with a little bit see-through */
.prev:hover, .next:hover {
  background-color: rgba(0,0,0,0.8);
}

/* Caption text
.text {
  color: #f2f2f2;
  font-size: 15px;
  padding: 8px 12px;
  position: absolute;
  bottom: 8px;
  width: 100%;
  text-align: center;
}*/

/* Number text (1/3 etc) */
.numbertext {
  color: #f2f2f2;
  font-size: 12px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
}

/* The dots/bullets/indicators */
.dot {
  cursor: pointer;
  height: 15px;
  width: 15px;
  margin: 0 2px;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.6s ease;
}

.active, .dot:hover {
  background-color: #717171;
}

/* Fading animation */
.fade {
  animation-name: fade;
  animation-duration: 1.5s;
}

@keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
}

/* On smaller screens, decrease text size */
@media only screen and (max-width: 300px) {
  .prev, .next,.text {font-size: 11px}
}

Javascript:

let slideIndex = [1,1];
let slideId = ["mySlides1", "mySlides2"]
showSlides(1, 0);
showSlides(1, 1);

function plusSlides(n, no) {
  showSlides(slideIndex[no] += n, no);
}

function showSlides(n, no) {
  let i;
  let x = document.getElementsByClassName(slideId[no]);
  if (n > x.length) {slideIndex[no] = 1}
  if (n < 1) {slideIndex[no] = x.length}
  for (i = 0; i < x.length; i++) {
     x[i].style.display = "none";
  }
  x[slideIndex[no]-1].style.display = "block";
}

A: the script needs to be downloaded in parallel to parsing the page. you need to add async when calling your js file


text:
Q: Issue in creation of SQLite database in Doxygen 1.9 I have recently tried retrieving the output from Doxygen using SQLite output format. The documentation of Doxygen specifies that if GENERATE_SQLITE3 = YES then the output would be in sqlite.db. However when I do it, I get the following warning -
warning:ignoring unsupported tag 'GENERATE_SQLITE3' at line 8, file Doxyfile.
The SQLite database is thereby not created. I have SQLite installed in the system.
The version of Doxygen is 1.9 - Cloned from Git repository - https://github.com/doxygen/doxygen
The following is my Doxygen config file (Doxyfile) -
INPUT = //Some C Files
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
REFERENCES_RELATION = YES
REFERENCED_BY_RELATION = YES
GENERATE_XML = NO
GENERATE_SQLITE3 = YES
SQLITE3_OUTPUT = sqlite
SQLITE3_RECREATE_DB = YES
XML_PROGRAMLISTING = NO
GENERATE_HTML = NO
GENERATE_LATEX = NO

Is there any other configuration that I am missing here?

A: To be able to use the SQLITE3 features in doxygen, doxygen hast to be created in the CMake step with-Duse_sqlite3=ON.
In the current documentation a note was missing specifying this, a proposed pull request has been submitted in the mean time (https://github.com/doxygen/doxygen/pull/8412).


text:
Q: Break not working as expected inside python if statement for empty cells Cant figure out why the break is not working below:
Loaded the already existed excel file using openpyxl.
I tried printing the values before break, and it does print the row values that are empty. This confirms that the inside of loop is executed.
def x(ws):
    for row in ws.iter_rows(min_row=11,max_row=50,min_col=4,max_col=4):
            for cell in row:
                if cell.value is None:
                    next_index=int(cell.row)
                    break

    print('The return is: ')
    print(next_index)

    return next_index

All I want is exit the loop with the first cell empty on that range but instead getting the last row i.e 50 return, where as expected return is 11.

A: Your break statement will only break out of the inner for loop. Here's another relevant stackoverflow question: How to break out of multiple loops in Python?
As suggested there you can just return next_index from the inner for loop instead of trying to break out of both loops to return the appropriate value.


text:
Q: How to decompile iOS apps? I want to see the code of an iOS app.
The app I downloaded is .deb.
First question: Is it possible to install .deb file on iOS or I downloaded a wrong file?
After unpacking the .deb file, I got some files, including .nib, .storyboard and some other files.
My main question is, How to decompile these .nib files?
I tried to decompile these files using NibToXibConverter, but I didn't succeed.

A: Answer to your first question:
I think you downloaded the wrong file. .deb files for iOS are common for jailbreak community and not for apps, I think all of the Cydia stuffs are packed into .deb's. If your app is especially made for the jailbreak scene then you may try to install it using Cydia's auto install feature on a jailbroken device.
Answer to your main question:
This is general info about decompiling and modifying iOS apps (not specific for nibs, but you may still find it useful).
iOS apps are distibuted in .ipa archives, which are ordinary zip archives. They contain, usually one executable in the form of Mach-O file, and resources like .plist, sounds, images - every resource you include in your xcode project. Decompiling the executable file is only possible on jailbroken iDevice, because it is encrypted especially for the current device and the magic key to decrypt the binary is burned inside the device CPU and as far as I know there is no software way to read that key. The encryption system here is called FairPlay.
Briefly described, one way to decrypt that binary is to have the app installed on a jailbroken device, and launch it from command line using a debugger (gdb) which you can download from Cydia. You have to set a breakpoint somewhere, and when your code execution pauses at the breakpoint, you are doing a memory dump of the device ram - and that is your decrypted bin.
So when you have the decrypted binary, you can run one tool called "class-dump", and get the information for declared classes and their methods if the app is written in Objective C. Once you know this information you can alter the implementation of given method from some class used in your app using "Cydia Subtstrate" a.k.a "Mobile Substrate". In fact that is the way all of the jailbroken iOS tweaks are made. Basically you are hooking a method call, and when that method get invoked, it uses your implementation. Furthermore your implementation can call the original implementation, and that is really useful if you want to make some small code addition.
I am not sure whether those things possible in Swift, but if you are dealing with a Hybrid app like the ones done with cordova, phonegap, etc., then you can see all of its javascript source because it is persisted as a resource inside the "ipa" file. In addition you can alter that javascript code directly if you have a jailbroken device and find where the app is installed on file system (usually /var/containers/Bundle/Application/uuid_for_your_app/). However, I think there is no way to get that patched version and redistribute it (correct me if I'm wrong).


text:
Q: Why aren't electrons accounted for when calculating the energy of nuclear decay? In my physics exercises, I had to calculate the energy generated by the decay of an atom of the isotope 40 of K by Beta - decay.
It gives us the products: isotope 40 of Calcium and one electron.
When calculating the energy generated, using $Q = \Delta m * c^2$, I ended up with the wrong answer. However, when I didn't account for the electron in the $\Delta m$, I got the right answer.
Why isn't the electron accounted for in this reaction?


text:
Q: USB not detected with Ubuntu 16.04 This is what I got with
sudo fdisk -l
Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 484214783 484212736 230.9G 83 Linux
/dev/sda2       484216830 488396799   4179970     2G  5 Extended
/dev/sda5       484216832 488396799   4179968     2G 82 Linux swap / Solaris

Disk /dev/sdb: 15 GiB, 16106127360 bytes, 31457280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors Size Id Type
/dev/sdb1  *       32 31457279 31457248  15G  c W95 FAT32 (LBA)

and
lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk
├─sda1   8:1    0 230.9G  0 part /
├─sda2   8:2    0     1K  0 part
└─sda5   8:5    0     2G  0 part [SWAP]
sdb      8:16   1    15G  0 disk
└─sdb1   8:17   1    15G  0 part
sr0     11:0    1  1024M  0 rom

I have tried to mount it but
sudo mount -t vfat /dev/sdb1 /media/milenko/flashdrive/
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

With gparted,does not appear sdb

What should I try?

A: will it mount in windows? I had this once and the USB's disk format was bad. Only solution was to use gparted to completely reformat it (hopefully you won't have to).

A: Just a warning regards an attached USB device which appeared to be effectively useless: 'bad superblock', huge bad-block list, gparted identified it, but couldn't select it, smartmontools "read device identity failed", etc. In my case, a Seagate 3TB usb drive. I was just about to throw in the towel and try to do a hard-reformat, but decided instead to power-cycle everything, re-boot (but not re-mount the USB drive), and do a blkid to see if Ubu 16.04 could detect it. It did, I re-mounted it, and found the 2TB of archives I had been storing were still there, and apparently intact.
I'm assuming there is an intermittent hardware problem (due to periodic lengthy write-retries), and the drive is no longer reliable. However, still have a decent chance of recovering most of the archival data.
Update: Apropos 'smartmontools' & 'read device identity failed'...
https://bugzilla.redhat.com/show_bug.cgi?id=1334569
(The above link appears to provide work-arounds to the error conditions I encountered, specific to external USB3 Seagate Expansion Disk with USB IDs 0bc2:3312, using smartmontools.)


text:
Q: What is the format for writing Teradata Functions? For a project I'm working on we are asked to create Teradata Functions from Teradata Views, I looked on the documentation online, and I couldn't find any really clear examples on how the format should be written for this.
Does anyone have experience writing Teradata Functions in SQL or Java that could just give me a generic example of how to produce a function?


text:
Q: HTML video tag: unnecessary delay between last and first frame My situation: I want to post a short video (1 sec) on a page. In this case, it is necessary to loop it. For this I use the <video loop ...> tag. Everything works fine, but when the video ends, there is a slight delay in the Firefox browser between the last and first frame (0.5 sec). At the same time, I do not observe such behavior in Chrome.
To solve this problem, I tried various techniques:

*

*I tried to draw video in <canvas> tag

*I tried to listen to the "ended" event and rewind the video by 0 second when it occurs

*Reduce video quality to incredible levels. The video had a lot of artifacts

*Used HandBrake with "Web optimized" option

All of these methods failed.
To demonstrate this, I created a 1 second video (60 FPS) where you can see the delay between the last and first frame if you open it in the Firefox browser: https://codesandbox.io/s/unnecessary-delay-between-last-and-first-frame-5dwnfb?file=/index.html
How do you think this can be resolved?
Thanks!


text:
Q: How to exhaustively see queries Django is running? I am optimizing a big part of my code so I am trying to reduce the database hits to the minimum and try to grab all necessary data in big but few queries and cache it.
However I have not found an effective way of seeing whether Django is actually running a query against the database or whether it is returning cached or prefetched data.
Ideally, I want to debug the relevant parts of my code line by line and each raw SQL query should be displayed as they are executed. Essentially some kind of listener that logs every query that is run as soon as it is run.
This way to check running queries suggested by the docs is not good enough, as it only displays queries formed in the same file where you access connection.queries, apparently.
Accessing QuerySet.query is no good either, as it requires a, well, QuerySet object. There are other scenarios where queries are run against the database but the return type is not a QuerySet.
I am not sure the Django Debug Toolbar would work either, because I don't want my behavior wrapped in a view, I want to execute an independent script and thoroughly debug it.

A: You can try changing LOGGING config, for example in your settings.py (logs all your queries if you DEBUG is True):
LOGGING = {
    'version': 1,
    'filters': {
        'require_debug_true': {
            '()': 'django.utils.log.RequireDebugTrue',
        }
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'filters': ['require_debug_true'],
            'class': 'logging.StreamHandler',
        }
    },
    'loggers': {
        'django.db.backends': {
            'level': 'DEBUG',
            'handlers': ['console'],
        }
    }
}

A: Yes, You should use the django-debug-toolbar for that. It will display each query made on some view, if that code you want is like, inside some Model or other python file and sometime is called for some view. Even if it is as a signal on model, for instance. It will be caught by the debug-toolbar.
Another option is tu use the python manage.py shell to call those queries. You can use the django-extensions with the --print-sql parameter in order to display it.
Or, print the sql it self, I usally do this:
>>> qs = User.objects.filter(username='luan')
>>> print(qs.query)
SELECT "users_user"."id", "users_user"."password", "users_user"."last_login", "users_user"."is_superuser", "users_user"."username", "users_user"."first_name", "users_user"."last_name", "users_user"."email", "users_user"."is_staff", "users_user"."is_active", "users_user"."date_joined", "users_user"."ref_id", "users_user"."created_on", "users_user"."updated_on" FROM "users_user" WHERE "users_user"."username" = luan ORDER BY "users_user"."id" ASC


text:
Q: Building raw disk images: best way to delete files for compression? I'm building raw disk images (ie, dd, chroot to install linux). During the customization process I may delete files, use temporary files, etc.
What is the best way to delete these files to ensure the image is most compressible?
I'm assuming if I simply rm the file, it's just deleting records from the FAT to mark the blocks as available. This leaves the data in place, so when I gzip or bzip2 the image it still has to pack that data up. I assume things would be a lot tighter if I could tell the FS to write zeros to the blocks instead.
A bit of detail: these are CentOS 6.4 installs on ext4, but I would expect the answer applies to most linux distros using most file systems. The base filesystem I generate is via a command like dd if=/dev/zero of=filesystem.image bs=1M count=10240. A typical 10GB disk image from a vanilla install will compress down to roughly 500MB. I bet if I did a more aggressive cleanup of temp files and such, I could get it a lot tighter.
Thanks!

A: Zoredache's comment got me on the right track (see How to zero fill a virtual disk's free space on windows for better compression?).
As far as I can tell, zerofree homepage is http://intgat.tigress.co.uk/rmy/uml/index.html. There are two things hosted here: the zerofree tool and a kernel patch. The kernel patch does not work with ext4, but adds the ability to set a mount flag to zero out files on delete. The zerofree program does work on ext4.
There are no zerofree CentOS 6 RPM's available, but I was able to compile it on CentOS6 using the CentOS5 srpm.

A: You can create a file/files containing only zeroes, to fill up the filesystem free space. The blocks marked as free will then be overwritten with zeroes.
Afterwards, delete these files.
Update:
Since this answer has been downvoted, I decided to test whether this is actually true or my knowledge is wrong. So far it looks like this is working as I expected.
I created two images with the same command as OP, except I made it 1G in size, since this is for testing purpouses:
dd if=/dev/zero of=img1.im bs=1M count=1024
dd if=/dev/zero of=img2.im bs=1M count=1024

I then proceeded to format the image files as ext4, mount them on separate directories and copy two directories containing pictures on both images. One directory was 71M and the other — 461M. Afterwards, I deleted the 461M directory from both mountpoints.
So far all the actions were identical. I then left the first image alone and created a zerofile taking up all free space on the second one, deleting it afterwards:
dd if=/dev/zero of=img2/zerofile bs=1K count=884644
rm img2/zerofile

df once again showed that the filesystems were filled the identically (system partitions removed for clarity) :
$ df
Filesystem                 1K-blocks      Used Available Use% Mounted on
/dev/loop0                    999320     62248    884644   7% /home/black/temp/img/img1
/dev/loop1                    999320     62248    884644   7% /home/black/temp/img/img2

After umounting and compressing both images with bzip2, the output of ls speaks for itself:
$ ls -lh
total 604M
-rw-r--r-- 1 black users 523M apr 19 11:56 fs1.im.bz2
-rw-r--r-- 1 black users  81M apr 19 11:56 fs2.im.bz2

Although this might take longer of bigger images than just zeroing out the space that was actually used for files, this method is simple, effective and uses only dd so no additional tools are needed.


text:
Q: What is the correlation between programming language and experience/skills of their users? I'm sure there is such a correlation, because

*

*experience and skill leads good programmers to picking languages that are better for them, in which they're more productive, and

*working in a language forms how programmers think and influences their methods and skills.

Is there any research or some statistical data of this phenomenon?
Perhaps this is not a purely academic question. For example, if someone is starting a new project, it could be worth considering a language (among other criteria of course) for which there is a higher chance of finding or attracting experienced programmers.
Update: Please don't fixate on the last paragraph. It's not my intention to choose a language based on this criterion, and I know there are other far more important ones. My interested is mostly academic. It comes from the (subjective) observation and I wonder if someone has researched it a bit. Also, I'm talking about a correlation, not about a rule. Sure there are both great and terrible programmers in every language. Just that in general it seems to me there is a correlation.

A: There are languages that demand extra skill (assembly being a prime example), but in the vast majority of cases the programmer doesn't choose what language to work in.
Most of us spend our time either doing maintenance or adding features to an existing project, not starting new projects.  And even when starting a new project, there are many factors that go into choosing a language(s) -- mainly unrelated to what makes a language good or not.  The leading example for that, is that if you project includes a web presence, you're almost certainly going to be using javascript.
Basically, I think your hypothesis is incorrect.

A: At a guess, I would say there is a correlation, but only a vague one, not worth putting any real weight on.
A programmer may end up using or gaining experience in a certain language for many reasons.  Off the top of my head:

*

*$COMPANY has many projects in $LANGUAGE so I had to learn it

*Jobs using $LANGUAGE pay really well

*everyone says $LANGUAGE is the one to learn, either generally or for some application space

*$LANGUAGE is better supported (open to interpretation as well)

*$LANGUAGE has a bigger collection of libraries

*I learned $LANGUAGE at $EDUCATIONAL_COURSE and that's what I stuck with.

*$LANGUAGE is fun!

Google might give you some sites that show a correlation between langauage and wage, but that's differerent to expertise.
If you are starting a new project and want to choose a language that will get you good programmers, consider:

*

*Good programmers generally cost more and/or are harder to get into your project

*The best programmers know multiple languages, and can start using a new language with relative ease

A: There is no simple way to answer a question like this, I am unaware in any statistic information around this but I can speak about my own experance as a programmer and the companies and projects i have have worked on.
The choice of picking a programming Lagrange is around a few things like what your trying to make, how fast you are trying to make it, and if there are any other requerments like number of users and so on pretty much they way the call scale these days.
An example of this is, if your making the front-end of a web page your choices are things like, html, css, javascript, flash/action script. Now while making the web page you want to add an extra region to the page you cant really do it with javascript unless your using html with it and css can really only edit the look of it so your truly left with html and flash, now what ends up happening is the world is moving away from flash so writing a website in flash may hurt you because you may end up having to remake that feature again, people on some mobile devices like phones and tablets wont be able to see your work.
Now when it comes to back-end code it gets a little tricker, but its pretty safe to say you don't want to make your entire website in bash scripts if you plan on handling any number of users, and choices like java is popular but may be more overhead than you need to make your birthday investigation page. In the end its a lot to do with trade offs and experiences. For example i am working on a project right now and I am writing lots of the back-end clean up and data pulling in python but the user facing site in php. I suspect that I will need to change the python stuff to java in the feature but for now i just want to get the project up and will come back to something like java later.
Lastly don't be afraid to learn new things and push your limits, and question why is something done like this, that little extra knowledge can go a long way.

A: A language is a tool, and different tools are better suited for different jobs.  It is true that some languages require more skill than others, but that should not be the main criterion for choosing a language for a project. Look at your project, find out which languages are typically used for this type of project on whatever platform you plan to use, and then decide among them based on your chances of finding or attracting experienced programmers.
Also, it is not so much the language that forms how programmers think, but the programming paradigm(s) that it supports, i. e. imperative vs. functional vs. object oriented etc.  Java and C# programmers think in pretty much the same way. C++ programmers may think in a variety of different ways, depending on which subset of the paradigms supported by C++ they actually use.
The skill of a programmer is not in knowing any particular language but in knowing several languages that support different paradigms, and knowing them well.  That gives you the flexibility to quickly pick up whatever the current language du jour happens to be.

A: LinkedIn tracks some interesting statistics about a wide range of skills including programming languages.
https://www.linkedin.com/skills/skill/C%2B%2B?trk=skills-pg-search
https://www.linkedin.com/skills/skill/Java?trk=skills-pg-search
https://www.linkedin.com/skills/skill/x86_Assembly?trk=skills-rel-10
https://www.linkedin.com/skills/skill/C%23?trk=skills-pg-search
On these pages, you can see the name of the skill, a short description, links to related skills, a year on year trend (C++ went down 8%).  You can display a bar graph that shows relative growth vs. some technologies they pick for you, size of the pool of people using the language (913k for C++), or the age break down for people using the language (31% for 18-24, 45% 25-35, and 17% 35-45).  Java has about one million, and has a profile that is surprisingly similar.  C# has been trending -3% y/y, has a smaller base 617k, 18-24 23%, 25-34 50%, and 35-44 20%.
For a skill like x86 assembler, there is a pool on only about 12K users, and surprisingly, 25-34 year olds are 41%, 18-24 year olds are 29%.
Use of these numbers from LinkedIn has all kinds of complications because the population of software developers is not even among age groups (18-24 9%, 25-34 47%, 35-44 31%, 45-54 17% for the term Software Development), and some of counts may relate to who uses LinkedIn (it may under represent college students not yet looking for work and older professionals who are established and not looking for work or who use person-to-person networking more than online).
http://www.eweek.com/c/a/Application-Development/Java-Drops-From-Top-Programming-Language-Spot-C-Rules-626622/ talks about language popularity, but doesn't give any characterization with regard to developer preference vs. age.

A:
My interested is mostly academic. It comes from the (subjective) observation and I wonder if someone has researched it a bit. Also, I'm talking about a correlation, not about a rule.

Firstly, no I am not aware of any such research.
The problem is that it is would be hard to conduct this kind of (objective) research in a scientifically meaningful way.

*

*How do you objectively measure an individual programmer's "experience" and "skill"?  Self reporting is obviously going to give you unreliable answers, so you have to (somehow) test these things.

*How do you do it in a way that doesn't conflate these two measures with the other variables - specifically, the number of languages known and/or used?

*How do you do this in a way that involves real experienced programmers?  (You can't use the typical undergraduate CS student test cohort ... who are typically not experienced in any meaningful way.)
If you were a serious academic, you may be able to figure out a way to do this kind of thing.  But you would first need to justify the expense of conducting the research to a funding body.  And they would probably ask "What is the value of knowing the answer?".  And that is a hard question to answer ... IMO.


text:
Q: How to display a non matching value also? USING VB6 AND MS-ACCESS 2003
So on…,
TABLE 1
EMPID DATE

101 22-07-2009
201 22-07-2009
501 22-07-2009
301 23-07-2009
401 23-07-2009
501 23-07-2009
101 24-07-2009
501 24-07-2009

So on…,
From the above table two tables I want to display all EMP ids for the date wise
Expected Output
EMPID  DATE

101 22-07-2009
201 22-07-2009
301
401
501 22-07-2009
101
201
301 23-07-2009
401 23-07-2009
501 23-07-2009
101 24-07-2009
201
301
401
501 24-07-2009

So on…,
Need Query Help.

A: Without questioning your data model, to get the results you want you will need a third table (which I will call Dates) You need a Cross Join on Table 1 and Dates, which will give a result of all employees for all days. Then you need to Left Join to EmpID and Date.
The Left Join will include all of the results from the first join but only the matching rows from Table 2 will be populated. Access is funny in how it handles query structure, also it does not support the SQL-92 CROSS JOIN syntax, but it would look something like the below.
SELECT t1.EmpID, t2.Date
  FROM (
        SELECT t1.EmpID, d.Date
          FROM [Table 1] AS t1,
               Dates AS d
       ) AS DT1
       LEFT OUTER JOIN [Table 2] AS t2
          ON DT1.EmpID = t2.EmpID
             AND DT1.Date = t2.Date
 ORDER
    BY DT1.Date, DT1.EmpID;

A: Haven't executed to verify for sure, but this should get you most of the way there:
SELECT
    AllPossibleCardEvents.PersonId,
    AllPossibleCardEvents.EmpName,
    AllPossibleCardEvents.TitleCode,
    AllPossibleCardEvents.TitleName,
    AllPossibleCardEvents.CardEventDate,
    ActualCardEvents.CardEventDate AS MatchingCardEventDate
FROM
    (
        (
            SELECT
                p.PersonId,
                p.EmpName,
                p.TitleCode,
                p.TitleName,
                AllDates.CardEventDate
            FROM
                (SELECT DISTINCT CardEventDate FROM T_Cardevent) AllDates,
                T_Person p
        ) AllPossibleCardEvents
        LEFT OUTER JOIN T_Cardevent ActualCardEvents ON
            AllPossibleCardEvents.PersonId = Actual.PersonId AND
            AllPossibleCardEvents.CardEventDate = Actual.CardEventDate
    )

Where "MatchingCardEventDate" will be NULL for records that are NOT actual events.  For actual events, the value of "MatchingCardEventDate" will be the valid date.
Hope this helps.


text:
Q: Dart POST Response missing Headers I guess I'll move this to the top because none of what's been said so far addresses my question. There are some response headers in Postman that I don't get in Dart. I need to access those values in order for my application to work. How do I get access to the Headers that are in Postman but Dart doesn't seem to have?
I'm using the Dart/Flutter http package in general it does everything I need it to. What I've run into trouble recently is that it doesn't return some non-standard headers as part of a post request. For example, I'm trying to make the following request:
POST https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4/Patient?_format=json&_pretty=false
Headers: {"Content-Type": "application/fhir+json", "Authorization": "Bearer $BearerToken"}
Body: {"resourceType":"Patient","identifier":[{"type":{"coding":[{"system":"http://hl7.org/fhir/sid/us-ssn","code":"SB"}]
},"system":"urn:oid:2.16.840.1.113883.4.1","value":"444114567"}],"name":[{"use":"usual","text":"Derrick
Lin","family":"Lin","given":["Derrick"]}],"gender":"male","birthDate":"1973-06-03"}

Note, this request succeeds. It returns a Status Code of 201 and I've checked the server and the Patient is successfully created. However, the Response headers are:
{
  "cache-control": "no-cache,no-store",
  "content-length": 0,
  "content-type": "application/fhir+json; charset=utf-8",
  "expires": -1,
  "pragma": "no-cache"
}

Now, I've tried stopping this request right before posting so I ensure I have all of the correct parameters. And if I copy the same values into Postman, I still recieve a Status of 201, but I receive these as the Response Headers:
{
  "Expires": -1,
  "Location": "Patient/eoc0yXThvv5aQEdz-kjaSWQ3",
  "Allow-Control-Allow-Headers": "origin, authorization, accept, content-type, x-requested-with, Epic-User-ID, Epic-User-IDType, Epic-Client-ID, soapaction, Epic-MyChartUser-ID, Epic-MyChartUser-IDType",
  "Allow-Control-Allow-Methods": "GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS",
  "Allow-Control-Allow-Origin": "*",
  "Allow-Control-Allow-Credentials": true,
  "cache-control": "no-cache,no-store",
  "content-length": 0,
  "content-type": "application/fhir+json; charset=utf-8",
  "pragma": "no-cache"
}

I need access to these extra headers in dart, specifically the "Location" header. To answer one of the questions below, as far as the code for creating the request, the first is going through the some Oauth2 Code to get the Bearer token. After that, it's calling a POST method on a class that Extends http.Client.
  @override
  Future<http.Response> post(Uri url,
          {Map<String, String>? headers,
          Object? body,
          Encoding? encoding}) async =>
      await http.post(
        url,
        headers: await newHeaders(headers),
        body: body,
        encoding: encoding,
      );

  @override
  Future<Map<String, String>> newHeaders(Map<String, String>? headers) async {
    headers ??= <String, String>{};
    if (client?.credentials.accessToken != null) {
      headers['Authorization'] = 'Bearer ${client!.credentials.accessToken}';
    }
    headers.addAll(authHeaders ?? <String, String>{});
    return headers;
  }

And again, the request succeeds, it successfully posts the resource, the resource is created, and I get a 201 status code showing it was created. What I don't get is the full set of response headers.
Does anyone have any idea if I'm creating the request incorrectly, if this is something wrong with the http package, or something wrong with the Dart SDK?

A: There are CORS headers for allowing cross domain access to a web browser:
  "Allow-Control-Allow-Headers": "origin, authorization, accept, content-type, x-requested-with, Epic-User-ID, Epic-User-IDType, Epic-Client-ID, soapaction, Epic-MyChartUser-ID, Epic-MyChartUser-IDType",
  "Allow-Control-Allow-Methods": "GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS",
  "Allow-Control-Allow-Origin": "*",
  "Allow-Control-Allow-Credentials": true,

This is related to redirecting a web browser to a new location after creating a resource.
  "Location": "Patient/eoc0yXThvv5aQEdz-kjaSWQ3",


text:
Q: Facebook like and share button on ajax Background: - Am using ajax to get a entity called as "foo_posts". In this post am using facebook share and like button
{% for post in foo_posts %}

        {{ post }}

{% endfor %}
Now these posts are being populated using Ajax.
Problem: - The facebook like and share gets initialized by
$(function(d, s, id) {
              var js, fjs = d.getElementsByTagName(s)[0];
              if (d.getElementById(id)) return;
              js = d.createElement(s); js.id = id;
              js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=245185848840630";
              fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));

This is not working. How can I call this function, so that the like and share get populated properly ?
Should it be called in the ajax success function. (Right now am calling it on on page itself)
P.S :- I tried it in the success function. I guess am doing it wrong.

A: XFBML tags are only parsed on Facebook JS-SDK initialization by default.
You should call FB.XFBML.parse() method once you add social plugin to DOM after page is rendered.
You may call it for all document or by specifying element to search XFBML elements within:
FB.XFBML.parse();
// OR
FB.XFBML.parse(DOM_ELEMENT_WHERE_AJAX_CONTENT_IS_PLACED);

A: If you are using multiple facebook share buttons and you also have multiple social media share buttons, then you can totally skip to include all related js which can only slows your page speed, instead of share button and its js, use only link  to share your post,
And the best thing is using this method you do not have to do anything when you fetch html using ajax.
example of facebook share link:
https://www.facebook.com/sharer.php?u=[your-url]

You can use it as below:
Share on facebook

You can also use css to make this link as facebook button look, or you can use image of facebook or svg for facebook.


text:
Q: SQL full join in Java I'm trying to join two tables but can't get the SQL right. My SQL statement is far more complex than the below SQL but the below SQL will do to show the principle. I get an invalid identifier exception when trying to refer to t or p. How come I cannot refer to these? I'm using Oracle DB.
SQL:
SELECT * FROM ((SELECT * FROM transactions t) FULL JOIN (SELECT * FROM payments p) ON (t.id = p.trans_id));

Exception:
Caused by: java.sql.SQLException: ORA-00904: "P"."TRANS_ID": invalid identifier

A: You are not really giving your querys an alias, you should do:
SELECT *
FROM (SELECT * FROM transactions) t
FULL JOIN (SELECT * FROM payments) p
ON (t.id = p.trans_id);

Of course, assuming that you are using real derived tables instead of those simple SELECTs, otherwise you should just use the tables directly.

A: The aliases are in the wrong place. The alias for a derived table should be just after the closing parenthesis:
SELECT *
FROM
(SELECT * FROM transactions) t
FULL JOIN
(SELECT * FROM payments) p
ON t.id = p.trans_id

Note that it makes no sense to use derived tables with such a simple query. I assume that you do actually need the derived tables and that you just simplified your query for the question.


text:
Q: Discord.js V11 System Stats Command const Discord = require("discord.js");
var osu = require('node-os-utils')
var cpu = osu.cpu
var drive = osu.drive
var mem = osu.mem
var netstat = osu.netstat

module.exports.run = async (bot, message, args) => {var count = cpu.count()
cpu.usage()
  .then(cpuPercentage => {
    console.log(cpuPercentage)
  })
drive.info()
  .then(dinfo => {
    console.log(dinfo)
  })
mem.info()
  .then(minfo => {
    console.log(minfo)
  })

netstat.stats()
  .then(ninfo => {
    console.log(ninfo)
  })

  let systemEmbed = new Discord.RichEmbed()
  .setColor("RANDOM")
  .setTitle("Urban Bot System Stats")
  .addField("CPU Cores", count, true)
  .addField("CPU Usage", osu.cpu, true)
  .addField("Drive Usage", osu.drive, true)
  .addField("Memory Usage", osu.mem, true)
  .addField("Network Stats", osu.netstat, true)
  .addField("Logged In User", "Administrator", true)
  .addField("Operating System", "Windows Server 2016 Standard", true)

  message.channel.send(systemEmbed)
}

module.exports.help = {
    name: "system"
}

What the Embed Appears Like
I am trying to do a command that shows system stats. However once it is run on all of the fields it displays "object Object" could anyone help?
Please see the embed for more on what it looks like. It is in a file called system.js in the command handler. The main entry is index.js.


text:
Q: Syntax error iverilog I don't know why I have a problem with compiling my Verilog code.
I have these errors:

I have Icarus Verilog installed, and I checked it using the iverilog command. I also added the path for VSCode and for Iverilog.

Code:
`timescale 1ns/1ps
`include "not_example1.sv"

module testbench;
    parameter BITS = 4;
    logic [BITS-1:0] s_in;
    logic [BITS-1:0] s_model_outs;
not_example1     #(.NUM(BITS))   not_model    (.i_a(s_in), .o_y1(s_model_outs));

initial
    begin
        $dumpfile("signals.vcd");
        $dumpvars(0,testbench);

        s_in = '0;
        #1  s_in = '1;
        #1  s_in = '0;
        #1  s_in = '1;

        #1
        $finish;
    end
endmodule

A: This warning message tells you that you should use the  option named -g2005-sv when you run the iverilog command:

testbench.sv: warning: Using SystemVerilog 'N bit vector.  Use at
least -g2005-sv to remove this warning.

Some Verilog syntax, especially for features added to SystemVerilog (IEEE 1800), requires you to use special iverilog options.
This command fixes the errors and warnings for me:
iverilog -o testbench.vvp -g2005-sv testbench.sv

I have this version of iverilog installed:
iverilog -v
Icarus Verilog version 10.3 (stable) (v10_3)

To see the iverilog command usage, use the -h option:
iverilog -h
Usage: iverilog [-ESvV] [-B base] [-c cmdfile|-f cmdfile]
                [-g1995|-g2001|-g2005|-g2005-sv|-g2009|-g2012] [-g<feature>]
                [-D macro[=defn]] [-I includedir]
                [-M [mode=]depfile] [-m module]
                [-N file] [-o filename] [-p flag=value]
                [-s topmodule] [-t target] [-T min|typ|max]
                [-W class] [-y dir] [-Y suf] [-l file] source_file(s)

See the man page for details.

Also refer to the Icarus Verilog User Guide


text:
Q: How to get CPU usage in percentages At the moment I am using a python script to log the output from cat /proc/loadavg to a file. I then use gnuplot to periodically graph the CPU load for my viewing pleasure.
However, I really would like to have a graph that shows percentages of CPU usage (%user and %sys, etc.) instead. I can see that top can get to those numbers, since they are displayed at the third line of its output. However, I have not been able to figure out how or where top gets that information. Google is no help either, it just points me to either /proc/loadavg or problems people are having with high CPU loads.
Any hints on how I would be able to log those numbers (preferably as 5-minutes averages) to a file would be greatly appreciated.

A: RTFM: The manpage for top is a long read but eventually things became clear.
I'm now using this:
top -bn 1 |grep "Cpu(s)" | awk '{print "user: " $2+$6 "% syst: " $4+$12+$14+$16 "% wait: " $10 "% idle: "$8"%   Total: " $2+$4+$6+$8+$10+$12+$14+$16 "%"}'

Unfortunately it hardly ever perfectly totals at 100%
@boson:~ $ top -bn 1 |grep "Cpu(s)" | awk '{print "user: " $2+$6 "% syst: " $4+$12+$14+$16 "% wait: " $10 "% idle: "$8"%   Total: " $2+$4+$6+$8+$10+$12+$14+$16 "%"}'
user: 1.2% syst: 0.7% wait: 0.8% idle: 97.4%   Total: 100.1%
@boson:~ $

An alternative would be to install the sysstat package and use mpstat thusly:
@boson:~ $ mpstat | tail -1 | awk {'print "user: " $4+$5 "% syst: " $6+$8+$9+$10+$11+$12 "% wait: " $7 "% idle: " $13 "%   Total: " $4+$5+$6+$7+$8+$9+$10+$11+$12+$13 "%"}'
user: 1.18% syst: 0.66% wait: 0.76% idle: 97.39%   Total: 99.99%
@boson:~ $


text:
Q: PHP Myadmin Unicode_520 Not in Dropdown list - missing, how do i add it? I am trying to change unicode in my phpmyadmin as instructed below:
PhPMyAdmin=>Choose your database=>Click your database=>Operations=>Collation=>utf8mb4_unicode_520_ci=>GO.
However, I dont have unicode_520 in my dropdown box, can i add this?


text:
Q: How to get jar path in runtime I want java to look for .properties file in same folder with jar which is running. How can I do it and how can I determine if app is running in IDE or as explicit jar file

A: you can access this file (if it is in your classpath) via:
Paths.get(this.getClass().getResource("file.properties").toURI());

A: Firstly I have to say that this is inherently a bad practice, though life often is not perfect and sometimes we have to roll with the bad design punches.
This is the class I mustered up for a pet project of mine that required such functionality:
public class ArbitraryPath {

    private static Logger logger = LogManager.getLogger("utility");

    private static boolean isRunFromJar = false;

    public static String resolveResourceFilePath(String fileName, String folderName, Class<?> requestingClass) throws URISyntaxException{
        // ARGUMENT NULL CHECK SAFETY HERE
        String fullPath = requestingClass.getResource("").toURI().toString();
        isRunFromJar = isRunFromJar(fullPath);
        String result = "";

        if(!isRunFromJar){
            result = trimPathDownToProject(requestingClass.getResource("").toURI());
        }
        result = result+folderName+"/"+fileName+".properties";

        return result;
    }

    private static String trimPathDownToProject(URI previousPath){
        String result = null;

        while(!isClassFolderReached(previousPath)){
            previousPath = previousPath.resolve("..");
        }
        previousPath = previousPath.resolve("..");
        result = previousPath.getPath();
        return result;
    }

    private static boolean isClassFolderReached(URI currentPath){
        String checkableString = currentPath.toString();
        checkableString = checkableString.substring(0,checkableString.length()-1);
        checkableString = checkableString.substring(checkableString.lastIndexOf("/")+1,checkableString.length());
        if(checkableString.equalsIgnoreCase("bin")){
            return true;
        } else {
            return false;
        }
    }

    private static boolean isRunFromJar(String fullPath) throws URISyntaxException{
        String solidClassFolder = "/bin/";
        String solidJarContainer = ".jar!";
        if(!fullPath.contains(solidClassFolder)){
            if(fullPath.contains(solidJarContainer)){
                return true;
            } else {
                logger.error("Requesting class is not located within a supported project structure!");
                throw new IllegalArgumentException("Requesting class must be within a bin folder!");
            }
        } else {
            return false;
        }
    }

}

I guess a little explaining is in order...
Overall this will try to resolve a filepath for a properties file located in an arbitrary project. This means that the ArbitraryPath class does not need to be located in the same project as the properties file, this comes in handy when you want to separate for example the JUnit tests in a separate project. It will identify the project based on the class you give it, the class should be in the same project as the properties file you are trying to find.
So first of all it gets the path of the class you gave it in this line:
String fullPath = requestingClass.getResource("").toURI().toString();

Then it checks whether or not this class is within a JAR file or if it is executed from the IDE. This is done by checking whether the path contains "/bin/" which would normally mean that it is executed from an IDE or ".jar!" which would normally mean that it is executed from a JAR. You can modify the method if you have a different project structure.
If it is determined that it is NOT run from JAR then we trim the path down to the project folder, going backwards down the path until we reach the BIN folder. Again, change this if your project structure deviates from the standard.
(If we determine that it IS run from a JAR file then we don't trim anything since we have already got the path to the base folder.)
After that, we have retrieved a path to the project folder so we add the name of the folder (if there is one) where the properties file is located, and add the filename and extension of the properties file which we want to locate.
We then return this path. We can then use this path in an InputStream like such:
FileInputStream in = new FileInputStream(ArbitraryPath.resolveResourceFilePath("myPropertiesFile", "configFolder", UserConfiguration.class));

Which will retrieve the myPropertiesFile.properties in the myConfiguration folder in the project folder where UserConfiguration.class is located.
Please note that this class assumes you have a standard project configuration.
Feel free to adapt it to your needs etc.
Also this is a really hackish and crude way to do this.

A: String absolutePath = null;
try {
    absolutePath = (new File(Utils.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath())).getCanonicalPath();
    absolutePath = absolutePath.substring(0, absolutePath.lastIndexOf(File.separator))+File.separator;
} catch (URISyntaxException ex) {
    Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
    Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
}


text:
Q: compile java source 1.7 for 1.6 with Maven and Netbeans I have a source code written for java 1.7. I would like to compile it for java 1.6. If I understood correctly, I need to use the options -source 1.7 -target 1.6
I am using Maven2 and Netbeans (8.0). So, I tried :
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.6</target>
                <compilerArguments>
                    <bootclasspath>/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar</bootclasspath>
                </compilerArguments>
            </configuration>
        </plugin>

But I get a javacTask: source release 1.7 requires target release 1.7
I read that some people use eclipse compiler to make it work, but how can I do this if I'm using Netbeans ?
Thanks a lot for your help

A: EDIT Sorry it's the other way around. You can compile source 1.6 and target 1.7 but you can't compile it when source version > target version because then it couldn't handle new features of the language.
For more detail about this see Cross-Compilation Options in javac documentation http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html.
If you would have 1.6 sources you could compile them for target version 1.7 like this:
<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project>>


text:
Q: Access a Workflow's Variables from a method I have a Switch activity that has an expression of
escalateEngine.CheckRules()

Where escalateEngine is an instance of a class that is passed to the workflow as an argument and CheckRules() is a method designed to work out if a problem that the workflow has encountered should be retried or aborted (usually the error is "ftp server not available").
The CheckRules() method returns an int that is used by the Switch activity to reroute workflow execution.
What I don't see how to do is how I can get CheckRules() to change the value of a Variable in the workflow.  It's not an activity so does not have access to CodeActivityContext.  At least I don't think it does.
Can anyone offer advice?
I realize I could use InvokeMethod to output the value and then run that value into the Switch but I was hoping for something neater

A: You are right in that you can't change workflow variables outside of the workflow.


text:
Q: Batch file - copy file from parent folder - why the cmd file closed adter the run? I'm using this code to copy files from the parent folder. But as soon as the code finish the execution, teh CMD window is closed. So I cannot read the result to see what the problem is.
Here is my code:
COPY ..\File.*
@echo The script is complete.

This need to copy the file "File.exe" from the parent folder to the current. then print a success message, and stay open, so I'll can see if there is any error message.

A: Add a pause at the end, that way you have to press a key before the batch file closes.


text:
Q: Problem in binary tree; need help can you help me please?  I am making a binary tree with node insertion.  How can I insert the new node to the current node in respect of BST rule?
Example: first the root is empty.
Input number: 50
This will display "Success!"
Insert number: 40
Successfully inserted in the left subtree of 50
insert number: 20
successfully inserted in the left subtree of 40
insert number: 80
successfully inserted in the right subtree of 50
Can you help me please? Thank you in advance hoping for your positive response...
Here's my code:
class Node
{
  public int num;
  public Node llink;
  public Node rlink;
}

public class BinaryTreeOperations
{
  //public Node llink=null;
  // public Node rlink=null;
  private Node temp;
  private Node current;
  private Node root;

  public boolean isEmpty()
  {
    return root==null;
  }

  public void insertNum(int n)
  {

    temp=null;
    current=null;

    Node newNode = new Node();
    newNode.num=n;
    newNode.llink=null;
    newNode.rlink=null;

    if(isEmpty())
    {
      root=newNode;
      System.out.println("Successfully inserted!");
    }
    else
    {
      temp=root;
      while(temp!=null)
      {
        current = temp;
        root = current;
        temp=null;
      }

    if(n<current.num)
    {
      current.llink=newNode;
      //current.llink=temp;
      System.out.println("inserted on the left subtree " +current.num);
    }
    else
    {
      newNode.rlink=newNode;
      System.out.println("inserted on the right subtree  "+current.num );
    }
  }
}

A: Your while loop seems wrong. What you really want to do is start at the root and traverse the tree until you reach the node which will serve as the parent of your new node. Below you are not doing any traversal or inspection to find where the new node should go. That is what you really need to be doing.
while(temp!=null) {
    current = temp;
    root = current;
    temp=null;
}

Should be something like this:
while(parent not found) {
    if (new node is smaller than current) {
        if (current has left child) {
            assign left child to current and loop
        } else {
            make current the parent of the new node
        }
    } else {
        ....
    }
}

A:
else
  {
   temp=root;
   while(temp!=null)
   {
      current = temp;
      root = current;
      temp=null;
   }

This loop will only ever run once. Probably not what you intended. :)

if(n<current.num)
{
  current.llink=newNode;
  //current.llink=temp;
  System.out.println("inserted on the left subtree " +current.num);
}
else
{
  newNode.rlink=newNode;
  System.out.println("inserted on the right subtree  "+current.num );
}

In one branch you are assigning to current.llink, in the other branch you are assigning to newNode.rlink. Oops. :)

A: Your methodology for adding to the binary search tree seems incorrect.
You need to read up on Binary Search Trees to figure out how you will maintain the structure of your tree.
Below is some code that shows how to add to a Binary Search Tree, but I define a tree as empty if it contains no data.
public boolean isEmpty() {
    return data == null;
}

The rest of the code is pretty self explanatory and should help you figure out how to add to the tree to maintain order.
public boolean add(Comparable target) {
    if(isEmpty()) {
        setData(target);
        this.setLeftTree(new BinarySearchTree());
        this.setRightTree(new BinarySearchTree());
        return true;
    } else {
        int comparison = getData().compareTo(target);
        if(comparison == 0)
            return false;
        else {
            if(comparison < 0) {
                return getRightTree().add(target);
            } else {
                return getLeftTree().add(target);
            }
        }
    }
}

Let me know if you have any other questions.


text:
Q: Entity Framework String Size Limitation on Contains Clause So, I have this lambda expression and it works just fine
list = list.Where(x => x.ListaDocumentoCaixa.Any(d => d.Observacao.Contains(term.Trim())));

I must add that this column is a varchar(6000) field. So far, this has been working just fine as I mentioned, but just recently I've ran into an issue. It seems that if the term of the search occurs from position 4001 of the string and on, the query fails to return anything to me.
After some debbuging I've found this commented on the query produced by Entity Framework
-- p__linq__0: 'maria stela gonsa' (Type = String, Size = 4000)

Then after some research I found this to be Entity's common behaviour, however, I can't have this kind of limitation on the application. My question is: Is there any way to change this behaviour ? I would like very much to avoid having to write this query as plain text and run this with ExecuteQuery if possible.
Thanks in advance for the help!

A: I would recommend you follow the following article, assuming you are using SQL server, about how to create a full text search index, and use it in Entity Framework with C#.
Running LIKE statements (which is what Contains() maps to) is HIGHLY inefficient on large varchar fields.
https://www.mikesdotnetting.com/article/298/implementing-sql-server-full-text-search-in-an-asp-net-mvc-web-application-with-entity-framework
EDIT:  The summary of the link is:
1.) Create a full text index on the field using SQL server's wizard.  That full text field will allow CONTAINS and FREETEXT searches on the whole field, and be much more efficient.
2.) Write a stored procedure that joins the table in question to results from the free text index.
3.) Make an Entity Framework class to represent results from that stored procedure, and use EF to call in and return a list of those results.


text:
Q: jquery dynamic collapsible list doesnt work; jsfiddle example I need to create a collapsible-set. Each collapsible within that set contains a ul-listview. The problem arises when I need to dynamically add collapsible item to the collapsbile-set.
I get the error:
Uncaught Error: cannot call methods on listview prior to initialization; attempted to call method 'refresh'

This is the jsfiddle for this program:
http://jsfiddle.net/ezuo3btc/15/
That's the initial html in the index page:

Section 1

Acura

Audi

BMW

This is called on the click event and adds, dynamically, a collapsible to the collapsible-set defined statically in the html:
$("#add").click(function() {
    nextId++;
    var content = '\

\

Section ' + nextId + '
\

\

Acura
\

Audi
\

BMW
\

\

';
    $("#set").append( content ).collapsibleset('refresh');
    $("[data-role=listview]").listview("refresh"); <--------- I get the error here.
    $("[data-role=listview]").trigger("create");
});

If someone knows how to initialize a listview dynamically inside a collapsible please let me know.
Thanks in advance.
Jenia.

A: You don't need to call the "refresh" method the first time you call .listview():
    $("[data-role=listview]").listview();
    $("[data-role=listview]").trigger("create");

http://jsfiddle.net/ezuo3btc/18/

A: You need to first initialize the listview widget with $element.listview();:
$("[data-role=listview]").listview();
$("[data-role=listview]").listview("refresh"); //optional

Some recommendations:

*

*$("[data-role=listview]") applies on all elements with data-role=listview, even the previously created ones. Prefer something like this:
var $content = $(content).appendTo($("#set"));
$("#set").collapsibleset('refresh');
$content.find("[data-role=listview]").listview();
$content.find("[data-role=listview]").trigger("create");

*$("#set") always reference the same node, you can put it in a variable
var $set = $("#set");

Example


text:
Q: Google Calendar api authentication via POST request I am trying to issue a POST request towards the google calendar api, but I fail to understand how to authenticate it.
I took the following steps to try and use a service account to do so:

*

*I've enabled the the calendar api in the Google Cloud console

*I've created a new service account, enabled  G Suite Domain-wide Delegation, and downloaded the provided key.

*I've added the service account email to the calendar to be able to make changes and create events.

*I've tried to create a POST request to https://www.googleapis.com/calendar/v3/calendars/calendarId/events with the contents of the JSON key as the value of the Authorization header, but I receive the following error:
{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "authError",
                "message": "Invalid Credentials",
                "locationType": "header",
                "location": "Authorization"
            }
        ],
        "code": 401,
        "message": "Invalid Credentials"
    }
}
Am I missing some steps or have I do not understand correctly the authentication process?
I would appreciate your help.

A: Its not simply a matter of applying the contents of the key file to your call, all google apis need an access token in order to authenticate them.
To get an access token from a service account you need to follow the following steps. Preparing to make an authorized API call
There are steps you will need to complete inorder to get the access token you will need to make a call to the api

After you obtain the client ID and private key from the API Console, your application needs to complete the following steps:

*

*Create a JSON Web Token (JWT, pronounced, "jot") which includes a header, a claim set, and a signature.

*Request an access token from the Google OAuth 2.0 Authorization Server.

*Handle the JSON response that the Authorization Server returns.

I recommend you pick your favorite server sided programming language and find a client library for it.  It will make things much easier then you trying to authncate using a service account by yourself.


text:
Q: Specify a particular machine name on slurm Hello does someone know how to specific on a slurm file which worker (machine) I want to use ?
Thank for your help

A: You can specify the nodes that you would like to select with the --nodelist option:
sbatch --nodelist=myHosts[1-5,7] script.sh

More details are described here.
A shorthand version of --nodelist is -w.


text:
Q: Mapserver: avoid symbols to be cut I use an arrow as a symbol to follow lines, but in several cases, symbols are cut (when line features are too small or changing direction). Here is an example of the result on my Web site:

Here is my portion of code from my mapfile:
CLASS
    NAME "Water pipe"
    STYLE
        COLOR 0 0 0
        WIDTH 3
    END
    STYLE
        SYMBOL "wp_arrow"
        ANGLE AUTO
        SIZE 12
        INITIALGAP 20
    END
END

Any idea on how to prevent the symbols to be cut?

A: I actually found that by using GAP -20 instead of INITIAL GAP 20, the symbols are not cut... The sign « - » allows symbols to follow lines orientation. But the spacing between symbols is not regular at all. I will post another question on this topic specifically.


text:
Q: Google OAuth on MVC5 ExternalLoginCallback?error=access_denied I have set up my Google OAuth

And I have added the code into Startup.Auth.cs
 app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
    {
        // LRC
        ClientId = "xxxxxxxxx",
        ClientSecret = "xxxxx"
        //CallbackPath = new PathString("/signin-google")
    });

But after I chose a google account to log in, it redirected me to the login page again,
I checked the network via Chrome and found that the access was denied.

http://www.liferunningclub.com.au/Account/ExternalLoginCallback?error=access_denied

I cannot figure it out.

Update
Now I did something else:

*

*I added an annotation ([RequireHttps]) on the Account Controller

*I enabled the SSL for my project.

*I updated the url and re-direct url in Google Console to https

Tried to log in with Google, after I selected my Google account, it returned the same access_denied.
It would be better if the response from Google could give more detailed information.

A: The same error happened to me for Facebook provider.
Turns out the solution was as simple as updating the nuget package to 3.1.

It turns out that Facebook did a "force upgrade" of their graph API
  from version 2.2 to 2.3 on 27th March 2017

For the record I'm using the following:

*

*http://localhost:58364 in iisexpress with NO https

In Facebook I have the following settings configured for a test app:

In addition if you're using a sample template the error parameter returned isn't being consumed which can be misleading. You should add string error to ExternalLoginCallback
    [AllowAnonymous]
    public async Task<ActionResult> ExternalLoginCallback(string returnUrl, string error)
    {
        if (error != null)
        {
            return View("Error");
        }

A: I had the same problem using the latest ASP.Net MVC template with "Individual Accounts" selected.
The solution was to enable the Google+ API for my project in the Google Developer console.
I found my answer here (scroll down to "Changes to Google OAuth 2.0...").

A: I had this problem as well. After I enabled the Google+ API the problem is not solved yet. Turns out I haven't set the 'Authorized JavaScript origins' in my google API console. So I set the authorized javascript origins, and the problem solved.

A: I had the same issue. I had Google+ API active and set JavaScript providers. Turns out that my version of Microsoft.Owin 3.1 was too old. I've updated every single nugget which had Microsoft.Owin.(whatever) in it's name and it started working fine (version 4.1)
Hope it helps!

A: This is most likely because you have not enabled the Google + API in the developer console.
So when your account trys to get the details about the Google Account, it says access_denied.
Simply go to the developer console and enable the Google + API

A: None of the above solution worked for me. Turns out In my case I was tweaking with Google OAuth Playground and I added https://developers.google.com/oauthplayground this url in Authorized Redirect Uris section of my Google Credentials for Client ID and Secrets.
When I removed it and retried, it worked fine.
PS: I had to reset the OAuth Playground settings that I had modified too.
EDIT
The other issue was, my code threw an Exception when the user was OnAthenticated EventHandler was triggered. Turns out a null reference which was resulting in access_denied status being returned.
GoogleOAuth2AuthenticationOptions googleOptions = new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "xxxxx.apps.googleusercontent.com",
                ClientSecret = "XXXX",
                Provider = new GoogleOAuth2AuthenticationProvider()
                {
                    OnAuthenticated = (context) =>
                    {
                        try
                        {
                            TokenHelper tokenHelper = new TokenHelper();

                            // Any exception here will result in 'loginInfo == null' in AccountController.ExternalLoginCallback.
                            // Be sure to add exception handling here in case of production code.
                            context.Identity.AddClaim(new Claim(tokenHelper.AccessToken, context.AccessToken)); // From This line and onwards. tokenHelper's properties were null.

                            // For clarity, we don't check most values for null but RefreshToken is another kind of thing. It's usually
                            // not set unless we specially request it. Typically, you receive the refresh token only on the initial request,
                            // store it permanently and reuse it when you need to refresh the access token.
                            if (context.RefreshToken != null)
                            {
                                context.Identity.AddClaim(new Claim(tokenHelper.RefreshToken, context.RefreshToken));
                            }

                            // We want to use the e-mail account of the external identity (for which we doing OAuth). For that we save
                            // the external identity's e-mail address separately as it can be different from the main e-mail address
                            // of the current user.
                            context.Identity.AddClaim(new Claim(tokenHelper.Email, context.Email));
                            context.Identity.AddClaim(new Claim(tokenHelper.Name, context.Name));

                            context.Identity.AddClaim(new Claim(tokenHelper.IssuedOn, DateTime.Now.ToString()));
                            context.Identity.AddClaim(new Claim(tokenHelper.ExpiresIn,
                                ((long)context.ExpiresIn.Value.TotalSeconds).ToString()));

                            return Task.FromResult(0);
                        }
                        catch (Exception ex)
                        {

                            throw;
                        }

                    },
                },
                AccessType = "offline",
                UserInformationEndpoint= "https://www.googleapis.com/oauth2/v2/userinfo"
            };

A: Default Google authentication no longer works, you can add updated Owin.Security.Provider.Google package through NuGet or find it here

A: Try to use https:// instead of http:


text:
Q: Bash: use an alias in a filepath I cannot seem to figure out how to use an alias for a filename in a path. For example:
alias a="ls /tmp/ -tr | tail -n 1"
cat /tmp/a

The alias gives me the name of the most recent file written in /tmp/. Then I try to cat that file and I get cat: /tmp/a: No such file or directory.
When I just type a I get the right thing, for instance some_log_I_just_wrote_to.log.
Obviously what I want is for cat /tmp/a to be translated into cat /tmp/some_log_I_just_wrote_to.log so that I can see the log.
Any ideas on what the right way to do this is? I sometimes get tangled up in bash with when to use aliases and symlinks and just plain variables, etc.
Thanks!

A: Create the alias with
alias a='ls /tmp/ -tr | tail -n 1'

Use the alias with cat
cat $(echo -n /tmp/ && a)


text:
Q: Python - Plot Node Hierarchy using iGraph I have a dataset with staff and their job roles, and each job role is assigned a code: 0 for top-management, 1 for middle-management, and 2 for general staff. I now want to plot these roles using a hierarchical graph, so that all code 0 staff are on the top, 1 in the middle, and 2 at the bottom. I've found the layout in iGraph to do this (see below), however don't know how to control which nodes appear where. Is there a parameter that I'm missing to control this? Any help would be appreciated.
CSV:
https://github.com/Laurie-Bamber/Enron_Corpus/blob/master/15Below_60Employees_1.csv
Role Codes:
https://github.com/Laurie-Bamber/Enron_Corpus/blob/master/Dict_role_code.csv
GML:
https://github.com/Laurie-Bamber/Enron_Corpus/blob/master/15Below_60Employees_1.gml
P.S. edges refer to emails between staff, not measures of hierarchy.

Code:
G = Graph.Read_GML('Test.gml')
visual_style['layout'] = G.layout_reingold_tilford()
plot(G, **visual_style)

A: I am proposing a solution with a slight modification to what you asked for. If you plot the levels vertically and the people at a role level horizontally, there are many people at one level so the labels run into each other. Instead, I am plotting the role levels horizontally and the individuals at a level are spread out vertically, leaving plenty of room to see the labels.
I do not think that there is a pre-built layout function that does what you are asking. However, it is not very hard to make your own layout. The essential part of doing that is to assign x-y coordinates where you want the nodes to be plotted. After that, you can just use the Layout function to convert the coordinates into a layout object.
My scheme for assigning x-y coordinates will be that the x coordinate will be the role level ( 1,2, or 3). I will just assign y-coordinates by making each node at a role level one higher than the previous node at that level. I use a small dictionary to keep track of what height comes next for each of the levels.
I will use the file names of the files that you provided and will assume that these files are in the current working directory.
import csv
from igraph import *

## Load graph
G = Graph.Read_GML('15Below_60Employees_1.gml')

## Load role levels
reader = csv.reader(open('Dict_role_code.csv'))
dx = dict(reader)

## Create a layout
height = { '1':0, '2':0, '3':0 }
COORD = []
for L in G.vs['label']:
    height[dx[L]] = height[dx[L]] + 1
    COORD.append((float(dx[L]), height[dx[L]]))
LO = Layout(COORD)

## Create the style
visual_style = {}
visual_style['vertex_size'] = 8
visual_style['vertex_frame_color'] = 'orange'
visual_style['layout'] = LO
visual_style['margin'] = 60
visual_style['edge_color'] = '#00000044'

plot(G, **visual_style)

I think that this provides you with a good starting place. You can tweak the placement from here.


text:
Q: How to remove radio button while exporting to Excel using Display Tag? I want to export the table which is displayed using display tag on the jsp page.
But when I export it, it exports radio button with the table
Below is the snippet of the display tag
<display:table requestURI="CustListReportDetails.do" name="sessionScope.SESSION_CUST" id="formtable" pagesize="100" style="width:100%; border:0; cellspacing:0; cellpadding:10; align:center;" export="true">

    <display:table requestURI="CustListReportDetails.do" name="sessionScope.SESSION_CUST" id="formtable" pagesize="100" style="width:100%; border:0; cellspacing:0; cellpadding:10; align:center;" export="true">
    <display:column title="" style="width:10px">
        <input type="radio" name="recordIdentifier" value="${formtable.customerId}" onclick="javascript:setRoleCode('${formtable.customerId}');"/>
    </display:column>
    <display:column property="name" title="Name" />
    <display:column property="contactPerson" title="Contact Person" />
    <display:column property="gender" title="Gender" />
    <display:column property="dob" title="Date Of Birth" />

    <display:setProperty name="export.excel.filename" value="Customer_reportExcel.xls"  />
</display:table>

The desired xsl file should not have radio button in it.

A: The problem is solved
In the display column tag containing radio button,I have placed media ="html" and now it doesn't export radio button in the excel sheet
code changed in the above snippet::
display:column title="" style="width:10px" **media="html"**


text:
Q: Android change locale for tests I want to test whether the strings are updated correctly when the user changes the language. I am using Espresso to test whether the string matches the correct locale and I am currently changing it like so:
private fun changeLocale(language: String, country: String) {
    val locale = Locale(language, country)
    Locale.setDefault(locale)
    val configuration = Configuration()
    configuration.locale = locale
    context.activity.baseContext.createConfigurationContext(configuration)

    getInstrumentation().runOnMainSync {
        context.activity.recreate()
    }

}

The problem is that the espresso test onView(withText(expected)).check(matches(isDisplayed())) is asserting false so I was wondering what is the correct way to set the default locale before running a test?

A: according to this answer, you can change the Locale programmatically:
public class ResourcesTestCase extends AndroidTestCase {

    private void setLocale(String language, String country) {
        Locale locale = new Locale(language, country);
        // here we update locale for date formatters
        Locale.setDefault(locale);
        // here we update locale for app resources
        Resources res = getContext().getResources();
        Configuration config = res.getConfiguration();
        config.locale = locale;
        res.updateConfiguration(config, res.getDisplayMetrics());
    }

    public void testEnglishLocale() {
        setLocale("en", "EN");
        String cancelString = getContext().getString(R.string.cancel);
        assertEquals("Cancel", cancelString);
    }

    public void testGermanLocale() {
        setLocale("de", "DE");
        String cancelString = getContext().getString(R.string.cancel);
        assertEquals("Abbrechen", cancelString);
    }

    public void testSpanishLocale() {
        setLocale("es", "ES");
        String cancelString = getContext().getString(R.string.cancel);
        assertEquals("Cancelar", cancelString);
    }

}

you can easily convert that code to Kotlin.

A: In my experience, setting locale at runtime is simply not reliable. This guy has a lot more to say about the topic here: https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758
You should try using Firebase Test Lab or similar services and run your tests on different devices (which have different locales set)

A: Kotlin version, based on the post from @Adib Faramarzi
    private fun setLocale(language: String, country: String) {
       val locale = Locale(language, country)
       // here we update locale for date formatters
       Locale.setDefault(locale)
       // here we update locale for app resources
       val context: Context = getApplicationContext()
       val res: Resources = context.resources
       val config: Configuration = res.configuration
       config.setLocales(LocaleList(locale))
       res.updateConfiguration(config, res.displayMetrics)
}


text:
Q: Select fields from dbf file I use dbf 0.95.004, I need to select one field from table. Example, docs
import dbf
table = dbf.Table('my.dbf').open()
records = table.sql('select name')

But I have error:
AttributeError: 'Db3Table' object has no attribute 'sql'

I open dbf.py and find
def pql(records, command):

Not def sql(records, command): like in the docs.
Ofcourse, I can do like this without sql:
for record in table:
    record['name']

But I need to use sql-select.
So, how to fix it?

A: My apologies (x2), the docs are way out of date.  You can either use dbf.pql(table, 'blah blah') (named that way because it is a very limited sql-like syntax), or table.query().  These are not well developed routines as I found using normal Python syntax easier.


text:
Q: Print outputs to console during a testthat test I'm trying to use the testthat package in R to test a script. Within my script, I have several cat statements that print things to the console. However, when I run my test, nothing prints out.
I tried adding an arbitrary print statement above one of the cat statements, and the print statement worked, so I changed my main cat statement to a print statement, which also worked. However, the output of print is ugly, so I'd like to be able to keep a cat statement there that I can see whenever I run the test, rather than having to manually change it to a print statement every time.
Adding to the mystery, I tried changing the arbitrary print statement to be a cat statement, and it printed to the console -- but when I changed the main statement back to cat, it no longer printed.
What is going on??
Summary of the code:
Nothing prints to the console:
cat(sprintf('\n\nCalculating regressions for site %s', site)))

This prints 'hello world', but not the 'calculating regressions for...':
print('hello world')
cat(sprintf('\n\nCalculating regressions for site %s', site)))

This does print both, but the formatting for the second statement doesn't treat newlines as newlines, just as strings:
print('hello world')
print(sprintf('\n\nCalculating regressions for site %s', site)))

This also prints 'hello world', but not the 'calculating regressions for...':
cat('hello world')
cat(sprintf('\n\nCalculating regressions for site %s', site)))

EDIT: Clarifying that the above code is in the script that's being tested, not the testthat script.


text:
Q: Microsoft HPC cluster - AD or AD LDS? The instructions for deploying an HPC Cluster (e.g. step 1.5 on this page in TechNet) are very clear that HPC cluster nodes "must be members of an Active Directory domain".
Does the Active Directory Lightweight Directory Services provide this?
That is, can the HPC cluster use AD LDS for its Active Directory domain, or do I need the full AD DS (Domain Services) role?

A: No, AD LDS does not have the concept of member servers or computers joining a domain. It's just an LDAP front-end.
You need Active Directory Domain Services.


text:
Q: How make subclass of ParseUser and use it (Android) I want to make sub class of ParseUser to use in application. According to parse documentation i made like this;
@ParseClassName("User")
public class User extends ParseUser {

}

In normal usage we get ParseUser in static way
 ParseUser parseUser = ParseUser.getCurrentUser();

This new class "User" , i make an instance like
     User user = new User();
but it's default fields come null.
for example;
User user = new User();
String mail = user.getEmail();

here it is
mail

comes null.
How can go over this?

A: You should change from
@ParseClassName("User")

To
@ParseClassName("_User")

Then you can get the current user
User parseUser = (User) ParseUser.getCurrentUser();

Now you have the current user with all the fields as an instance of the custom class User and you can operate on it with all the methods you defined


text:
Q: how to use Aspose to conditionally show a table and hide another table in word template? I have a word template with two table, I want to use Aspose to show a table and hide another table in word template based on a variable in java code, how to achieve this?

A: You can easily achieve what you need using IF field in your MS Word template document.
https://support.microsoft.com/en-us/office/field-codes-if-field-9f79e82f-e53b-4ff5-9d2c-ae3b22b7eb5e
in the condition you can insert a merge field or a bookmark and then update the condition upon execution mail merge or setting bookmark value using Aspose.Words.
For example, see the screenshot of the template document and the code to execute mail merge using Aspose.Words.

Document doc = new Document("C:\\Temp\\in.docx");
doc.getMailMerge().execute(new String[] { "test" }, new String[] { "first" });
doc.save("C:\\Temp\\out.docx");

If the output format is supposed to be MS Word document, you can also call Document.unlinkFields() method before saving, in this case IF field will be removed from the document and only the result will be preserved.


text:
Q: Subroutine within a 'With' statement Consider the following illustrative example
Private Sub drawBorders(listOfBorders)
    For Each Item In listOfBorders
        With .Borders(Item)
            .LineStyle = xlContinious
            .ColorIndex = xlAutomatic
            .Weight = xlThin
        End With
    Next Item
End Sub

Sub main()
    Dim TopBottom() as Variant
    Dim myRange As Range
    TopBottom = Array(xlEdgeTop, xlEdgeBottom)
    myRange = Range("A1")

    With myRange
        .value = a
        Call DrawBorders(topBottom)
    End With
End Sub

I have a sequence of With statements where some of the code is pretty repeating.
I get an error at the DrawBorders sub :

Invalid or unqualified reference

Is it possible to import the reference from the With statement into the Sub?

A: This should work
Private Sub DrawBorders(listOfBorders() as Variant, r As Range)
    For Each Item In listOfBorders
        With r.Borders(Item)
            .LineStyle = xlContinuous
            .ColorIndex = xlAutomatic
            .Weight = xlThin
        End With
    Next Item
End Sub

Dim TopBottom() As Variant
Dim myRange As Range
TopBottom = Array(xlEdgeTop, xlEdgeBottom)
myRange = Range("A1")

With myRange
  .Value = a
End With

Call DrawBorders(TopBottom, myRange)

A: You should always specify the type of the argument in your Sub or Function.
The error in DrawBordersyou get is because of this With .Borders(Item) which hasn't any object to be referenced to (no With Object before).
My guess is that you wanted to pass the reference inside of your call and that is why you need to pass an object, because the With from the main code won't follow when you call a function or sub!
Here is my proposition for your code :
Private Sub DrawBorders(ListOfBorders As Variant, RangeToFormat As Range)
    For Each Item In ListOfBorders
        With RangeToFormat.Borders(Item)
            .LineStyle = xlContinuous
            .ColorIndex = xlAutomatic
            .Weight = xlThin
        End With
    Next Item
End Sub

Sub main()
    Dim TopBottom() As Variant, _
        Ws As Worksheet, _
        MyRange As Range

    Set Ws = ActiveSheet
    Set MyRange = Ws.Range("A1:J10")
    MyRange.Value = A

    TopBottom = Array(xlEdgeTop, xlEdgeBottom)

    With Ws
        Call DrawBorders(TopBottom, .Range("A1:J10"))
    End With
    '----Or
    'Call DrawBorders(TopBottom, MyRange)
End Sub


text:
Q: how do I grant a new user the privilege to create a new database in MySQL how do I grant a new user the privilege to create a new database in MySQL
Specifically:

*

*the database does not exist yet

*I have successfuly created a new DB user account (that is not admin)

*I want that non-admin user to create a new database

*I do NOT want the 'admin' user to create the database and then grant privs to the database to the new user

*as 'admin', I want to grant the new user the privilege to create a new database

*I do not want to grant the new user any additional privileges on existing databases

This is not covered anywhere in the documentation that I can find.

Monday 2022-04-04
Update:
I created user 'scott' and then logged in as MySQL user 'admin' When I run this command
Note: The 'test' database does not yet exist
mysql>GRANT CREATE ON test.* to 'scott'@'localhost';
I get an error
==> ERROR 1410 (42000): You are not allowed to create a user with GRANT
Why do I get this error?  I am not attempting to create a user, but rather grant a user access to a non-existent database (as is the approach with MySQL to grant a user privileges to create a database).

If up update the SQL statement to:
mysql>GRANT CREATE ON test.* to scott;
It runs OK
Query OK, 0 rows affected (0.07 sec)

And so now I login as user 'scott and run this statement:
mysql>create database rum;
==> ERROR 1049 (42000): Unknown database 'test'
Why do I get this error?
At this point, I am still not able to create a database as a non-admin user.

A: Example: grant "scott" the privilege to create the test3 database, which does not exist yet:
mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+

mysql> grant create on test3.* to 'scott'@'localhost';
Query OK, 0 rows affected (0.01 sec)

Now try as scott to create the database:
mysql> select user();
+-----------------+
| user()          |
+-----------------+
| scott@localhost |
+-----------------+

mysql> show grants;
+---------------------------------------------------------+
| Grants for scott@localhost                              |
+---------------------------------------------------------+
| GRANT USAGE ON *.* TO `scott`@`localhost`               |
| GRANT ALL PRIVILEGES ON `test`.* TO `scott`@`localhost` |
| GRANT CREATE ON `test3`.* TO `scott`@`localhost`        |
+---------------------------------------------------------+

mysql> create database test3;
Query OK, 1 row affected (0.00 sec)

mysql> use test3;
Database changed

MySQL has one privilege called CREATE which is for creating both databases  and tables. See https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_create
You can either grant the user privilege to create a database of a specific name, or else grant them the privilege to create a database of any name, but that means they can also create other tables, either in the new database or in other existing databases. Sorry, there may not be a solution for you to allow them to create any new database without specifying the name when you grant the privilege, but then only have privilege in that database.

You are not allowed to create a user with GRANT

You did not create the user scott. Older versions of MySQL allows GRANT to implicitly create a user if one does not exist, but that has been disabled on more recent versions because folks realized it is a security weakness.
To be clear, the user "scott" is just an example I used. Don't literally use the name "scott" if that's not the user to whom you want to grant privileges.
The other errors you got seem to be that you granted the user privileges on a database named test.* but then you tried to create a database with a different name. The example I showed only grants the privilege to create the specific named database, not a database named rum or any other database.
I understand you want to grant privilege to create a database of any name. The syntax for that would be GRANT CREATE ON *.* TO... but that would grant the user privileges on all the other existing databases too.
There is no combination of syntax to grant privileges on any database name wildcard that means any database, provided that it is not yet created.


text:
Q: what should i do to get the mathematics table in column format I am a student and by running this code i am getting the output of 1 to 5 tables in a row however i want to have the output in such a manner that if the table of 2 is there then the table of 3 should be in next column like side by side. what should i include to achieve that result.To summarize i want the output to come in column format each table side by side and not that each table is below the other .
f=open('C:/python/1 to 5 table','w')
for i in range(1,6):
    for j in range (1,11):
        print (i,'X',j,'=',i*j)
        f.write (string(i)+string('X')+string(j)+string('=')+string(i*j)+string('\n'))
f.close()

A: First of all string should be str
also, you don't have to typecast a string to a str
f=open('table.txt','w')

for j in range (1,11):
    for i in range(1,6):
        # print (i,'X',j,'=',i*j)
        f.write (str(i)+str('X')+str(j)+str('=')+str(i*j)+str('\t')) # I don't like number of `str`'s, they are not needed for a string
    f.write('\n')
f.close()

Adviseable code
f=open('table.txt','w')

for j in range (1,11):
    for i in range(1,6):
        f.write (f'{i}X{j}={i*j}\t')
    f.write('\n')
f.close()

Output:
1X1=1   2X1=2   3X1=3   4X1=4   5X1=5
1X2=2   2X2=4   3X2=6   4X2=8   5X2=10
1X3=3   2X3=6   3X3=9   4X3=12  5X3=15
1X4=4   2X4=8   3X4=12  4X4=16  5X4=20
1X5=5   2X5=10  3X5=15  4X5=20  5X5=25
1X6=6   2X6=12  3X6=18  4X6=24  5X6=30
1X7=7   2X7=14  3X7=21  4X7=28  5X7=35
1X8=8   2X8=16  3X8=24  4X8=32  5X8=40
1X9=9   2X9=18  3X9=27  4X9=36  5X9=45
1X10=10 2X10=20 3X10=30 4X10=40 5X10=50

Explanation:
I have reversed the loop order now loop[1-5] goes for 10 times/lines
PS:
f is used to format string!


text:
Q: Why can't I use a port with my website domain name? I have a registered domain name, www.aaaDomain.com, assigned to ip address xx.xx.xx.xx . I set up my site on IIS8 to use the ip address xx.xx.xx.xx and port 8020 for my website. I can connect to the website when I type xx.xx.xx.xx:8020 in a browser but I cannot connect to the website when I use www.aaaDomain.com:8020
Also, I have another website on this same server as my Default website. When I type just the domain name without the port number, my default website comes up (because DNS does not allow adding port numbers) just like when I type in the ip address without the port number.
What am I doing wrong?
Here is what my site binding looks like on IIS8.

A: As you already have an existing site running on the server you should check your security settings on both the Windows firewall and any other security/firewall settings you have - It sounds like you have not opened the additional port which you have just configured in IIS.
Check to see if you can ping the new site by its domain name - that will verify that you have the correct DNS setup, you can also try & browse to it via the server console (or remote desktop) if that works then its security setting somewhere blocking your access. Even if the ping request times out it should still resolve the name to an IP address for you to check. You may find that ICMP is also blocked.

A: If you just changed your dns record, be aware that you should wait up to 72 hours for the dns to replicate after changing your dns record.