text:
Q: Another Baudrate Issue, when switching from 9600baud to 300baud I am communicating with an 8051 MCU via a CPU. When I i/p a character on the Keyboard, I expect the MCU to transmit a character string back to the CPU, which I can view from the terminal window., one for 9600 Baud, 8N1 and the other for 300 baud,7E1. At initialization, I am communicating at 9600. At a the input of another command character, I intend to switch the baud rate to 300 baud. And this works, as it MCU send a confirmation string to the 300baud terminal. But after the switching it appears that the MCU does not receive any longer, as though the Serial ISR no longer functions. I used a serial port monitor to see what happens, and I discovered that I am actually sending after the switching, but the MCU does not recognize it, appearing to be in a while(1) loop. Find below the C code:
Main:
main()
{
    SET=1;
    IE=0x90;    //Enabling serial interrupt.
    initUART_baud(SET);     //9600 Baud.
    while(1)
    {
        if(debug  && !ch_baud)
        {
            debug=0;
            UART_SND(intro);
        } else if(debug1 && !ch_baud) {
            debug1=0;
            UART_SND(intro1);
        } else if(ch_baud) {
            initUART_baud(SET=~SET);    //change baud rate.
            ch_baud=0;
            UART_SND(NEWbaud);
        } else
            continue;
    }
}

void initUART_baud(unsigned char change)
{ //initializing UART to initial 300baud.

    SCON = 0x50;            //UART in MODE 1, RECIEVED enabled.
    TMOD = 0x20;            //auto-reload mode and Timer 1 selected
    if(!change)//if Zero
    {
        TH1=TL1=0xA0;
        ST_7E1=0;
    }   //300 BAUD
    else
    {
        TH1=TL1=-3;
        ST_7E1=1;
    }   //9600 BAUD
    TR1 = 1;                //ACTIVATE TIMER T1
}

void UART_SND(unsigned char *SND_BUFF)
{//SENDING STRING

    unsigned char value;
    while(*SND_BUFF)
    {
        if(!ST_7E1)
            value = Parity_7E1(*SND_BUFF);  //CHANGE DATA FORMAT (7E1)
        else
            value=*SND_BUFF;
        SBUF=value;
        while(!TI);
        TI=0;
        SND_BUFF++;
    }
    SBUF = 0x0D;    //'CF'
    while(!TI);
    TI=0;
}

void serial_Optical_isr(void) interrupt 4
{
    RI = 0;
    IR_BUFF = SBUF;     //putting the value in UART into temporary buffer
    switch (IRvalue)
    {
        case START:
            if(IR_BUFF==0x54)   // If "T" is send
            {//HHU sending Request
                IRvalue=DIS;
            }
            break;

        case DIS:
            if(IR_BUFF==0x44)   //D
            {
                debug=1;
                IRvalue=START;
            }
            else if (IR_BUFF==0x42)    //B
            {
                debug1=1;
                IRvalue=START;
            }
            else if (IR_BUFF==0x43)    //C
            {
                ch_baud=1;
                IRvalue=START;
            }
            else
                IRvalue=START;
            break;
    }
}

This code ought to transmit the character in buffer "intro", when TD is pressed, and the character in buffer "intro1", when TB is pressed. And when TC is pressed, the baud rate changes and transmit character in buffer "NEWbaud" to the 300baud terminal. And the TD & TC send intro and intro1 string respectively when pressed at the same 300 baud.
I will appriciate any form of assistanc. If there is a bug in the code, do point my attention to it. Thanks a buncH!

A: If I remember correctly, the 8051 will ignore any character which is received with an invalid stop bit (detected framing error).  If characters are being sent back-to-back, it's possible for an arbitrary number of characters to have framing errors unless the data stream contains a FF, FE, FC, F8, F0, E0, C0, 80, or 00 (the nine characters which, if written in binary, do not contain the bit sequence "01").  Those nine characters may be received incorrectly, but the characters following them will be received correctly).
Addendum
A standard UART will drive its transmit line high when idle, until data is supposed to be sent.  It will then drive the line low for precisely one bit time (called the "start bit"), then send (typically) eight bits of data, LSB first, for precisely one bit time each, and drive the line high for a minimum of one bit time (called the "stop bit") before sending the next byte (which will result in precisely one bit time low, then the data bits, etc.)
When a UART's receiver is idle, it will wait for a high-low transition.  When one is seen, it will check the data line half a bit time later to ensure the line is still low; if not, it will go back to idle state.  If the data line was still low at that point, it will then sample the data line nine more times, at one-bit-time intervals.  The first eight of these will be latched as the eight data bits.  The ninth sample (which should occur during the transmitted stop bit) should be high.  If it isn't, either there was noise on the line when the stop bit was being transmitted or (more likely) the receiver was triggered by a high-low transition other than the start bit; this condition is called a framing error.
The stop bit serves two purposes:
*
*It ensures that the next transmitted byte of data will begin with a high-low transmission;
*It provides an opportunity for the receiver to detect framing errors.
Note that depending upon the precise data being transmitted, it's possible that framing errors might not be detected, and that different UARTs will behave differently when they do occur.  The 8051 reacts to framing errors by simply pretending that a mis-framed byte was not received at all, behavior which is really not terribly helpful.  Some other UARTs will record, for each byte, whether it was received with correct or incorrect framing; others will set a flag when a framing error occurs, and the flag will remain set until the processor explicitly clears it, the idea being that when one is receiving a bunch of data, a framing error during a single byte will likely imply that much of the data is corrupt.
When framing errors occur, the receiver may not be able to function correctly until a pattern of data occurs on the line which will allow it to get back into sync.  The best pattern for this purpose, which will work with essentially all receivers, is a data byte "FF".  This byte will be sent with a single high-low transition (indeed, with only a single "low" bit--the start bit).  If the receiver was out of sync when the byte is transmitted, its start bit may be mistakenly identified as a data bit from an earlier byte, but all of its data bits and the stop bit will be regarded as idle time between bytes.  The next high-low transition on the line will be the start bit of the next character (as it should be).
PS--On many UART receive circuits, any of the byte values I listed will work to allow reception to get back in sync with transission.  Some, however, will regard a "0" bit that's received where a stop bit should have been to be the start bit for the next byte.  The value "FF" should work for any UART receive circuit, however.


text:
Q: Are multiple onsubmit javascript functions allowed in a forms? Are multiple onsubmit functions allowed in forms?
Example:
<form name="form" method="POST" action="contactus.asp" onsubmit="return verify()"
<!--*****CAN I ADD ANOTHER onsubmit FUNCTION HERE?***** -->>

A: Well, you can add any legal JavaScript statement including this:
<form onsubmit="return verify1() && verify2()">

or this
<form onsubmit="return verify1() || verify2()">

or more complex expressions which can include multiple function calls. Note that standard evaluation rules apply including short-circuit evaluation of logical expressions.

A: I believe that wouldn't work.  You should just make a wrapper function, and include the functions which you desire to execute, inside of that.
<script type="text/javascript">
    var run1 = function() { alert("first"); }
    var run2 = function() { alert("second"); }

    function sub() {
        run1();
        run2();
    }
</script>
<form name="form" method="POST" action="contactus.asp" onsubmit="javascript:sub();">

redpajama_set_name: RedPajamaStackExchange


text:
Q: Evento ItemTapped en Xamarin Forms tengo una consulta, hice un menú con una ListView y utilice el método ItemTapped para que al seleccionar una opción me llevara a otra ventana, el problema es que si presiono dos veces o más a cualquier opción me abre la ventana las veces que lo presione pero quiero que aunque seleccione una opción dos o mas veces solo me abra una ventana o solo me haga la navegación una sola vez
Gracias!


text:
Q: How to get more than 25 items in a playlist using youtube_it gem I'm trying to use the Youtube_it gem to pull in a list of videos and store the urls, but the built in objects are only giving me 25 items max each time. Does anyone know of a way to use this gem to do this?
The code looks like this:
playlist = client.playlist(playlist_id)
playlist.videos
puts playlist.videos.length

In the meantime I think I need to a custom search in order to accomplish this. Any other suggestions and/or gems that my be useful are welcome. Thanks!

A: I'm not too familiar with youtube_it, but it sounds like the reason you are getting back 25 results is that is the default maximum results that can be returned in a result set. Based on the help page of youtube_it, have you tried setting the parameter max-results...
$ client.videos_by(:query => "penguin", :max_results => 50)

Please note that the number of max_results, at some point, is limited by the YouTube API itself.

A: Well, I'm pretty sure that you are no longer in this problem, but I found a solution and I just want to share it.
If you have the id of your playlist you can do the follow
@xml = open("http://gdata.youtube.com/feeds/api/playlists/#{playlist_id}?max-results=50&start-index=1")
    @result = YouTubeIt::Parser::VideosFeedParser.new(@xml).parse_videos

In this example, I'm just retrieving a maximum of 50 videos, but as you can see, it's pretty easy to adjust.
Now, @result is going to be an array with the video objects, so you can go throug it with:
@result.each do |video|
end

There is a little bug, for some reason the unique_id attribute it's empty, but you can get it with:
str1_markerstring = "/v/"
str2_markerstring = "&"
@result.each do |video|
   unique_id = video.embed_url[/#{str1_markerstring}(.*?)#{str2_markerstring}/m, 1]
end

I hope this can help someone else with the same issue as mine.

A: Building on Uriel's answer, I wrote a helpful method fetch_all_videos_from_playlist.
def fetch_videos_from_playlist(playlist_id, start_index = 1)
  xml = open("http://gdata.youtube.com/feeds/api/playlists/#{playlist_id}?max-results=50&start-index=#{start_index}")
  YouTubeIt::Parser::VideosFeedParser.new(xml).parse_videos
end

def fetch_all_videos_from_playlist(playlist_id)
  all_videos = []
  offset = 1
  while (videos = fetch_videos_from_playlist(playlist_id, offset)).length > 0
    all_videos += videos
    offset += videos.length
  end
  all_videos
end

It fetches 50 videos at a time, which seems to be the current max YouTube supports. And a playlist can hold at most 200 videos, apparently. So the method will make up to 4 fetches to get all videos.

A: Found this solution on youtube_it issues center on GitHub:
playlists_first_page = @client.playlists('sbnation', {'start-index' => 1, 'max-results' => 25})
playlists_second_page = @client.playlists('sbnation', {'start-index' => 26, 'max-results' => 25})

Source: https://github.com/kylejginavan/youtube_it/issues/111


text:
Q: tinyScrollbar mousewheel on horizontal scroll only works for chrome I´m using tinyScrollbar for an horizontal scroll, but the mousewheel only works in chrome.
In Firefox (29.0.1) and in Internet Explorer (11), the mouse wheel is not working. I{m using windows 8.
You can check it out in the official web of the plugin (http://baijs.nl/tinyscrollbar/), in the horizontal scroll example with images.
Anybody else have this problem?


text:
Q: TreeListControl в связке с каким элементом использовать Приветствую! Я хочу сделать в Visual Studio такое приложение, где бы слева постоянно находился TreeListControl (DevExpress). Другого привычного TreeView нет в DevExpress( вроде бы). А справа была область, которая бы изменялась( менялась страница или панель) при выборе какого либо узла (item) у treeview. И еще страница эта могла бы содержать какие-то контролы, и выполнялась какая-либо логика.
     Вот как интерфейс веб приложений по настройке сетевых девайсов.
Вот подскажите, в связи с этим , какие тут элементы управления надо использовать применительно к DevExpress( желательно).
A: Всё просто.
Во View положите в 0-ую колонку Grid'а TreeListControl, в 1-ую контрол, отображающий узел с подробностями.
В вашей VM надо прибиндить TreeListControl.SelectedItem на свойство (например) CurrentItem. А DataContext контрола из первой колонки View забиндьте на этот же CurrentItem.
Если ваши узлы разнотипные, вместо контрола в первой колонке нужен ContentPresenter + набор DataTemplate'ов.


text:
Q: Exception in thread "main" java.lang.ClassNotFoundException error I run hadoop jar /home/apache-nutch-2.3.1/runtime/deploy/apache-nutch-2.3.1.job org.apache.nutch.crawl.Crawl urls -dir crawl -depth 3 -topN 5
But I get the following error:
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.nutch.crawl.Crawl
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:316)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:236)

I created a urls/seed.text file in /home/apache-nutch-2.3.1/build/ that contains the following URLs:
http://nutch.apache.org
http://apache.org
and I edited conf/regex-urlfilter.txt as follow:
+^http://([a-z0-9]*\.)*apache.org/

A: The class org.apache.nutch.crawl.Crawl has been removed since version 1.8. It's recommended to run the shell script bin/crawl instead. It will launch Hadoop jobs for every step of a crawl: inject, generate, fetch, parse, etc.


text:
Q: I want notification to continue to show until the user taps on it (Android) Currently my notification shows at the top of the screen but then disapears after a bit without any sort of interaction. The notification is an incoming call and so I want it to be visible until the user interacts with it. What changes should I make?
    private void showNotification(RemoteMessage remoteMessage){
        try{
            // Create an explicit intent for an Activity in your app
            Intent i = new Intent(getBaseContext(), MainActivity.class);
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            i.putExtra(EXTRA_MESSAGE,remoteMessage);
            PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT);

            NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
                    .setSmallIcon(R.drawable.ic_action_name)
                    .setContentTitle("Incoming Video Conference Call")
                    .setContentText("From Demo Doctor")
                    .setPriority(NotificationCompat.PRIORITY_HIGH)
                    .setCategory(NotificationCompat.CATEGORY_CALL)
                    .setAutoCancel(true)
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setContentIntent(pendingIntent);

            // notificationId is a unique int for each notification that you must define
            notificationId++;
            Log.d(TAG, "NotificationId: " + notificationId);
            //https://developer.android.com/training/notify-user/time-sensitive
            // Provide a unique integer for the "notificationId" of each notification.
            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);

// notificationId is a unique int for each notification that you must define
            notificationManager.notify(notificationId, builder.build());
        }catch (Exception e){
            Log.d(TAG, e.getMessage());
        }

    }


text:
Q: Hint menu does not appear for Range variable in VBA editor I have this code:
Dim interface As Worksheet
Dim slope, measure As Range

Set interface = Application.ActiveWorkbook.Worksheets("Main")
Set slope = interface.Range("G1")
Set measure = interface.Range("G2")

When I type measure. hint menu appears.
But when I type slope. nothing happens.
All the code is located in a module, not in the "Main" worksheet. It seems to me that Excel does not recognize slope as a range variable. I am really annoyed, and I would appreciate any help. Thanks

A: The problem is that you have not declared a type for variable slope. In VBA, you cannot declare the type for a list of variables with one as Range statement. You must declare the type for each variable individually.
As a result, VBA is treating slope as a Variant for which it can provide no guidance for methods or properties with a hint menu.
Update your code to the following.
Dim slope as Range, measure As Range


text:
Q: I need a more efficient way of checking if multiple $_POST parameters isset I have these variables, and I need to check if all of them isset(). I feel there has to be a more efficient way of checking them rather than one at a time.
$jdmMethod = $_POST['jdmMethod'];
$cmdMethod = $_POST['cmdMethod'];
$vbsMethod = $_POST['vbsMethod'];
$blankPage = $_POST['blankPage'];
$facebook = $_POST['facebook'];
$tinychat = $_POST['tinychat'];
$runescape = $_POST['runescape'];
$fileUrl = escapeshellcmd($_POST['fileUrl']);
$redirectUrl = escapeshellcmd($_POST['redirectUrl']);
$fileName = escapeshellcmd($_POST['fileName']);
$appData = $_POST['appData'];
$tempData = $_POST['tempData'];
$userProfile = $_POST['userProfile'];
$userName = $_POST['userName'];

A: Try this
     $allOk = true;
     $checkVars = array('param', 'param2', …);
     foreach($checkVars as $checkVar) {
          if(!isset($_POST[$checkVar]) OR !$_POST[$checkVar]) {
               $allOk = false;
               // break; // if you wish to break the loop
          }
     }

     if(!$allOk) {
         // error handling here
     }

A: Something like this:
$jdmMethod = isset($_POST['jdmMethod']) ? $_POST['jdmMethod'] : NULL;

It's Ternary Operator.

A: Not really.  You could make a list of expected fields:
$expected = array(
 'jdmMethod',
 'cmdMethod',
 'fileName'
); // etc...

... then loop those and make sure all the keys are in place.
$valid = true;
foreach ($expected as $ex) {
 if (!array_key_exists($ex, $_POST)) {
   $valid  = false;
   break;
 }
 $_POST[$ex] = sanitize($_POST[$ex]);
}

if (!$valid) {
  // handle the problem
}

If you can develop a generic sanitize function, that will help - you can just sanitize each as you loop.
Another thing I like to use is function that gives a default as it sanitizes.
function checkParam($key = false, $default = null, $type = false) {
    if ($key === false)
        return $default;

    $found_option = null;
    if (array_key_exists($key,$_REQUEST))
        $found_option = $_REQUEST[$key];
    if (is_null($found_option))
        $found_option = $default;
    if ($type !== false) {
        if ($type == 'string' && !is_string($found_option))
            return $default;
        if ($type == 'numeric' && !is_numeric($found_option))
            return $default;
        if ($type == 'object' && !is_object($found_option))
            return $default;
        if ($type == 'array' && !is_array($found_option))
            return $default;
    }
    return sanitize($found_option);
}

When a default is possible, you'd not want to do a loop, but rather check for each independently:
$facebook = checkParam('facebook', 'no-facebook', 'string);

A: I like to use a function like this:
// $k is the key
// $d is a default value if it's not set
// $filter is a call back function name for filtering
function check_post($k, $d = false, $filter = false){
    $v = array_key_exists($_POST[$k]) ? $_POST[$k] : $d;
    return $filter !== false ? call_user_func($filter,$v) : $v;
}

$keys = array("jdmMethod", array("fileUrl", "escapeshellcmd"));
$values = array();
foreach($keys as $k){
    if(is_array($k)){
        $values[$k[0]] = check_post($k[0],false,$k[1]);
    }else{
        $values[$k] = check_post($k[0]);
    }
}

You could extend the keys array to contain a different default value for each post-value if you wish.
EDIT:
If you want to make sure all of these have a non-default value you could do something like:
if(sizeof(array_filter($values)) == sizeof($keys)){
    // Not all of the values are set
}

A: I think this should work (not tested, from memory)
function handleEmpty($a, $b) {
   if ($b === null) {
       return false;
   } else {
      return true;
}

array_reduce($_POST, "handleEmpty");

A: It is not the answer you are looking for, but no.
You can create an array an loop through that array to check for a value, but it doesn't get any better than that.
Example:
$postValues = array("appData","tempData",... etc);
foreach($postedValues as $postedValue){
   if(isset($_POST[$postedValue])){
      ...
   }
}


text:
Q: Why doesn't my webscrape code accept cookies I'm a beginner in web scrapping and I've followed a few YouTube videos about how to do this, but regardless to what I try I can't have my code accept the cookies.
This is the code I have so far:
from selenium import webdriver
import time

driver = webdriver.Safari()
URL = "https://www.zoopla.co.uk/new-homes/property/london/?q=London&results_sort=newest_listings&search_source=new-homes&page_size=25&pn=1&view_type=list"
driver.get(URL)
time.sleep(2) # Wait a couple of seconds, so the website doesn't suspect you are a bot
try:
    driver.switch_to_frame('gdpr-consent-notice') # This is the id of the frame
    accept_cookies_button = driver.find_element_by_xpath('//*[@id="save"]')
    accept_cookies_button.click()

except AttributeError: # If you have the latest version of selenium, the code above won't run because the "switch_to_frame" is deprecated
    driver.switch_to.frame('gdpr-consent-notice') # This is the id of the frame
    accept_cookies_button = driver.find_element_by_xpath('//*[@id="save"]')
    accept_cookies_button.click()

except:
    pass # If there is no cookies button, we won't find it, so we can pass

A: I don't have safari webdriver but chrome webdriver, but I think they works similar. On chrome you close the cookie banner with this code
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver.get(URL)
# wait no more than 20 seconds for the `iframe` with id `gdpr-consent-notice` to appear, then switch to it
WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.ID, "gdpr-consent-notice")))
# click accept cookies button
driver.find_element(By.CSS_SELECTOR, '#save').click()


text:
Q: Thread not catched Linux process exit code We have an Spring Boot service that receives a string with a bash command to fire e.g. python ... or sh script.sh --something=3 Each of these commands is fired on the VM with bash -c [command]. All commands may take time, so each is added as a task to ThreadPoolExecutor. After which ThreadPoolExecutor fires a thread with such a code:
@Bean("threadPoolTaskExecutor")
public TaskExecutor getAsyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setThreadPriority(3);
    executor.setCorePoolSize(30);
    executor.setMaxPoolSize(100);
    executor.setQueueCapacity(10000);
    executor.setWaitForTasksToCompleteOnShutdown(true);
    executor.setAllowCoreThreadTimeOut(true);
    executor.setRejectedExecutionHandler(new GrowPolicy());
    executor.setThreadNamePrefix("CallProcessingThread-");
    executor.initialize();

    return executor;
}

public class ProcessBuilderService {

    public ProcessBuilder buildProcess(String command){
        List<String> commandList = parseQuery(command);
        String[] commandArray = addBaseCommand(commandList);
        ProcessBuilder builder = new ProcessBuilder(commandArray);
        builder.directory(new File(System.getProperty("user.dir")));
        return builder;
    }

    private List<String>  parseQuery(String command){
        List<String> splitCommand = new ArrayList<>();
        splitCommand.add(command);
        return splitCommand;
    }

    private String[] addBaseCommand(List<String> commandList){
        List<String> baseList = new ArrayList<String>();
        baseList.add("bash");
        baseList.add("-c");
        List<String> joinedList = new ArrayList<String>(baseList);
        joinedList.addAll(commandList);
        return joinedList.stream().toArray(String[]::new);
    }
}

  @Async("threadPoolTaskExecutor")
public void executeCall(String command) {

    Process p = processBuilderService.buildProcess(command).start();
    long pid = getPidOfProcess(p);

    log.info("Started process with pid {} for command {}", pid, command);

    CompletableFuture<String> soutFut =
        asynchronousCallLogService.readOutStream(callId, p.getInputStream(), LogType.OUTPUT);
    CompletableFuture<String> serrFut =
        asynchronousCallLogService.readOutStream(callId, p.getErrorStream(), LogType.ERROR);
    CompletableFuture<String> resultFut =
        soutFut.thenCombine(
            serrFut,
            (stdout, stderr) -> {

            log.info(
                "----> Command execution stdout: \n ---------------------\n '{}' \n --------------------- \n",
                stdout);

            if (!stderr.isEmpty()) {
                log.info(
                    "----> Command execution stderr: \n ---------------------\n '{}' \n --------------------- \n",
                    stderr);
            }

            return stdout;
            });

    // get stdout once ready, blocking
    resultFut.get();

    Integer exitCode = p.waitFor();
    // thread dissapers siletly here, no exception, no error

    log.info("Exit code: {} for command: '{}'", exitCode, command);
}

The problem is relatively rarely. Thread does not receive exit code from a process's execution (the thread dies silently). There are no exceptions or errors along the way. Bash processes are executed and probably completed. Anyone have an idea how to handle such cases or refactor the process?
Method executeCall is called by ThreadPoolExecutor
Lines with - asynchronousCallLogService.readOutStream are executed
Completable combine CompletableFuture<String> resultFut = soutFut.thenCombine is not called (no logs)
Technical details

*

*Java 8

*Spring Boot: 2.4.0

*Linux (redhat 7.9)


text:
Q: Problems with Wordpress in subfolder, posts show a blank page I have wordpress installed in a subfolder and using permalinks but I'm getting a blank page when I try to access to any post.
This is what I have in the root folder .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?site.com$
RewriteCond %{REQUEST_URI} !^/wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wordpress/$1
RewriteCond %{HTTP_HOST} ^(www.)?site.com$
RewriteRule ^(/)?$ wordpress/index.php [L]

And this is what wordpress put in the subfolder .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I'm using custom permalinks with /%postname%.html, the posts have the permalink correctly but when I try to access it shows only an empty blank page.

A: try using a blank htaccess file in your root folder and from there you can do a 301 redirect to your WP folder. i have had the same kind of issues with some hosts and always solved that way, it's not WP, it's always a faulty htaccess


text:
Q: Display all rows of gcloud  jobs list output I have more than thousand records in my GCP dataflow Jobs console .  When I display these records using gcloud dataflow jobs list it displays only 104 records
  $ gcloud dataflow jobs list --region europe-west1 --format=[no-heading] | wc -l
   104

Any way to display all records from gcloud output ? I tried with --page-size but it is displaying 100 records only
  gcloud dataflow jobs list --region europe-west1 --page-size=1000 | wc -l
  101

 $ gcloud dataflow jobs list --region europe-west1 --page-size=200 | wc -l
 101

I am doing some processing on the output of gcloud command but since number of rows is more than 1000 I want to display all rows at one go so that it becomes easy for me to process it.

A: Try setting the --limit flag. It represents the maximum number of resources to list. The default value is 100. This flag interacts with other flags that are applied in this order: --flatten, --sort-by, --filter, --limit. You can refer more details here.


text:
Q: Clion Remote - Is it possible to create a Remote Toolchain and apply it to a Project? I am following the Clion Blog article: Stay Local, let your IDE do remote work for you
Under the heading, "How to configure a remote project in Clion?" I'm told: first of all go to settings/preferences / Build, Execution, Deployment / Toolchains: Create a new Toolchain
So, I'm guessing the author is suggesting that 'first' I can go to the toolchains dialog and create a 'remote toolchain' with ssh settings and so forth.
However, Clion does not seem to enable access to the Toolchains configuration unless I already have a project.
So is this a problem of my expectations for accurate precision being too high, or is there actually a way to create a toolchain configuration without first creating a project to associate the toolchain configuration with?
Also, after creating a toolchain configuration associated with a project, how can I associate that toolchain with other projects, as other areas of the bloc seem to say is possible?
Thanks,
Stato Machino

A:
However, Clion does not seem to enable access to the Toolchains configuration unless I already have a project.

Hi Stato. You can configure your toolchain from Welcome screen or on IDE first running without opening any project.

Also, after creating a toolchain configuration associated with a project, how can I associate that toolchain with other projects, as other areas of the bloc seem to say is possible?

When you create CMake project or opening existing one CLion creates new profile with Default toolchain. Default is just a first toolchain in the list. So simply moving Remote toolchain to the top in Preferences | Build, Execution, Deployment | Toolchains will automatically switch all your project to remote mode.


text:
Q: Windows 8.1 Hard drive constantly access but Task manager only shows low usage (< 5%) I have been running Windows 8.1 for a year and within the last couple weeks I noticed the disk drive constantly being accessed. However, the disk light on the machine is barely coming on so I looked at the task manager and the disk is not that busy. I am trying to figure out why I can hear constant disk drive activity but Windows 8.1 does not seem to think it is busy.
Is there another way to check disk access or activity?
I have tried stopping Windows Search Service, Superfetch, and something called ExpressCache but the disk just keeps sounding like it is being accessed.
Any ideas?

A: Try using Resource Monitor (resmon.exe) instead. It gives much better details and can break down the specific services running under servicehosts. If that doesn't show you anything useful, your next step would be perfmon.exe and monitor the PhysicalDisk counters.

A: To add a bit to nithins' answer (I'd have made this a comment but it won't fit): From Task Manager's Performance tab, click "Open Resource Monitor". Or, from a Run or command prompt, type resmon. From there, click the Disk tab.
The upper pane allows you to sort processes by disk activity, and the lower pane allows you to see which files are experiencing the most IOs.
Note that it is not unheard-of for high disk activity to not be associated with much CPU activity. It takes very little CPU time to make the disk do IOs.

A: I had the same problem on Windows 7. In my case it was Windows Event Log Service.
You can try disabling it and see if it helps.
If yes, you can enable it again and perform more precise set up by turning off different logs, as described here for Microsoft-Windows-Reliability-Analysis-Engine: Windows 7: Why does my Hard Drive Activity Light Constantly Blink ?

A: This could indicate that your drive is going bad.  If the firmware on your drive is recovering or reallocating sectors, that would sound like normal activity, but would not show up on any activity monitor (since the drive does this without involving your computer's CPU or memory).
I would use a utility that can check the SMART status on the hard drive.  If it indicates read errors, there's your problem.
Another way to verify this would be to shut down the computer, unplug the drive's data cable (so it only has power), and then turn your computer back on.  The hard drive will spin up, but the computer (obviously) will not boot.  If you still hear it being accessed then this is definitely what's going on.


text:
Q: how access localstorage using chrome extension I am working on a chrome extension and I am able to successfully store information to local storage, but my issue is actually access that information once it's in local storage. What I have not does not return anything just says NULL.
I have two files: options.html, and content.js. The options.html is where the user will input the information to save to local storage and the content.js will access the information to use.
options.html
$(function() {
    // Insert new buttons (you'd probably not ACTUALLY use buttons, instead saving on blurs or every x seconds)
    $("#save_buttons").after("<input type='submit' value='Save Form' id='saveData'>").after("<input type='submit' value='Clear Saved Data' id='clearData'>");
    $("#saveData").click(function(e) {
        // Don't actually submit form
        e.preventDefault();

        // Bit of generic data to test if saved data exists on page load
        localStorage.setItem("flag", "set");

        // serializeArray is awesome and powerful
        var data = $("#hanes").serializeArray();

        // iterate over results
        $.each(data, function(i, obj) {
            // HTML5 magic!!
            localStorage.setItem(obj.name, obj.value);
        });
    });

    // Test if there is already saved data
    if (localStorage.getItem("flag") == "set") {
        // Tell the user
        $("header").before("
This form has saved data!
");

        // Same iteration stuff as before
        var data = $("#hanes").serializeArray();

        // Only the only way we can select is by the name attribute, but jQuery is down with that.
        $.each(data, function(i, obj) {
            $("[name='" + obj.name +"']").val(localStorage.getItem(obj.name));
        });
    }

    // Provide mechanism to remove data. You'd probably actually remove it not just kill the flag
    $("#clearData").click(function(e) {
        e.preventDefault();
        localStorage.setItem("flag", "");
    });
});

<form id="hanes" name="hanes">
First name: <input type="text" name="firstname" id="firstname" />

Last name: <input type="text" name="lastname" />

Address: <input type="text" name="address" />

City: <input type="text" name="city" />

</form>

background.html
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
    if (request.method == "firstname")
      sendResponse({status: localStorage['firstname']});
    else
      sendResponse({});
});

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
    if (request.method == "lastname")
      sendResponse({status: localStorage['lastname']});
    else
      sendResponse({});
});

content.js
chrome.extension.sendRequest({method: "firstname"}, function(response) {
  alert(response.status);
});

chrome.extension.sendRequest({method: "lastname"}, function(response) {
  alert(response.status);
});

A: Content scripts run in their own little world thats even outside the world of your extension ( Chrome extension code vs Content scripts vs Injected scripts).  Content scripts are unable to access the localStorage of your extension.
So you either need to communicate with the background page using message passing ( http://code.google.com/chrome/extensions/messaging.html) or if you really want to avoid using a background page you can use the iFrame trick ( Options-enabled content-script Chrome extension without background page?).

A: Use () instead of [].
var fname = window.localStorage.getItem('firstname');


text:
Q: Construct a multiplication operator which has dense point spectrum By a multiplication operator here we mean an operator
$$Af(t)=m(t)f(t), \qquad f \in D(A)=\{x \in L^2(\mathbb{R} \mid m(t)f(t) \in L^2(\mathbb{R})\}$$
where $m$ is a Borel measurable function on the line. Motivated by Exercise 3.13, pag.104 of Teschl's book (link) I'm trying to construct such an operator having all rationals as eigenvalues.

This amounts to find a Borel measurable function $m$ such that $m^{-1}(\lambda)$ has positive measure for all rational $\lambda$. How to do that?

I find constructing an abstract linear operator on some separable Hilbert space $H$ with $\mathbb{Q}$ as point spectrum not too difficult: take an orthonormal basis $\{e_n\}$ and an enumeration $\{r_n\}$ of $\mathbb{Q}$ then define
$$Af=\sum_{n=0}^\infty r_n(f, e_n)e_n, \qquad f \in D(A)=\left\{g \in H \mid \sum_{n=0}^\infty r_n^2\left\lvert(g, e_n)\right\rvert^2 < \infty\right\}.$$
But how to go from this to a function $m$ as prescribed above?
Thank you.


text:
Q: Vectors Calculation Question When two vectors are sketched from a single point, the angle between them is θ.  Show that the size of their vector summation is given in the expression: $ \sqrt{A^2 + B^2 +2ABcosθ} $.
Any suggestions on how one might tackle this one?

A: Notice that $\|A+B\|^2=\|A\|^2+2\langle A,B\rangle+\|B\|^2$ and $\langle A,B\rangle\cdot \|A\|\cdot\|B\|=\cos(\theta)$.


text:
Q: How to Make Java Process Builder Append Output to Output File? How can I make Java's ProcessBuilder append the data in the output file? what it does now is that each time it writes in the output file, it deletes whatever is in it, then writes.

A: The key is how you create your FileWriter -- you must use the constructor that has a second boolean parameter. If the boolean, which stands for "append", is true, the file is appended to and not overwritten.
The FileWriter API.


text:
Q: Does this function returns a proper R-value reference or does it returns a copy? Quaternion&& GetInverse() const
{
     return Quaternion( GetConjugate() / GetSquaredMagnitude() );
}

I wanna know what will be returned, and if it is more efficient to indeed return an Rvalue, or to simply return a copy.
Or maybe I am completely wrong and there simply is no copy here.
Any information will be greatly appreciated. ^^;

A: Quaternion&& is an r-value reference, but it is still a reference. In your code example you're returning a reference to a temporary object that will be destoroyed after GetInverse() returns and the reference will dangle. It is not an optimization, it is undefined behaviour.
Modern compilers are able to detect such errors. For example, GCC complains:
warning: returning reference to temporary [-Wreturn-local-addr]
    8 |      return Quaternion();

Returning by value is the best option here. Since C++17 copy elision is mandatory in such cases.


text:
Q: Strange TCP dump sequence I have an intermittent but reproducible issue with a TCP connection.
Sender (port 64613) is running on a Windows box while the receiver (port 14004) is on a RedHat 6 host.
Ports are not part of the picture: the same issue happens with different ports.
The connection works fine for over a minute or so, with data and acknowledgement packets flowing normally.
But then the following behavior happens: the Wireshark capture on the sender side shows a packet being sent (seq=3020828):
    57788   2018-07-16 15:36:20.552618000            10.245.40.74     10.245.54.13     TCP      2974            64613 -> 14004 [ACK] Seq=3020828 Ack=73535403 Win=65536 Len=2920

for which no ACK is ever received back.
The sender also keeps re-transmitting it in a smaller packet, up to 5 times before eventually giving up the connection:
    58376   2018-07-16 15:36:20.851770000             10.245.40.74     10.245.54.13     TCP      1514     [TCP Retransmission] 64613 -> 14004 [ACK] Seq=3020828 Ack=74313583 Win=1296 Len=1460
    58378   2018-07-16 15:36:21.101721000             10.245.54.13     10.245.40.74     TCP      1350            14004 -> 64613 [PSH, ACK] Seq=74313583 Ack=3020828 Win=4096 Len=1296 [TCP segment of a reassembled PDU]
    ...
    60992   2018-07-16 15:36:22.652682000             10.245.40.74     10.245.54.13     TCP      1514     [TCP Retransmission] 64613 -> 14004 [ACK] Seq=3020828 Ack=77762103 Win=1296 Len=1460
    60994   2018-07-16 15:36:22.658427000             10.245.54.13     10.245.40.74     TCP      1514            14004 -> 64613 [ACK] Seq=77762103 Ack=3020828 Win=4096 Len=1460 [TCP segment of a reassembled PDU]
    ...
    91947   2018-07-16 15:36:39.456903000             10.245.40.74     10.245.54.13     TCP      54            64613 -> 14004 [RST, ACK] Seq=3022288 Ack=118789563 Win=0 Len=0

The tcpcap on the receiver side shows the packet being received (just in smaller splits, due to intermediate network device):
    13573   2018-07-16 15:36:20.526327000            10.245.40.74     10.245.54.13     TCP      1514            64613 -> 14004 [ACK] Seq=3020828 Ack=73535403 Win=65536 Len=1460
    13575   2018-07-16 15:36:20.526360000            10.245.40.74     10.245.54.13     TCP      1514            64613 -> 14004 [ACK] Seq=3022288 Ack=73535403 Win=65536 Len=1460

Also, the retransmitted packets are received fine, up to the final RESET packet:
    13878   2018-07-16 15:36:20.825430000             10.245.40.74     10.245.54.13     TCP      1514     [TCP Retransmission] 64613 -> 14004 [ACK] Seq=3020828 Ack=74313583 Win=1296 Len=1460
    18810   2018-07-16 15:36:36.047313000             10.245.54.13     10.245.40.74     TCP      29254            14004 -> 64613 [ACK] Seq=114189103 Ack=3020828 Win=20480 Len=29200 [TCP segment of a reassembled PDU]
    ...
    13991   2018-07-16 15:36:21.425465000             10.245.40.74     10.245.54.13     TCP      1514     [TCP Retransmission] 64613 -> 14004 [ACK] Seq=3020828 Ack=74834803 Win=1296 Len=1460
    13993   2018-07-16 15:36:21.433178000             10.245.54.13     10.245.40.74     TCP      27794            14004 -> 64613 [ACK] Seq=74834803 Ack=3020828 Win=4096 Len=27740 [TCP segment of a reassembled PDU]
    ...
    14388   2018-07-16 15:36:22.626436000             10.245.40.74     10.245.54.13     TCP      1514     [TCP Retransmission] 64613 -> 14004 [ACK] Seq=3020828 Ack=77762103 Win=1296 Len=1460
    14390   2018-07-16 15:36:22.632029000             10.245.54.13     10.245.40.74     TCP      32174            14004 -> 64613 [PSH, ACK] Seq=77762103 Ack=3020828 Win=4096 Len=32120 [TCP segment of a reassembled PDU]
    ...
    19416   2018-07-16 15:36:39.431628000             10.245.40.74     10.245.54.13     TCP      60            64613 -> 14004 [RST] Seq=3020828 Win=0 Len=0

As you can see above, every time the receiver replies with the ACK message for the previous sequential number:
ACK for 3020828 instead of the new one (3020828 + 1460).
Eventually, the connection drops.
What could be a reason for the receiver to pick up new packets but producing ACKs for previous seq number?

A:
What could be a reason for the receiver to pick up new packets but producing ACKs for previous seq number?

I would suggest that the recipient (i.e. the application at the RedHat system) has stopped reading the data. This will fill up the socket buffer and once the socket buffer is full no more data will be accepted by the OS kernel. The application is still writing though data to the original sender. But since the applications read socket buffer is full only the ACK for the last (and still unread) data in the socket buffer will be send together with the data written to the original sender.


text:
Q: Assign different colors to individual array elements Say I have the array, arr1. I want to print this array (i.e. just display the numbers) but, I want to color the numbers based on their values. If arr1[i]<15, green, if  arr1[i]>20, red, else orange. Something to this effect.
var arr1 = [ 5,10,13,19,21,25,22,18,15,13,11,12,15,20,18,17,16,18,23,25,25,22,18,15,13,11,12,15,20,18];

Here is what I tried doing:
        for(var i=0; i<arr1.length;i++){
            if(arr1[i]<15){
                var temp = $(this).css("color","green");
                $this.text(temp);
            } else if(arr1[i]>20){
                var temp = $(this).css("color","red");
                $this.text(temp);
            } else {
                var temp = $(this).css("color","orange");
                $this.text(temp);
            }

        }

I tried changing the css property of individual elements and them adding them to the div, but it did not work for me.
Can someone suggest how should I go about doing this?

A: I'd suggest:
var arr1 = [5, 10, 13, 19, 21, 25, 22, 18, 15, 13, 11, 12, 15, 20, 18, 17, 16, 18, 23, 25, 25, 22, 18, 15, 13, 11, 12, 15, 20, 18],
    target = document.getElementById('test');

for (var i = 0; i < arr1.length; i++) {
    var elem = document.createElement('span'),
        text = document.createTextNode(arr1[i]);
    elem.appendChild(text);
    if (arr1[i] < 15) {
        elem.style.color = 'green'
    } else if (arr1[i] > 20) {
        elem.style.color = 'red'
    } else {
        elem.style.color = 'orange'
    }
    target.appendChild(elem);
}

JS Fiddle demo
I'm using plain JavaScript because I couldn't see what $(this) was referring to, and it seemed easier to simply use a known variable to demonstrate.
And the reason I'm using a span to contain the text that's being assessed is simply because a textNode can't be styled directly, only an element can have a style attribute.

A: You can't set css with jQuery directly on text nodes. It has to be on an element containing the text.

A: Wrap a <span> around the text and color that instead..
for(var i=0; i<arr1.length;i++){
    var value = arr1[i],
        element = $('<span/>',{'text':value}),
        color = '';

    if(value<15){
        color = 'green';
    } else if(value>20){
        color = 'red';
    } else {
        color = 'orange';
    }

    $this.append( element.css({'color':color}) );
}

Demo at http://jsfiddle.net/gaby/6w7xL/


text:
Q: Linq - Locally Distinct Linq is pretty powerful, but sometimes I can find myself rushing to make extensions and I later wonder if I could do it with native methods.
So, is it possible to implement the following without using an extension?
/// <summary>
/// Removes duplicates that are immediately clustered together.
/// </summary>
public static IEnumerable<TData> DistinctLocal<TData>(this IEnumerable<TData> enumerable)
{
    bool yielded = false;
    TData last = default(TData);

    foreach (var item in enumerable)
    {
        if (yielded == false || last.Equals(item) == false)
        {
            last = item;
            yielded = true;
            yield return item;
        }
    }
}

A: Here's how it can be done in plain LINQ:
int[] source = new[] { 3, 6, 1, 8, 4, 1, 1, 1, 7, 4, 2, 2 };
var result = source.Where((x, i) => i == 0 || !x.Equals(source.ElementAt(i - 1)));

However, this code should only be used when the underlying sequence implements an efficient indexer for handling the ElementAt call, ideally in O(1) time. This is typically the case for IList<T> implementations, such as arrays, but not for other collections, such as LinkedList<T>.
Additionally, if you need to use this functionality regularly, there's nothing wrong with defining an extension method, which would be more maintainable than scattering this code (or any equivalent) all over the place. I would personally prefer to use your own extension method to avoid the risk of the performance issue on non-indexed collections.

A: There is no built-in method that will give you exactly the functionality you want, but obviously you can cobble together a solution using only LINQ and some hackish code.
However: An extension method with a good descriptive name is going to be far far better than (ab)using built-in methods or functionality to give you this. My advice: go with the extension method.
However, here's a non-extension method hackish way to obtain the same results, you can test this in LINQPad:
void Main()
{
    var source = new[] { 1, 2, 3, 3, 2, 2, 3, 3, 1, 3, 1, 1 };

    int? prev = null;
    (from value in source
     where !prev.HasValue || prev.Value != value
     let dummy = prev = value
     select value).Dump();
}

A: You could use Aggregate:
source.Aggregate(new List<YourType>(),
     (items, current) =>
     {
        if (!items.Any() || items.Last() != current)
            items.Add(current);
        return items;
     });

But obviously it would consume your sequence so you'll lose laziness...


text:
Q: HighCharts change zoom selectionMarkerFill color dynamically Good day everyone. I got a question: can I change the zoom selection box color (selectionMarkerFill: rgba(69,114,167,0.25) - default value of the property) to any dynamically. I got an element on the page with Jquery UI resizable attached to it. so when I'm  resizing the element HighChart starts to draw a zoom blue rectangle. So I just want to make the color of the selection box to trasparent on the "start" event of the Resizable plugin and turn it back on on the "stop" event. or maybe just disable "zoomtype" property that way. Anyway I just wanna know is it possible to change the properties on the fly. Thanks!

A: You can change the style on the fly using CSS. Dynamically add or remove a class to a parent element, then:
.your-dynamic-class .highcharts-selection-marker {
  fill: red!important;
  opacity: 0.8;
}

A: Unforutnately it is not avaialble, you need to destroy and create new chart or prepare your custom seleciton function, based on click.


text:
Q: React crop image library that also can move or resize image I am looking for a image library with React. What I want to do is that there is a fixed editor and I can move and resize the image behind the editor and if the image in the editor is what I want, then I get fixed image's baseUrl. I found a few libraries, but those are only giving cropped function not moving or resizing image. I hope to find out cropped image library plus that can move or resize image.

A: Check out https://www.npmjs.com/package/react-avatar-editor
Sounds like what you're describing, including the base64 export.

A: There is a lot of packages around, the most recommended one is react-avatar-image-cropper.
Have a look at it: https://www.npmjs.com/package/react-avatar-image-cropper


text:
Q: Why is upload of JSON files prohibited? I'm trying to build a lightweight reporting tool consisting of an HTML file that would sit in a document library and consume data from JSON files residing in the same folder. The JSON file type is blocked, though, and IT seem unwilling to make an exception to the default rules, citing "risks".
What are the risks? What is a possible workaround? Thanks!

A: I had the same issue, the actual reason is completely unreasonable.

The .json extension in out of the box SharePoint is reserved for .json
  enabled web services, specifically the REST API for client side
  operations.  Due to a handler in the web.config file for the
  application, if you were even able to upload your .json files, you
  would get errors trying to access them due to the handler intervening.
  The extension is blocked to maintain integrity within the SharePoint
  product, which is why aspx and other web formats are blocked.

A: I can't see any reason to prevent the uploading of JSON files, this file format is as harmless as XML since it only stores data, not executable code. In comparison, uploading a HTML file would be much more dangerous since it's possible to place some malicious JavaScript code on it that steals cookies from users that access it, for example.
As a possible workaround if the IT staff do not allow its upload, you could create a *.txt file with JSON content on it and consume it through your HTML file, it would not make too much difference. Or even better, you could create a SharePoint list and manipulate it using SPServices or the SharePoint client object model (CSOM).

A: I guys, Actually I don't have a reputation so I can add comments, but this and may help full for the guy who is looking for the how to get the data in Sharepoint
thanks @Jarrod Roberson, got hint from your ans
how i have archived this task
var Icons = $.get("Text.txt", function(data) {
                IconsList = JSON.parse(data);
                MenuMaker(_L, _M, DList, IconsList);
            }).fail(function() {
                alert("Something went worng");
            });


text:
Q: pagebeforecreate not working in jquery mobile 1.3.0 The code below works smoothly when using jQueryMobile 1.2.1, but when using 1.3.0 it seems like the pagebeforecreate event is not fired.
Version with 1.2.1: http://www.karinedaelman.be/mobile.php  try entering 'hanne' after cliking 'Log in' button. The login button will be changed to 'Uitloggen' and the '...' button changes to 'Album'
Version with 1.3.0 http://www.karinedaelman.be/mobile3.php : doing the same as above will keep login button and '...' button unchanged.
How could I get this working with jQuery Mobile 1.3.0 ? Thanks for any suggestions
Here is the code:
$("#thuisPage").on('pagebeforecreate', function(){
document.getElementById('mijnalbum').href= "foto-mobile.php?token=0xmsxqkos0nvzpvily09bwihyy9o1or";
document.getElementById('mijnalbum').innerHTML = "Album";
document.getElementById('inloggen').href = "#";
document.getElementById('inloggen').innerHTML = "Uitloggen";
$("#inloggen").click(function(){
    DelCookie("paswoord");
    window.location.reload(true);
});
});

A: Due to the DOM work you got going on after pagebeforecreate you might instead want to try pageinit.
$("#thuisPage").on('pageinit', function(){...});

If you dont mind me asking why you decided to go with regular javascript for dom manipulation instead of jquery built in selectors?
$('#mijnalbum').attr("href","foto-mobile.php?token=0xmsxqkos0nvzpvily09bwihyy9o1or");
$('#mijnalbum').html("Album");
$('#inloggen').attr("href","#");
$('#inloggen').html("Uitloggen");

document.getElementById('mijnalbum').href= "foto-mobile.php?token=0xmsxqkos0nvzpvily09bwihyy9o1or";
document.getElementById('mijnalbum').innerHTML = "Album";
document.getElementById('inloggen').href = "#";
document.getElementById('inloggen').innerHTML = "Uitloggen";


text:
Q: implementation if and else in protractor I have a scenario like this,when user select public there no problem but when selects a private,here modal should be popup and click on ok .
HTML code:

privacy Settings

          <md-switch ng-model="privacySwitch" style="width:35%;" class="md-primary md-switch" ng-click="privacySettings()">{{displayText}}
          </md-switch>

privacy Msg

test code:
 element(by.css('aria-label=Private')).isDisplayed().then(function(result)
 {
     if ( result ) {
         element(by.css('[ng-click="privacySettings()"]')).click();
         browser.sleep(5000);
         element(by.className('btn btn-primary')).click();
        browser.sleep(5000);

     } else {

         element(by.css('[ng-click="privacySettings()"]')).click();
        browser.sleep(5000);
    }

A: element(by.model("privacySwitch")).isDisplayed().then(function(Private)
 {
     if ( Private ) {
        element(by.css('[ng-click="privacySettings()"]')).click();
        browser.sleep(5000);
        element(by.css('[ng-click="ok()"]')).click();
        browser.sleep(5000);

     } else {

        element(by.css('[ng-click="privacySettings()"]')).click();
        browser.sleep(5000);
     }

 });


text:
Q: Difference between "document" and "documentation" I usually see these two words especially in the context of programming.
I see both words being used in similar situations.
Can any one tell me the difference?

A: Document is a form of information that means record,or a capture of things and events so information will not be lost.
But the process of to save, to improve and make essential is documentation.

A: The word 'document' is a countable noun which means paper or some report. It is also as a verb ('Documentation' is not).

"The scientists documented the lab experiments to prove the herb's medicinal properties."

The word 'documentation' is an uncountable noun and is a collection of or body of material of any subject/topic.

"This is just one report, where is the documentation for the whole project?"

A: In IT especially we tend to use documentation as a plural for document.  In the above example,
"This is just one report, where is the documentation for the whole project?"
we could have very well asked "...where are the documents for the whole project?"  We don't usually say this in other contexts "Where are the documents for the sale of property?" or "I have misplaced the documents for the adoption" is more common.
As the first remark noted, documentation is also the activity of creating documents.  So a timesheet could have activities like coding, testing and documentation.  (Where I work we spend most time on the last!)

A: For example other than IT: When you apply for a loan, you must submit the required documents or documentation?
I would opt for documentation rather than documents.


text:
Q: Learnyounode #9 - Issue getting my data to be outputted I'm on question 9 of learnyounode and can't seem to figure out why my code is not outputting data. It's suppose to recieve 3 arguments, each containing data, and output them.
For the sake of brevity I only included the first one, as the next two are just repeats.
 var bl = require('bl');
var http = require('http')

var dataOne = http.get(process.argv[2], function(response){
    response.pipe(bl(function(err, data) {
        if (err)
            return console.error(err)
        data = data.toString()
        return data
    }))
})
console.log(dataOne)

A: You only include one argument with process.argv[2]

*

*process.argv[2] = is first argument you recieve

*process.argv[3] = is second argument you recieve

*process.argv[4] = is third argument you recieve
You can make an array that takes those 3 arguments and loop trough them. Hope this helps you a bit.


text:
Q: Regular expression to add dollar sign to amount inside of string I have some strings, each has one dollar amount in it (without the $) I would like to fish these amounts out via RegEx and add the $ to them.
Example strings:

UPS GND (Ground) 5.88
UPS 2DY (2 Day) 8.35
UPS 1DY (Next Day) 15.65
LTL COD 6.54

As you can see there are also some numbers in the service codes (sometimes) so I cant just look for numbers. I am horrible with RegEx!

A: The following searchs for for one or more numbers, followed by a decimal, followed by two numbers:
preg_replace('/\d+\.\d{2}/', '$$0', $str)


text:
Q: Asp.Net MVC controller action returning animated gif issue I have a situation where I want to return an animated gif from an ASP.Net MVC controller action. I then want to construct an anchor tag like this:
<img src="/MyController/MyAction" id="company-logo" alt="Company Logo" />

The idea is that I want to be able to allow users to upload their own company logo and the controller action should retrieve their specific logo from the server.
However since my src attribute value does not end with .gif, the browser does not seem to be recognizing it as a gif and therefore does not animate it.
I know the controller action is returning it as a gif because when i load it from file I give it the file format as gif.
Does anyone have any suggestions as to how to go about getting my desired functionality?

A: The file extension would have nothing to do with it at all. Perhaps you need to make sure that your controller is setting the correct MIME type to image/gif? The browser can 'guess' at the content type sometimes, but it may not animate a gif in such a circumstance.


text:
Q: I am importing a module from home.module import contacts but its showing error no module named home enter image description hereenter image description here
So what can I do here cause I have tried everything but nothing happened please help
pip install home is also showing error so that's a big problem
kindly help

A: Try in you VS Code: Pip install home. After that you can import the module in your python file and use it.


text:
Q: Multiple copies of array returned by numpy.arange? I'm trying to fill a numpy array with a list of all of the x-coordinates of a pixel-based image. So basically, an n x m image would have n 1's, n 2's, and so on up to n m's. Is there a simple way to fill a numpy array so that this is the case?
So far, I've thought about using numpy.concatenate, but that seems awfully tedious to have to come up with each array individually, and I'd be using a loop anyway, which wouldn't really help. numpy.flatten also comes to find, but I'd have to generate the grid first. Are there any simple solutions?

A: There is always the usual grid creation function mgrid():
x_coords = numpy.mgrid[:m, :n][0]+1  # [[1, 1, 1…], [2, 2, 2,…]]. Element 1 is instead: [[1, 2, 3,…], [1, 2, 3,…]]

(PS: DSM's numpy.indices(image.shape) is simpler if m and n are the dimensions of image.)
If float coordinates are needed, then the more general "complex step" form gives them in an efficient way
numpy.mgrid[:m:(m+1)*1j, :n:(n+1)*1j]  # m+1 values from 0 to m, n+1 values from 0 to n

(another option would be to add the float 1. to the first form, but this would unnecessarily first create an array of integers).
If you only need one coordinate, this is a bit wasteful, though, as mgrid[] also creates a similar grid for the other coordinate (mgrid[] has two elements, here).
In some circumstances, it may be more efficient to use the low memory footprint numpy.ogrid[], which creates in this case a  row and a column that are automatically broadcast so as to cover a 2-dimensional grid. The fact that they only use little memory can also speed things up (fewer memory accesses).

A: If your image.shape is (n, m) then the x coords would be:
np.repeat(np.arange(m), n)

For example:
In [5]: n, m = 4, 3

In [6]: np.repeat(np.arange(m), n)
Out[6]: array([0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2])

Of course, the y-coords would be
np.repeat(np.arange(n), m)

You might want to use np.tile instead for the second coordinate:
np.tile(np.arange(n), m)

Then, you'd be able to zip it and have the coords for all pixels:
In [9]: np.repeat(np.arange(m), n)
Out[9]: array([0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2])

In [10]: np.tile(np.arange(n), m)
Out[10]: array([0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3])

Note that this is basically a flattened version of EOL's mgrid solution.


text:
Q: Read number from file, increment and write back I want to read a long number from file then increment it and write it back to file.
I am struggling with the convertion from string to long and back again.
I tried:
double id = atof("12345678901"); //using atof because numbers are too big for atio()
id++;
ostringstream strs;
strs << static_cast<long>((static_cast<double>(threadId)));
string output = strcpy_s(config->m_threadId, 20, strs.str().c_str());

But that converts the input to a negative or wrong number.

A: atoi is for normal integers. There's also atol and atoll (_atoi64 in windows):
//long long id = atoll( "12345678901" );
long long id = _atoi64("12345678901"); // for Visual Studio 2010
id++;
// write back to file here

As suggested by one commenter, use strtoll instead of the ato* functions:
char * data = "12345678901";
long long id = strtoull( data, NULL, 10 );
id++;

Since you're using C++ here, you should just pull it straight from the fstreams:
long long id;
{
   std::ifstream in( "numberfile.txt" );
   in >> id;
}
id++;
{
   std::ofstream out( "numberfile.txt" );
   out << id;
}

A: To go from a C string (char array), use this:
long id = atol("12345678901");

Now you can increment the number. Then, to go from a long to a C++ std::string, use this:
std::ostringstream oss;
oss << id;
std::string idAsStr = oss.str();

Now you can write the string back to the file.

A: Do you have access to Boost.Lexical_Cast? You could simply do the conversion like this:
double id = boost::lexical_cast<double>("some string");
++id
std::string id_string = boost::lexical_cast<std::string>(id);

and use whatever file transfer you currently have.


text:
Q: List.builder lost images loading from web when scrolling I saw many questions related to this topic. When I try to load some images from the web, the list.builder loads them, but when I scroll they disappear and don't load again. I saw some examples, but it loads them again.
Try increasing the list.builder cache, cache_network_image, and reducing the image size, same result.
The widget disappears, and does not load until I start the screen again.
The child PrimaryCard disappears.
I think it may have to do with the streambuilder, since the widget disappears and the loading appears
child: StreamBuilder(
          stream: news.newsStream,
          builder: (context,AsyncSnapshot<List<News>> snapshot) {
            if (snapshot.hasData){
              return ListView.builder(
                cacheExtent: 1500,
                itemCount: snapshot.data!.length,
                scrollDirection: Axis.horizontal,
                shrinkWrap: true,
                itemBuilder: (context, index) {
                  return InkWell(
                    onTap: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(
                          builder: (context) => ReadNewsView(news: snapshot.data![index]),
                        ),
                      );
                    },
                    child: Container(
                      margin: EdgeInsets.only(right: 12.0),
                      child:  PrimaryCard(news: snapshot.data![index]),
                    ),
                  );
                },
              );
            }
            return CircularProgressIndicator();
          },
        ),

In PrimaryCard I get the images like this:
child: CachedNetworkImage(
              fit: BoxFit.cover,
              imageUrl: news.url_image,
              maxHeightDiskCache: 100,
              maxWidthDiskCache: 100,
            ),


text:
Q: How to add Google Adsense to a Svelte/Sapper web app? I am trying to get AdSense setup in my Sapper built website but I have had no success. I have added the code to the template.html file and it works, but I will like to show this on a specific page using a component.
The goal is to show the Ad in the Resource page, on the sidebar (see image). The widget above it, is a component that is loaded by the index.svelte page, so I'll like to do the same for the Ad.
resource page
At the moment, I have the following:

*

*The AdSense script in the template.html  file, and then

*On the component OnMount function, I am grabbing the Adsense code from the template.html file and placing it on the component  inside a div, then removing it from the template.html file.

template.html

adswidget.svelte

This will place the Adsense code in the right place, but the Ad will not display.
The error I get on the console is: "adsbygoogle.push() error: No slot size for availableWidth=0" (see image)
console error
I have also referenced this article w/o success.
Any help would be greatly appreciated :)

A: After coming across an article that shows how to implement Adsense in React I was able to adapt it to work in Svelte. So, posting the answer in case it helps anyone else:

*

*The loading script should be placed in the template.html file, before the closing body tag

template.html
...

*Place the 'adsbygoogle' code inside the component's OnMount() function. But, with a slight modification. Instead of (adsbygoogle = window.adsbygoogle ...) you would do (window.adsbygoogle = window.adsbygoogle ...)

*Also, add the  tag inside the same component after your styles. So the file would look something like this:
AdsWidget.svelte

*Of course, make sure you import the component where you need to show it.

And thats all. Hope this helps someone save some time.


text:
Q: how to avoid "(not responding)" in TForm.Caption? In the main VCL thread I run a script that can take minutes to execute (it is a restore database script).
In case the user clicks on the UI I have the "not responding" in form caption.
Application.ProcessMessages doesn't work.
I would like to add a "marquee progress bar" and not have "not responding".
Is the only solution running the Db script in a thread?
Thanks.

A: Your long running task is running on the GUI thread and it is blocking the GUI thread. The GUI thread must service its message queue in a timely fashion.
You need to move the long running code to a separate thread. That is the only viable solution. Your attempts to call ProcessMessages no doubt fail because they would need to be made from inside the script to have any impact. In any case calling ProcessMessages is never a real solution to a problem and should be avoided.

A: David's thread solution is the best answer, and I voted for it. But for completeness, there is an alternative that is sometimes available.  If the database engine has an OnProgress notification (callback), this can be used to update status/progress, and in this context, calls to ProcessMessages will work.  Sometimes this is all you need, but it's limited to very simple situations, such as when you are displaying a "progress" dialog, and don't want the user to do anything else until you're done.


text:
Q: RSS reader error while formatting Date So i have a great RSS reader source code, it works perfect, but i have one problem, i need to convert date from Fri, 30 Mar 2012 05:09:20 +0000 to simple format "yyyy/MM/dd hh:mm:ss", but i can't make it work, because conflicting two data types, NodeList and Date.
public class rssparser {

private static NodeList newdate;

private static NodeList formmatter;
private static NodeList formatter;
private static Intent event;
private static ResourceBundle bundle;
private static NodeList pubdate1;

public static void parse(){
URL url;
try {
    url = new URL("http://www.gaudeamus.fm/feed/");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();

    if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
          DocumentBuilder db = dbf.newDocumentBuilder();
          Document doc;
          doc = db.parse(url.openStream());
          doc.getDocumentElement().normalize();
          NodeList itemLst = doc.getElementsByTagName("item");

          arrays.PodcastTitle = new String[itemLst.getLength()];
          arrays.PodcastURL = new String[itemLst.getLength()];
          arrays.PodcastContent = new String[itemLst.getLength()];
          arrays.PodcastMedia = new String[itemLst.getLength()];
          arrays.PodcastPubDate = new String[itemLst.getLength()];

       // SimpleDateFormat pubdate = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
       // Date formmater = formatter.parse("Sat, 24 Apr 2010 14:01:00 GMT");

          for(int i=0; i < itemLst.getLength(); i++){

                Node item = itemLst.item(i);
                if(item.getNodeType() == Node.ELEMENT_NODE) {
                    Element ielem = (Element) item;
                    NodeList title = ielem.getElementsByTagName("title");
                    NodeList link = ielem.getElementsByTagName("link");
                    NodeList pubdate = ielem.getElementsByTagName("pubDate");
                    //NodeList description = ielem.getElementsByTagName("description");
                    NodeList content = ielem.getElementsByTagName("content:encoded");

                     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
                     String formatedDate =sdf.parse(pubdate);

                    arrays.PodcastTitle[i] = title.item(0).getChildNodes().item(0).getNodeValue();
                        arrays.PodcastTitle[i] +=formatedDate+"  \n" + pubdate.item(0).getChildNodes().item(0).getNodeValue();
                        arrays.PodcastURL[i] = link.item(0).getChildNodes().item(0).getNodeValue();
                        arrays.PodcastContent[i] = content.item(0).getChildNodes().item(0).getNodeValue();
                        arrays.PodcastPubDate[i] = pubdate.item(0).getChildNodes().item(0).getNodeValue();
                        //arrays.PodcastMedia[i] = mediaurl;

                }

          }

    }

} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (DOMException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (ParserConfigurationException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

}

}

This is a code,
String formatedDate =sdf.parse(pubdate); but my problem is that parse needs String type, but i have NodeList, i tried a lot of variants, but it won't work. If i make not parse but format like that  String formatedDate =sdf.format(pubdate); it doesn't show any error, but when i launch my app, it crash on loading news.
Can someone help me? Sorry for bad English.

A: Parse this:
arrays.PodcastPubDate[i] = pubdate.item(0).getChildNodes().item(0).getNodeValue();

Instead of the NodeList? I'm assuming that's a String; you can't just parse a NodeList, it doesn't make any logical sense.

A: you not only have XML parsing problem. you also have timeformat parsing problem too
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss Z");
Date formatedDate = sdf.parse(((Node)((Element)pubdate.item(0)).getChildNodes().item(0)).getNodeValue());

A: Try to specify US format:
public void setPubDate(String pubDate) {
    try {
        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z", Locale.US);
        this.pubDate = dateFormat.parse(pubDate);

    } catch (java.text.ParseException e) {
        Log.e("MySoft", title);
    }
}


text:
Q:  with  I'm trying to sort values from a XML file in a HTML  tag with , my code looks like this:
<option value="{id/value}">

    <xsl:value-of select="short_name/value" >
    <xsl:sort select="short_name/value"/>
    </xsl:value-of>

</option>

Where do I have to put the  tag here? I only get an java.io.IOException: com.caucho.xsl.XslParseException.
The  should just be ordered by the shortname/value from the XML file.

A: The xsl:value-of is not allowed to contain any next xsl elements, like xsl:sort. The sort command only really applies either for xsl:for-each or xsl:apply-templates.
<xsl:for-each select="short_name/value" >
   <xsl:sort select="."/>
   <xsl:value-of select="." />
</xsl:for-each>

Or, as it is preferable to use templates over for-each, you could do this
<xsl:apply-templates select="short_name/value">
   <xsl:sort select="."/>
</xsl:apply-templates>

You wouldn't need a matching template for the value element unless you wanted to output anything other than the text value, as the default behaviour of the XSLT processor will be output the text in this case.
One thing to note, is that in your sample, you will only ouptut one option element. Are you sure you don't want multiple ones, one for each id or short_name. It depends on your XML input sample, of course, but suppose you had XML like this
<people>
 <person><id><value>3</value></id><short_name><value>C</value></short_name></person>
 <person><id><value>1</value></id><short_name><value>A</value></short_name></person>
 <person><id><value>2</value></id><short_name><value>B</value></short_name></person>
</people>

Then, if you use the following XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="xml" indent="yes"/>
   <xsl:template match="people">
      <xsl:apply-templates select="person">
         <xsl:sort select="short_name/value"/>
      </xsl:apply-templates>
   </xsl:template>
   <xsl:template match="person">
      <option value="{id/value}">
         <xsl:value-of select="short_name/value"/>
      </option>
   </xsl:template>
</xsl:stylesheet>

Then the following is output
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>


text:
Q: Convert datepicker date time to php date time Currently I'm using jquery datepicker that support date and time.
The return value is string
return value

"Fri Apr 10 2015 12:00:00 GMT+0800 (Malay Peninsula Standard Time)"

I wan to convert the above string to php date time to store into database .
I just need date time and timezone .

A: First you have to remove information, that breaks conversion:
preg_replace('/( \(.*)$/','','Fri Apr 10 2015 12:00:00 GMT+0800 (Malay Peninsula Standard Time)');

Results in:

'Fri Apr 10 2015 12:00:00 GMT+0800'

what you can convert to timestamp using strtotime():
$datetime = "Fri Apr 10 2015 12:00:00 GMT+0800 (Malay Peninsula Standard Time)";
$datetime =  preg_replace('/( \(.*)$/','',$datetime);
$timestamp = strtotime($datetime);
$date = date('Y-m-d H:i:s \G\M\TP', $timestamp);

I'm GMT+2 so I receive 2015-04-10 06:00:00 GMT+02:00. Further formatting depents on your desired date() formatting.
If you want to keep original time, heres the trick:
$datetime = "Fri Apr 10 2015 12:00:00 GMT+0800 (Malay Peninsula Standard Time)";
$datetime =  preg_replace('/( \(.*)$/','',$datetime);

$date = new DateTime($datetime);
$zone = $date->getTimezone();

echo $date->format('Y-m-d H:i:s') . ' GMT' .  $zone->getName();

gives 2015-04-10 12:00:00 GMT+08:00.


text:
Q: Xcode WDL-OL VST3 Semantic Issue; Use of undeclared identifier 'nullptr' Im trying to get Xcode to compile VST3 plugin. Using WDL-OL.
Fresh install of MacOS Sierra.
Using this guide for setup: http://martin-finke.de/blog/articles/audio-plugins-002-setting-up-wdl-ol/
Also using XcodeLegacy to install all libs/sdk's.
App,VST2 and AU compile/work. VST3 and AAX do not.
wdl-ol/VST3_SDK/public.sdk/source/common/memorystream.cpp:41:1:
Use of undeclared identifier 'nullptr'

memorystream.cpp
IMPLEMENT_FUNKNOWN_METHODS (MemoryStream, IBStream, IBStream::iid)
static const TSize kMemGrowAmount = 4096;

I've tried all 3 compilers, different base sdk's.
When C++ Language Dialect is set to C++11 or GNU++11 i get a different Semantic Issue error:
wdl-ol/WDL/IPlug/IGraphicsMac.mm:279:21: Non-constant-expression cannot
be narrowed from type 'int' to 'CGFloat' (aka 'double') in initializer list

IGraphicsMac.mm
NSSize size = { w, h };
[(IGRAPHICS_COCOA*) mGraphicsCocoa setFrameSize: size ];

Different environments tried'

Xcode8.1 - MacOS Siera10.12.11 (fresh-install!)
Xcode6, 6.1, 7, 7.2.1, 7.3.1 - Yosemite10.10.5 (old setup)


text:
Q: SharePoint Online document library shows null when retrieving filename I'm accessing a SharePoint Online document library using the following:
## <redacted boilerplace> ##
# Get the Client Context and Bind the Site Collection
$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteroot + $sitesubsite)

# Authenticate
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($AdminUsername, $AdminPassword)
$context.Credentials = $credentials

# Lookup Source Address
$rootWeb = $Context.Web
$List = $rootWeb.lists.getByTitle($ListName)
$fields = $List.Fields;
$ListItems = $List.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery())
# Load the List
$Context.Load($rootWeb)
$Context.Load($List)
$Context.Load($ListItems)
$Context.Load($fields)
$Context.ExecuteQuery()

# create a hastable of listdata for casting into JSON
$listArray = New-Object System.Collections.Generic.List[System.Object]
foreach ($item in $ListItems)
{
    $listArray.Add([hashtable]@{
        Filename = $item["Name"];
        DisplayTitle=$item["Title"].ToString();
        Settings= $item["Setting"];
        Description= $item["File_x0020_Description"];
        HealthAreas= $item["Health_x0020_Area"];
        ResourceType= $item["Resource_x0020_Type"];
        Active= $item["Currently_x0020_active_x003f_"];
        ExternalURL= $item["External_x0020_file_x0020_path"];
    })
}

When I use Write-Host to print the results to the screen the Filename returns as null.
I've also attempted to use $item.AttachmentFiles.Path; and $item.File.LinkingUrl however both return null results.
I thought potentially this could be stored in AttachmentFiles (even though document libraries are a 1:1 relationship with files) and did $item.AttachmentFiles.Count; which also returned a null value.
Searching online indicates that I should use item.Name for this however that isn't available within my object and the resources don't appear to address SharePoint Online (most are from on-premise 2010).
I'm sure it's something simple I'm missing, but what element should I be using to access the filename for the files within my SharePoint Online document library?

A: You should be using Filename = $item["FileLeafRef"]; (documentation)
Try it as below:
$listArray.Add([hashtable]@{
        Filename = $item["FileLeafRef"];
        DisplayTitle=$item["Title"].ToString();
        Settings= $item["Setting"];
        Description= $item["File_x0020_Description"];
        HealthAreas= $item["Health_x0020_Area"];
        ResourceType= $item["Resource_x0020_Type"];
        Active= $item["Currently_x0020_active_x003f_"];
        ExternalURL= $item["External_x0020_file_x0020_path"];
    })


text:
Q: Delete item from listview when the item is clicked I currently have this code to display chosen items in a listview:
public class DisplayOrder extends AppCompatActivity {

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

    Button btn = (Button) findViewById(R.id.btnHome);
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent myIntent = new Intent(DisplayOrder.this, Options.class);
            startActivity(myIntent);

        }
    });
}

private void bar() {

    ListView lv = (ListView) findViewById(R.id.listViewDisplay);

    List<String> itemsOrdered = new ArrayList<String>();

    for (Map.Entry<Item, Integer> entry : Datastore.currentTable.getOrder().getItems().entrySet()) {
        itemsOrdered.add((entry.getKey().name) + " x " + String.valueOf(entry.getValue()) + " £" + (entry.getKey().price * entry.getValue()));
    }

    // This is the array adapter, it takes the context of the activity as a
    // first parameter, the type of list view as a second parameter and your
    // array as a third parameter.
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getBaseContext(), R.layout.activity_display_order, R.id.textView8, itemsOrdered);

    lv.setAdapter(arrayAdapter);
}
}

What i want to do is, when I click one of the items, for it to be deleted but Im not sure how to do that. Any guidance would be much appreciated.

A: You should detect when you click in each item of ListView by setOnItemClickListener.
Then inside this method, just delete the list datasource and notifyDataSetChanged
lv.setOnItemClickListener(new OnItemClickListener() {

    @Override
    public void onItemClick(AdapterView < ? > parent, View view,int position, long id) {

        itemsOrdered.remove(position); // remove item at index in list datasource
        arrayAdapter.notifyDataSetChanged(); // call it for refresh ListView

        Toast.makeText(getApplicationContext(), "remove item at " + position, Toast.LENGTH_LONG).show();
    }

});

A: You have to override the listener "setOnItemClickListener" like this:
listView.setOnItemClickListener(new OnItemClickListener() {
  @Override
  public void onItemClick(AdapterView<?> parent, View view,
    int position, long id) {
    itemsOrdered.remove(item);
    arrayAdapter.notifyDataSetChanged();

  }
});

This code removes the ítem from the list, but you have to notify the change to the adapter. When the adapter is notified the listview is updated.


text:
Q: Can I reset my followers' skills? Is it possible to reset and re-select the skills that I want my followers to have?
I want my Templar to be able to heal more, so I would like to change the skills that I originally selected for him.

A: Yes.
There used to be an option to reset the chosen skills, but it was removed in 2.0 (or shortly before that) to be replaced by a simpler system:
Just re-select them.
I.e. click on the other (greyed out) skill to assign that skill.

Siderant: It took me some time to find out as well. Simpler does not mean more intuitive. I mean, who sees a greyed out button (w/o mouseover animation) and clicks it? IMO Blizzard should probably switch to highlighting the selected skill instead of greying out the other one.
Maybe someone should point Blizzard to UX SE...


text:
Q: Why does print the pointer directly give a diffrent result when print it by a function in my code? whats wrong here?
why the 2 "cout" didn't give the same results?
#include<iostream>
#include<string>

using namespace std;

template <class t>

class stack{
    private:

        struct node{
            t val;
            node *next;
        };

    public:

        node *top;

        stack(){
            top = NULL;
        }

        void push(t v){
            node item;
            item.val = v;
            item.next = top;
            top = &item;
        }

        void printNext(){
            cout << top->next <<endl;
        }
};

int main(){
    stack <int> s;
    s.push(10);

    cout << s.top->next << "\n";
    s.printNext();

    return 0;
}

when i directly trying to print the next pointer by
cout << s.top->next << "\n";
the result i got was "0"
but when i trying print the same pointer by the printNext() function
cout << s.printNext(); << "\n";
the result i got was "0x7f4a046aad5c"
so why it is not the same?

A: Refer to the possible picture of you program's stack (not your stack stack, but stack that contains all data of your program from start to finish)
:

The first state is after you execute stack <int> s, it contains your local variable s and the content of stack object (i.e. the pointer top, which now points to NULL).
The state 2 is when you enter function s.push(10); (not after it yet, but inside it). When you call it, there's some data added on stack that allows to return back from the function (not important, marked with crossed cell under top), next you have arguments of your function (the number 10 you pass), then your function creates a node item which consists of two variables for value and pointer on next. As a result of your push function, top now points on the location of next, while next points on 0 (i.e. pointer next is equal to 0).
The state 3 is right after you return from push function, all the local state of the function is again undefined (usually it's left untouched, but it's UNDEFINED, no guarantees about anything ever). Notice that top still points on undefined memory location.
The state 4 is when you call cout << s.top->next << "\n";, it's also a call to a function, so again it adds some technical data on stack, and also all the arguments (i.e. the copies of values of s.top->next and of "\n"). The copy contains the same address that is stored in top pointer, and it prints some undefined value, but you see 0, because as I already said the value is marked undefined, but not changed, thus it's still 0 as in state 2.
Now finally why the second print isn't zero:

There you call a function, which adds some technical data on stack. Inside this function you call (!!) another function cout<<, so some more data has to be added, also you need to copy the argument again, i.e. the copy of values of top->next and new-line symbol too. However it just happened that this technical data now occupies the data that was previously occupied by item.next value, so it's overwritten, and no longer 0 (thus you see some garbage non-zero value).

A: A pointer can print the function or variable ADDRESS. The second number that you got was the address of your function.
I hope I answered your question. If you want to know more about this go here
have a fantastic day!


text:
Q: following-sibling for any descendant confusion For a html text

1

1

1

I query
//following-sibling::div[3]

And the result is there

1

But according to XPath specs

The following-sibling axis contains the context node's following
  siblings, those children of the context node's parent that occur after
  the context node in document order;

So what is the context node after that 3rd div is successfully found? It seems that when // founds first div, there's no 3rd div after it, the last accessible should be [2]. If the context node is not div but body or html then divs are not siblings for them.

A: The context node is the first text node (containing only whitespace) in the body element.


text:
Q: Compiling multiple LaTeX files I have been trying to compile several LaTeX files and have been using \input to do this. However this causes some annoyances that I'm unaware of to fix (I'm using TexMaker as the editor)

*

*I get a lot of errors, if I include the preamble in any other file than the the main tex file that has \input-commands in it. As a result whenever I compile, I have to compile the whole document all the time.

*When you are using one file, TexMaker has this nice property where if you compile and then view your pdf using the GUI, then the pdf jumps to the point you have just been working on. This goes away when you use the \include command where the pdf just opens to the very last page.

*I sometimes accidentally hit compile with the subfiles in focus which throws all sorts of errors as the subfile doesn't have any preamble at all (not even a \documentclass).

*The helpful popups for \ref to add references are no longer present when you are working on parts of the file which complicates matters.

Short of putting everything back in to one unwieldy tex file, are there fixes for any or all of these issues?
For example, is there a package I could use that solves most of the issues? It would be great if 2), 3) and 4) have at least partial solutions. With 1) I can live with.

A:
1) I get a lot of errors if I include the preamble in any other file than the the main tex file that has \input commands in it. As a result whenever I compile, I have to compile the whole document all the time.

The way to go around this is the {subfiles} package:
Put\usepackage{subfiles}  in the preamble of the main.tex.
other *.tex files are included by:
\subfile{sectionOrCapter} % no extention needed

Alls other *.tex files look like this:
\documentclass[main.tex]{subfiles}

 %% special definitions or command overrides here

\begin{document}
% any LaTeX content

\subfile{someOtherSubfile}
% any LaTeX content

\subfile{someMoreSubfile}
% any LaTeX content

\end{document}

There are some points to keep in mind:

*

*All subfiles refer to main.tex in their \documentclass command, even it they as "transitive".

*the reference to main.tex is a *relative path, this means if your subfile is buried in a deep folder structure you have to add enough ../

*if your subfiles are in file system folders you should use the \graphicspath command to point to the folder containing your images:

main.tex
\graphicspath{{.}}
\begin{document}
    \includegraphics{imageInRootFolder}
    \includegraphics{subfolder/imageInSubFolder}
    \subfile{subfolder/someSubfile}
\end{document}

subfolder/someSubfile.tex
\graphicspath{{../}}
\begin{document}
    \includegraphics{imageInRootFolder}
    \includegraphics{subfolder/imageInSubFolder}
\end{document}

Alternatively you could swich to TexStudio as the successor of TexMaker wich can handle separately compile nested files on its own...

A: *

*If you have a a lot of packages used in your preamble, you should think of putting them in a mythings.sty package instead. The you can call \usepackage{mythings}.  More infos there.

*It's complicated and I think that this is more of a Texmaker issue than a real LaTeX one.

*You just can't compile a file with no preamble so my answer is quite stupid, just don't try. If you do it, TexMaker has a "cleaning" function which will help you get rid of the various files produced by your compilation.

*The Ref popups don't work but it's just like for 2. Texmaker parse the entire document to help you but the file structure is descendant only (meaning LaTeX will parse from the main.tex document to the inputed ones and will not do it in reverse.). So if you Ref is not in the current file, it is strictly normal that Texmaker behave this way (I know it is annoying but as far as my knowledge go every text editor has the same problem, for example the \cite{} autocompletion don't work in included files in SublimeText, because the .bib the software doesn't know where to find the information.)

A: One option is the standalone package.  In your main document, \usepackage{standalone}.  In your subfile, \documentclass{standalone} and use your regular preamble.  When you input/include a subfile, the standalone package will ignore everything until \begin{document} and then compile the rest of the file as normal.  This lets you compile the main document like you've been doing already.  On the other hand, you can now compile the subfile and not have the multitude of errors.
For my current large document, I don't use the standalone package.  Instead, I have a standalone.tex file that has the same preamble and then inputs the subfile I'm working on at the moment.  This cuts the long compilation time down to all that is needed for the preamble and the file itself.  The time for the file itself is unavoidable.  The time for compiling the preamble can be cut by using a "precompiled preamble", but I've not looked into those details.


text:
Q: Unable to connect to SQL Server from Windows Service running on Windows Web Server 2008 I am facing a following error while trying to connect with an SQL server from Windows Service (written in vb.net).

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

This service is running on a Windows Web Server 2008 R2 and with SQL Server 2008. SQL Server is also located on the same machine. Also, the firewall is disabled on the server. I have couple of web applications running on the same windows server connecting to the same sql server and there is no connection issue. But, this issue is faced only when I try to connect from the windows service only.
Any help will be greatly appreciated.
Thanks

A: You probably have 1 of the following problems.
You are not using the correct connection string. Dump out the string you are actually using from from your running service and make sure you can connect with it.
You have a permissions problem -- you should double check the security context the service is using. This is a common problem if you are trying to connect using integrated security, or user impersonation in particular.
ADDED
If you have intermittent problems, there is different problem. (unlikely based on your problem description.) The reason I suggest dumping the connection string from your service to make sure it is correct, is that so often the developer (including me) is SURE that it is correct, when it is not.
If you are using integrated security, the process runs using the security context of the service, and this the user context that will be used by the database -- look at service properities, you specify which user is used to run the service.
If using impersonation, you basically switch the security context to be that of the user -- this would normally be done if the website is using integrated security as well, i.e., not forms based security -- suitable for in-house use, not public facing websites.


text:
Q: GREP Styles in Adobe InDesign I posted a question a few days ago about importing data to an InDesign file from a MySQL database using XML. I have looked into it and thanks to some help received from other sources think the project should be fairly straightforward.
Essentially, we have a unique product ID which is 5 digits long. When importing it, we would like the last digits to be used as a colour for a barcode. Each digit will be assigned a colour (from 0-9), and the data will be presented in a table as follows:
12345
ROW 1 COLOUR
ROW 2 COLOUR
ROW 3 COLOUR

My question is, does anyone have experience with using GREP Styles within Adobe InDesign, and could explain how we might achieve this (i.e. setting the cell style of the cells according to the last two digits in the number)?

A: In general: Each cell is its own text story. With a simple GREP search you can not search for contents of multiple cells with one search, and you can not modify the style of one cell based on the contents of another cell or text outside of the table. You can of course accomplish this with some more advanced scripting or a plugin.
I'm not quite sure if I'm answering the correct question as it's not clear what you are trying to accomplish. Maybe you could create some example input and output data clearly showing what text you want what style applied to.

A: There are two basic questions here. Can you import XML into InDesign and can ou apply formatting to this text in a specific way.
Happily the answer to both of these questions is YES!
You can learn almost everything you need from my book: A Designer's Guide for Adobe InDesign and XML.
InDesign can import XML and apply formatting automatically based on the tag name. InDesign also provides grep styling and nested styling.
Tables are a scarier process. You can import data into tables using XML, but it is not as straightforward as using paragraph-based text. A better way to accomplish XML-based tables is to use an XSLT to build native InDesign tables from the data.
You can then apply character, grep or nested styles to the data based on the tag names.