text:
Q: fatal error: memory: No such file or directory while compiling node js in clion I'm trying to run node js via cmake with the help of clion, and I get the following error while pressing the green arrow (in clion gui):
make[3]: *** [CMakeFiles/node.dir/build.make:160: CMakeFiles/node.dir/deps/brotli/c/common/constants.c.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /home/eran/CLionProjects/node/benchmark/napi/function_args/napi_binding.c:5:
/home/eran/CLionProjects/node/deps/v8/src/objects/string.h:8:10: fatal error: memory: No such file or directory
    8 | #include <memory>

I believe to be a standard library of c++11?
And probably I misconfigured the cmakelists? as just make works (probably node js project has correctly configure it?).
here is the beginning of my cmakelists.txt
cmake_minimum_required(VERSION 3.19)
project(node)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_BUILD_TYPE debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

include_directories(deps/brotli/c/common)
include_directories(deps/brotli/c/dec)
include_directories(deps/brotli/c/enc)
include_directories(deps/brotli/c/include)
include_directories(deps/brotli/c/include/brotli)
include_directories(deps/cares/config)
include_directories(deps/cares/config/aix)
include_directories(deps/cares/config/android)
include_directories(deps/cares/config/cygwin)
include_directories(deps/cares/config/darwin)
include_directories(deps/cares/config/freebsd)
include_directories(deps/cares/config/linux)
include_directories(deps/cares/config/netbsd)
include_directories(deps/cares/config/openbsd)
include_directories(deps/cares/config/sunos)
include_directories(deps/cares/include)
include_directories(deps/cares/src)
include_directories(deps/histogram/src)
include_directories(deps/icu-small/source/common)
include_directories(deps/icu-small/source/common/unicode)
include_directories(deps/icu-small/source/i18n)
include_directories(deps/icu-small/source/i18n/unicode)
include_directories(deps/icu-small/source/tools/escapesrc)
include_directories(deps/icu-small/source/tools/genrb)
include_directories(deps/icu-small/source/tools/pkgdata)
include_directories(deps/icu-small/source/tools/toolutil)
include_directories(deps/llhttp/include)
include_directories(deps/nghttp2/lib)
include_directories(deps/nghttp2/lib/includes)
include_directories(deps/nghttp2/lib/includes/nghttp2)
include_directories(deps/ngtcp2)
include_directories(deps/ngtcp2/nghttp3/lib)
include_directories(deps/ngtcp2/nghttp3/lib/includes)
include_directories(deps/ngtcp2/nghttp3/lib/includes/nghttp3)
include_directories(deps/ngtcp2/ngtcp2/crypto)
include_directories(deps/ngtcp2/ngtcp2/crypto/includes)
include_directories(deps/ngtcp2/ngtcp2/crypto/includes/ngtcp2)
include_directories(deps/ngtcp2/ngtcp2/lib)
include_directories(deps/ngtcp2/ngtcp2/lib/includes)
include_directories(deps/ngtcp2/ngtcp2/lib/includes/ngtcp2)
include_directories(deps/openssl/config)
include_directories(deps/openssl/config/archs)
include_directories(deps/openssl/config/archs/aix-gcc)
include_directories(deps/openssl/config/archs/aix-gcc/asm)
include_directories(deps/openssl/config/archs/aix-gcc/asm/crypto)
include_directories(deps/openssl/config/archs/aix-gcc/asm/crypto/include)
include_directories(deps/openssl/config/archs/aix-gcc/asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/aix-gcc/asm/include)
include_directories(deps/openssl/config/archs/aix-gcc/asm/include/openssl)
include_directories(deps/openssl/config/archs/aix-gcc/asm_avx2)
include_directories(deps/openssl/config/archs/aix-gcc/asm_avx2/crypto)
include_directories(deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/include)
include_directories(deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/include/internal)
include_directories(deps/openssl/config/archs/aix-gcc/asm_avx2/include)
include_directories(deps/openssl/config/archs/aix-gcc/asm_avx2/include/openssl)
include_directories(deps/openssl/config/archs/aix-gcc/no-asm)
include_directories(deps/openssl/config/archs/aix-gcc/no-asm/crypto)
include_directories(deps/openssl/config/archs/aix-gcc/no-asm/crypto/include)
include_directories(deps/openssl/config/archs/aix-gcc/no-asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/aix-gcc/no-asm/include)
include_directories(deps/openssl/config/archs/aix-gcc/no-asm/include/openssl)
include_directories(deps/openssl/config/archs/aix64-gcc)
include_directories(deps/openssl/config/archs/aix64-gcc/asm)
include_directories(deps/openssl/config/archs/aix64-gcc/asm/crypto)
include_directories(deps/openssl/config/archs/aix64-gcc/asm/crypto/include)
include_directories(deps/openssl/config/archs/aix64-gcc/asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/aix64-gcc/asm/include)
include_directories(deps/openssl/config/archs/aix64-gcc/asm/include/openssl)
include_directories(deps/openssl/config/archs/aix64-gcc/asm_avx2)
include_directories(deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto)
include_directories(deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/include)
include_directories(deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/include/internal)
include_directories(deps/openssl/config/archs/aix64-gcc/asm_avx2/include)
include_directories(deps/openssl/config/archs/aix64-gcc/asm_avx2/include/openssl)
include_directories(deps/openssl/config/archs/aix64-gcc/no-asm)
include_directories(deps/openssl/config/archs/aix64-gcc/no-asm/crypto)
include_directories(deps/openssl/config/archs/aix64-gcc/no-asm/crypto/include)
include_directories(deps/openssl/config/archs/aix64-gcc/no-asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/aix64-gcc/no-asm/include)
include_directories(deps/openssl/config/archs/aix64-gcc/no-asm/include/openssl)
include_directories(deps/openssl/config/archs/BSD-x86)
include_directories(deps/openssl/config/archs/BSD-x86/asm)
include_directories(deps/openssl/config/archs/BSD-x86/asm/crypto)
include_directories(deps/openssl/config/archs/BSD-x86/asm/crypto/include)
include_directories(deps/openssl/config/archs/BSD-x86/asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/BSD-x86/asm/include)
include_directories(deps/openssl/config/archs/BSD-x86/asm/include/openssl)
include_directories(deps/openssl/config/archs/BSD-x86/asm_avx2)
include_directories(deps/openssl/config/archs/BSD-x86/asm_avx2/crypto)
include_directories(deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/include)
include_directories(deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/include/internal)
include_directories(deps/openssl/config/archs/BSD-x86/asm_avx2/include)
include_directories(deps/openssl/config/archs/BSD-x86/asm_avx2/include/openssl)
include_directories(deps/openssl/config/archs/BSD-x86/no-asm)
include_directories(deps/openssl/config/archs/BSD-x86/no-asm/crypto)
include_directories(deps/openssl/config/archs/BSD-x86/no-asm/crypto/include)
include_directories(deps/openssl/config/archs/BSD-x86/no-asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/BSD-x86/no-asm/include)
include_directories(deps/openssl/config/archs/BSD-x86/no-asm/include/openssl)
include_directories(deps/openssl/config/archs/BSD-x86_64)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm/crypto)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm/crypto/include)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm/include)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm/include/openssl)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm_avx2)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/include)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/include/internal)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm_avx2/include)
include_directories(deps/openssl/config/archs/BSD-x86_64/asm_avx2/include/openssl)
include_directories(deps/openssl/config/archs/BSD-x86_64/no-asm)
include_directories(deps/openssl/config/archs/BSD-x86_64/no-asm/crypto)
include_directories(deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/include)
include_directories(deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/BSD-x86_64/no-asm/include)
include_directories(deps/openssl/config/archs/BSD-x86_64/no-asm/include/openssl)
include_directories(deps/openssl/config/archs/darwin-i386-cc)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm/crypto)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm/crypto/include)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm/crypto/include/internal)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm/include)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm/include/openssl)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm_avx2)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto)
include_directories(deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/include)


text:
Q: Nuget manager not installing packages from internet using package manager I have Visual Studio 2019 Commmunity edition. Whenever I download any package from Nuget Package Manager -> Manage Nuget Packages for Solution, it throws an error

NuGet.Protocol.Plugins.PluginException: A plugin was not found at path
'C:\Users \ (Current Username)\ .nuget\plugins'

I can't download any packages even when I create new empty project.
I get the same error even when I use the
Install-Package

command. Please help

A: Answering my own question :
I realized that there is something called
NUGET_PLUGIN_PATHS

in environment variables. It was pointing to my 'C:\Users \ (Current Username)\ .nuget\plugins' directory . I deleted that environment variable and guess what ? It started downloading packages from nuget.org using Install-Package command. It took me 2 days to find this solution.

redpajama_set_name: RedPajamaStackExchange


text:
Q: AS3 Cicyle days of week So i have this code can somewone tell me i am doing this right. Sometimes  when i change date the code in text gives me null. i am trying to cycle days of week inside four text fields, so it will be day for today is hidden and text boxes displays tommorow day and next days after tommorow here is the code:
var dayOfWeek_array:Array = new Array("Sunday", "Monday", "Tuesday", "Wensday", "Thursday", "Friday", "Saturday");
var today_date:Date = new Date();

var day_str:String = dayOfWeek_array[today_date.getDay()+0];
var day_str1:String = dayOfWeek_array[today_date.getDay()+1];
var day_str2:String = dayOfWeek_array[today_date.getDay()+2];
var day_str3:String = dayOfWeek_array[today_date.getDay()-4];
var day_str4:String = dayOfWeek_array[today_date.getDay()-3];

myTextField1.text = (""+day_str1);
myTextField2.text = (""+day_str2);
myTextField3.text = (""+day_str3);
myTextField4.text = (""+day_str4);

A: For day 3 and day 4, you do a SUBTRACTION. Which means that if the day of the week is 2, and you decrease it by 4, you get index of -2. The array doesn't have such an index. And it should give you out of bounds error :)

A: You need to 'wrap' your 'getDay() + N' value to ensure it is always in the range 0-6.
i.e.
var tmp = today_date.getDay() + 3;
if(tmp > 6) tmp -= 7;
var day_str3:String = dayOfWeek_array[tmp];

(You could probably have a more robust solution using modulus, but for this situation this solution clear and simple)


text:
Q: Mouse sending spurious x11 event (scroll right button) I have an annoying problem where my mouse seems to somewhat randomly emit a 'Scroll right' event (button press 7).
I am running Debian Buster on my main desktop at the moment.  I have not made any explicit changes to my mouse's configuration (remapping, etc).
The only somewhat relevant change I have made recently was installing xpra, so that I can remote into my desktop.  I have done some basic troubleshooting which I believe basically rules this out.
Basic troubleshooting steps:

*

*Did a reboot

*Purged xpra and did a reboot

*Disconnected mouse dongle and put in different port.

*Replaced batteries in mouse

*Moved keyboard to different USB port.

*Ran xinput to figure out the mouse is spitting out button press 7:

   button release 7
   button release 7
   button release 7
   button release 7
   button press   7
   button press   7
   button release 7
   button press   7

*Noticed, in xinput, that the problem is much worse in firefox-esr (but something perhaps related appears to happen, for example, in the volume mixer at the top of the default Debian window manager.)  That is to say, xinput sees lots of spurious events when a firefox window is active.

*It also seems to happen in Citrix, so maybe there is a commonality like GTK or something (but I don't know the internals of either firefox or Citrix).

*sudo apt update && sudo apt upgrade

*Tried the mouse on a different machine.
So far, nothing has worked.  Little help?  Thank you!


text:
Q: parse column in r (or other language such as SQL) Here's the current dataframe:
baking_time <- c("20 to 30 min", "20 to 30 min", "40 to 50 min", "10 to 30 min", "60 to 90 min", "40 to 50 min")
cake_type <- c("Chocolate", "Chocolate","Lemon","Tart","German","Lemon")

recipes <- data.frame(baking_time, cake_type)

Now I'm trying to parse baking_time to get this:
baking_time <- c(25, 25, 45, 20, 75, 45)

I've tried using parse but I'm having trouble parsing both numbers than performing operations on them
mutate(avg_time = (parse_number(baking_time) + parse_number(baking_time))/2)

A: We extract the numeric part of the column and get the mean
library(tidyverse)
recipes %>%
   mutate(avg_time = str_extract_all(baking_time, "\\d+") %>%
           map(., ~ mean(as.numeric(.x))))
#   baking_time cake_type avg_time
#1 20 to 30 min Chocolate       25
#2 20 to 30 min Chocolate       25
#3 40 to 50 min     Lemon       45
#4 10 to 30 min      Tart       20
#5 60 to 90 min    German       75
#6 40 to 50 min     Lemon       45

NOTE: readr::parse_number extracts the first numeric part.  If there are  multiple elements, needs to break it down and apply parse_number
recipes %>%
   separate(baking_time, into = c("first", "second"),
            sep=" to ", remove = FALSE) %>%
   transmute(baking_time, avg_time = (parse_number(first) + parse_number(second))/2)

With base R, one option is to read with read.csv after changing the non-numeric part to a delimiter with gsub, get the rowMeans
rowMeans(read.csv(text=gsub("\\D+", ",", recipes$baking_time), header = FALSE)[-3])
#[1] 25 25 45 20 75 45

A: You can do this in base R using gregexpr and regmatches to get the times.
Times = regmatches(baking_time, gregexpr("\\d+", baking_time))
sapply(Times, function(x) mean(as.numeric(x)))
[1] 25 25 45 20 75 45

A: stringi (the un-crutched stringr) and base R:
stringi::stri_match_first_regex(
  recipes$baking_time,
  "([[:digit:]]+)[[:space:]]+to[[:space:]]+([[:digit:]]+)",
)[,2:3] -> x
class(x) <- "numeric"
apply(x, 1, mean)
## [1] 25 25 45 20 75 45


text:
Q: Changin the charset of application Laravel I have a laravel app connected to a firebird DB
the charset of the DB is

WIN1251
  i set this in my .env like:

DB_CHARSET=WIN1251

but when i try to get data using #query_builder :
$product = DB::table('products')
    ->where('id', '=', 34)
    ->pluck(
        'name'
    );

I have an exception like:
Malformed UTF-8 characters, possibly incorrectly encoded


text:
Q: Where does business logic go that involves multiple aggregates? I'm still a beginner when it comes to domain driven design, and I am trying to model something like an RPG's battle system as a bounded context.  I am trying to model a bounded context in which a Combatant has a list of abilities, and each Ability has a list of effects that it would apply.  For example, a common Effect would be to deal damage to the target Combatant.
As far as I can tell, the two aggregate roots would be Combatant and Ability, with Effect being a value object.
Now, I am not certain where I should be putting my logic for the interaction between Combatants.  In particular, I will need logic that handles the execution of an ability taking into account the source Combatant and the target Combatant.  Likewise, I will need similar logic for the individual effects of an ability.  Since the action and effects are being caused by one instance of a Combatant and are targeting a second instance of Combatant, I don't think the logic should be done within the Combatant aggregate itself.
The problem is that I just don't know where the logic should go.  I initially thought a domain service would be the right spot, but after researching them, I think I may have been wrong. Does anyone have any insight as to where I should be putting this logic?

A: The business logic that coordinates processes involving multiple Aggregates should stay in a Saga/Process manager. This does not mean that all the logic should stay there. No. Only the coordinating logic. The actual implementation depends on the programming language and the architecture but I could give you and example.
For example, let's suppose that a combatant inflects damage (fires) to other combatant. The firing process is handled by a Saga. But every combatant should have two command methods: inflectDamageTo and getDamagedBy. The Saga loads the  shooter aggregate, calls shooter.fireAt(shootedId, effect) and persist the changes. Then it loads the  shooted aggregate, calls shooted.getDamagedBy(shooterId, effect) and it persist the changes.
Before and after each step the Saga could persist its progress. This could be as simple as an Enum. You do this in order to have enough information to recover in case of something goes wrong and the Saga is forcefully stopped (i.e. process is stopped, server is restarted etc).
Keep in mind that in this process you have two transactions, not only one  (or none, depending on the type of persistence). Also, notice that each aggregate receives only the ID of the other and not a full reference.
P.S. There are some domains where the performance is more important than the maintainability of the code or the consistency of the data; I base my answer on the fact that you have analyzed your business requirements and you still want to use the DDD approach.


text:
Q: Reporting Services Report Timeout We have a 2005 report that can be 2 to around 250 pages with the average being in the ballpark of 10.  When the report was developed, our developer was told that 10 pages or so was the right number, and without knowing the business domain very well he decided reporting services was the correct approach.
Now that the report has been deployed to PROD, we are having some complaints of the report timing out.  Neither the developer or I on this are terribly surprised given the sheer size of the report that is being requested (250 pages).
My question is what options do we have to use our current report that works 95% of the time and make it work for the remaining 5%?  Are there configuration options anywhere to improve the rendering performance or anything like that?

The report is used for return
  authorizations so the size of the
  returns can very.  Each authorization
  page has 4 different return labels
  with logos and barcodes.

To clarify:
The report is rendered fairly quickly from reporting services to the report viewer, but when we export to PDF is when it takes a while to load.

A: There is a report execution timeout setting for each report in SSRS.  By default, they are set to use the default system setting, but they can be customized through the report manager or SSMS.
Are you sure it isn't a database command timeout?  That could be adjusted in the connection string.  Is it the report that is inefficient or the query?  250 pages for a SSRS report really isn't that bad.  We run reports that large often.  SSRS actually outperforms most of the other reporting engines we use.

A: You can fiddle with any of the following:
1) Modify SessionTimeout and SessionAccessTimeout system properties.
Here is a sample script for rs.exe which will set these values for you:
Public Sub Main()
    Dim props() as [Property]
    props = new [Property] () { new [Property](), new [Property]() }

    props(0).Name = "SessionTimeout"
    props(0).Value = timeout

    props(1).Name = "SessionAccessTimeout"
    props(1).Value = timeout

    rs.SetSystemProperties(props)
End Sub

You can run this script with the following command:
rs -i sessionTimeout.rss -s http://yourserver.com/reportserver -v timeout="6000"

The timeout is expressed in seconds, so this example sets the SessionTimeout and SessionAccessTimeouts to about an hour and a half.
(via http://blogs.msdn.com/b/jgalla/archive/2006/10/11/session-timeout-during-execution.aspx)
2) Change Report Execution Timeout via Report Manager
Open Report Manager
At the top of the page, click Site Settings. This opens the General Properties page of the site.
Report Execution Timeout
Specify whether report processing times out after a certain number of seconds.
(via http://msdn.microsoft.com/en-us/library/ms181194.aspx)
3) Set the HttpRuntime ExecutionTimeout

*

*Open the ReportServer's Web.config file by going to Start -> Administrative Tools -> Internet Information Services.

*From there, expand Web Sites -> Default Web Site, and click on ReportServer. On the right-hand pane, right-click 'Web.Config' and select 'Open'.

*Locate the HttpRuntime parameter. If it doesn't exist, you will have to create it within the  section.

*Set the executionTimeout value to '10800' (3 hours) as shown below:

<system.web>
    <httpRuntime executionTimeout = "10800" />
</system.web>

4) Increase the script timeout on the report server

*

*Go onto your Reporting Server and open up Internet Information Services; right-click on the ReportServer and select Properties.

*Go to the Options tab, and set the ASP Script timeout to 300 seconds (this didn't really work for me).

5) Set the report to never time out on the server

*

*Open your web browser on the server and go to http://yourserver.com/Reports

*Navigate to the Report location and click on the problem report(s).

*On the left-hand pane, click on Properties.

*In the 'Report Execution Timeout' click the 'Do not timeout report execution'.
(via http://geekswithblogs.net/ssrs/archive/2009/10/30/steps-to-resolve-ssrs-timeout-issues.aspx)


text:
Q: Where are Windows Key shortcuts defined? Specifically for Snipping Tool On Windows Server 2016, the Snipping Tool comes up in capture mode when I invoke Windows + Shift + S.  In Windows 10, I can mimic this behavior by running "snippingtool.exe /clip" but this does not work in Windows Server 2016.
I'd like to figure out what Windows is doing when the Windows + Shift + S keystroke is used because I want to enter this same capture mode directly from a Powershell script.
I'd think this is somewhere visible in the Registry as I recall it being so in old version of Windows CE but I cannot find the equivalent in Windows Server.
Where is this information stored?

A: In typical Windows apps, keyboard shortcuts are hard-wired directly into the apps. There is no configuration database where they can be remapped. (Until such a feature is explicitly implemented in the application, like you can find for example in Microsoft Word.)
The most notable exception to this is Windows Explorer. It serves as a proxy between the user and built-in auxiliary tools. If you exit it*, you can see that many (but not all) keyboard shortcuts stopped working. This way you can quickly determine which keyboard shortcuts are served by this system application. But even if you find that Shift+Win+S is answered by Windows Explorer, there is no table where you can configure it.
If you really need to introduce the shortcut where it is missing (and also potentially overwrite the existing one), then use the AutoHotKey like the following (note: full path may be required)
+#s::Run snippingtool.exe /clip

If you find out how various internal Windows actions are launched (some can be invoked via calling DLL methods or command line etc.), you can create more shortcuts on your own – example:
+#d::Run C:\WINDOWS\system32\control.exe desk.cpl`,@0`,3  ; opens Desktop control panel

__
*) To exit, Ctrl+Shift+right-click the task bar and select Exit Explorer from the context menu. To launch Windows Explorer again, press Ctrl+Shift+Esc and using menu File > Run new task, launch explorer app again by typing its name and pressing Enter.


text:
Q: Setup grub2 on a GPT software raid 3 TB HDD I like to setup grub2 on a GPT softare raid 3 TB HDD.
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1050623   512.0 MiB   FD00  Linux RAID
   2         1050624      5860533134   2.7 TiB     FD00  Linux RAID

The first partition is boot, the second is LVM. After bootstrapping I installed grub2 which died with "missing BIOS boot". But I can't change partition 1 to BIOS boot because of the software raid, right?
How to solve this situation?
Info: Debian Wheezy x86_64
Error:
/usr/sbin/grub-setup: warn: This GPT partition label has no BIOS Boot Partition; embedding won't be possible!.
/usr/sbin/grub-setup: error: embedding is not possible, but this is required for cross-disk install.

A: Even with GPT you should still be able to install GRUB on the drive (/dev/sda?) Try these commands:
# grub_bios-install --boot-directory=/boot --no-floppy --recheck --debug /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

it should make you a working GRUB install. You will however probably need to tune some options in the GRUB config files to get grub the way you like it.
On legacy BIOS machines you need a "BIOS boot partition" which may be as small as 30kb on the drive, this is required to store stage 2 of the GRUB boot process.
To create this BIOS boot partition do the following:
A BIOS Boot partition can be created using any of several different disk utilities:

In GParted, create a partition (an unformatted one works fine), then right-click it and select Manage Flags. Check the bios_grub flag, click Close, and apply your changes.

In GNU Parted (parted), create a partition, then type set 1 bios_grub on, changing 1 to the number of the partition you want to mark as a BIOS Boot partition.

In GPT fdisk (gdisk), create a partition and give it a type code of EF02.

Source: http://en.wikipedia.org/wiki/BIOS_Boot_Partition_%28GPT%29


text:
Q: Como atribui valor do Fetch em uma variável tenho o seguinte código abaixo

 dia_do_mes = {};

  fetch('https://api.myjson.com/bins/dhhvz')
  .then(response => {
    return response.json()
  })
  .then(r => {
    console.log(r)
  })
  .catch(err => {
    // Do something for an error here
  })

Minha única dúvida é, como eu faço para atribui a resposta no JSON na no 'r', tipo pelo console log eu vejo o objeto retornando corretamente, mas quando tento atribui o 'r' a váriavel dia_do_mes = {};, não funciona, alguém pode me ajudar?

A: Não sei se entendi bem sua pergunta, mas o retorno é um objeto, com vários outros objetos dentro, então na variável dia_do_mes não precisa do {}, é só atribuir o valor de r a dia_do_mes, tbm aconselho a colocar dia_do_mes em uma variável ou constante:

let dia_do_mes;

  fetch('https://api.myjson.com/bins/dhhvz')
  .then(response => {
    return response.json()
  })
  .then(r => {
    dia_do_mes = r;
    console.log(dia_do_mes)
  })
  .catch(err => {
    // Do something for an error here
  })

A: Thiago, quando você trabalhar com requisições, normalmente elas tem o comportamento assíncrono, por conta disso você não consegue efetuar essa atribuição direta.
Uma opção seria trabalhar com async/await, também seria possível atribuir o valor somente no then do retorno da variável r, entre outras possibilidades:

// Exemplo com async/await
let dia_do_mes = {};

(async () => {
    dia_do_mes = await fetch('https://api.myjson.com/bins/dhhvz')
        .then(response => {
        return response.json();
        })
        .then(r => {
             return r;
        })
        .catch(err => {
            // Do something for an error here
        });
    console.log("Exemplo com async/await", dia_do_mes);
})();

// Exemplo pegando o valor no bloco then do retorno r
let outro_dia_do_mes = {};

fetch('https://api.myjson.com/bins/dhhvz')
    .then(response => {
        return response.json();
    })
    .then(r => {
         outro_dia_do_mes = r;
         console.log("Exemplo no bloco do then", outro_dia_do_mes);
    })
    .catch(err => {
        // Do something for an error here
    });

A: Como seu código é assíncrono, para garantir que o valor da variável está preenchido deve-se fazê-lo dentro do then. Atualmente há a opção de utilização do async/await também que garante que o código que executa uma função assíncrona aguarde a sua execução antes de continuar. Porém a instrução await (descrita acima) só pode ser utilizada em uma função com a instrução async, que determina que a mesma é "assíncrona" e que retornará uma promessa. Portanto seu código pode ser traduzido para:
const buscar = async() => {
  try {
    const response = await fetch('https://api.myjson.com/bins/dhhvz');
    const r = response.json();
    console.log(r);
  } catch (e) {
    console.error(e);
  }
};

buscar();

Funções assíncronas
A declaração async function define uma função assíncrona, que retorna um objeto AsyncFunction.
Você também pode definir funções assíncronas usando uma expressão async function.
Quando uma função assíncrona é chamada, ela retorna uma Promise. Quando a função assíncrona retorna um valor, a Promise será resolvida com o valor retornado. Quando a função assíncrona lança uma exceção ou algum valor, a Promise será rejeitada com o valor lançado.
Uma função assíncrona pode conter uma expressão await, que pausa a execução da função assíncrona e espera pela resolução da Promise passada, e depois retoma a execução da função assíncrona e retorna o valor resolvido.


text:
Q: Activation function of Regression Neural Net in Azure ML Studio? I am not able to find activation function for Regression Neural Network in Azure Machine Learning Studio. I am not able to identify what is the activation function taken for my NN. Followed this document also-
https://learn.microsoft.com/en-us/azure/machine-learning/studio-module-reference/neural-network-regression
Can someone suggest where to mention it/ what is the default activation function used?

A: Microsoft Azure ML studio has basically two configurations to work:

*

*Use the default architecture provided to create a neural network model (preferable for beginners).
-In this you can only change the number of nodes in the hidden layer, learning rate, and normalization.

*Defining your own custom architecture to create a neural network model (preferable if you know your way around neural networks).
-In this you can customize the architecture completely and modify its connections along with the activation function of your choice.
Take a look at the following link for more detailed description (official documentation):
https://learn.microsoft.com/en-us/azure/machine-learning/studio-module-reference/neural-network-regression
The following example uses softmax activation:
https://gallery.azure.ai/Experiment/7d3f74981b5b42cd9687370671c86696
Default activation function is sigmoid for classification models and linear for regression models.


text:
Q: How to boot from grub2 when installed without? I have installed Ubuntu Desktop 18.10 from the terminal with "ubiquity -b" without the bootloader (bcs there were some problems with grub2) and then independently grub2. Now, grub2 is fully working, it shows the minimal BASH line on PC startup but how to boot the Ubuntu from it without any errors or problems?
Note: I have UEFI bios and cant change it.


text:
Q: Libgdx on AIDE- .ttf problems I'm learning ligbdx and I got some problems in using "TrueType font" (ttf). I didn't know how to use it, I've tried how they use it in the tutorial, but didn't work. Please help a brother out, I'm depressed
I've tried a TrueType font (.ttf) , but didn't work.


text:
Q: How to make JUnit test fall down if constuctor is present? I am learning JUnit and Test Driven Development practice. I have empty Money interface:
public interface Money {

}

CommonMoney class which implements Money interface:
public class CommonMoney implements Money {

    private CommonMoney() {

    }

    public static Money create(String decimalPart, Currency currency) {
        return new Money() {
        };
    }
}

And MoneyTest class which tests CommonMoney
public class MoneyTest {

    // some test cases before

    @Test
    public void shouldNotCreateCommonMoneyObjectWithEmptyConstructor() {
        @SuppressWarnings("unused")
        Money money = new CommonMoney();
        fail();
    }
}

For now test case shouldNotCreateCommonMoneyObjectWithEmptyConstructor is red, but it should be green if constructor of CommonMoney is private and red if it is public. Is it possible to make test case like this? And how can I do it?

A:
Is it possible to make test case like this?

Yes, it is possible to implement this test by using java reflection, for example see this question. Otherwise, you cannot test, that the private constructor is present, from outside of that class - the code just won't compile.
However, it doesn't really make sense to test this. Access modifiers are really there for developer convenience and to limit the access scope. Arguably, scope limitation is also done for convenience.
Your tests should cover public API and not look at private implementation.

A: This is not the sort of thing you need to test.
As Agad pointed out, the code won't compile the way it is anyway, because by making the constructor private you've made it impossible to create the object with an empty constructor.
The compiler is effectively doing the check for you, so you don't need to write a specific test to check for it.


text:
Q: Sending data from Arduino to textfile to compare, and then return a value/boolean I'm new to this so apologies of I've misunderstood anything.
I currently have an arduino uno and an RFID reader. What I want to do is use the RFID reader to take in the RFID number from the RFID tag, send it over the serial port to a text file, compare to see if the RFID number is in the text file and then return and turn on an LED light if it is, so if it is then a boolean true/false might do it?
I've read up on some tutorials and turning on the LED lights based on a particular value seems fine but getting the value through the process outlined is whats troubling me.
Any help would be greatly appreciated!!

A: You need some sort of client application which can read the text file and communicate with the Arduino. You cannot "send" anything to a text file (just like you cannot "send" anything to an image or audio file, etc.). Many people use Processing to create simple clients and there are many tutorials about how to do this. Obviously this means you need a computer on which to run the Processing client which is tethered to the Arduino by USB or else communicating with the Arduino through some wireless mode.
If you want a standalone solution, you could look into storing the text file data on the Arduino itself - in Flash memory, if the data is small, or on an SD card if the data is large.
Walk before running.


text:
Q: How should I access a JMX MBeanServer running in the same VM? For a simple Java library which performs operations in constant intervals I have implemented JMX management using MXBeans and it works as expected, I can query the status and set parameters, supend / resume the operations etc in JConsole.
Now I would like to create a web application - to display and control the library operation.
I don't know wether it is a good idea to use the samy JMX API also in the web application, so I need a way to access the MXBeans which are registered in the same VM using the platform MBean Server:
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
I noticed that the MBeanServer has a queryMBeans method. Should I use this method to access the registered JMX API MXBeans? There is a different path, using JMXConnectorFactory, which requires protocol, host, and port information so that the client can access a remote JMX server.

A: If you only want to access the MBeanServer in the same JVM, then ManagementFactory.getPlatformMBeanServer(); is the way to do it.
JMXConnectorFactory is for accessing remote MBeanServers (i.e. in a different JVM, and/or on a different host).


text:
Q: How to deal with asynchronicity in display templates I'm trying to write a custom filter display template. My template requires some external calls, and thus requires some async work.
How can I output my filters after the initial render?
I've duplicated the outputFilter method from the default template. Then I call it in a PostRender callback.
This does not works, probably because the context in no more present.
Any advice ?
To give a bit of background, I'm trying to create a custom refiner, that receive filters from the query results. These results are flat, but I want to rebuild a tree of filters (each values can have parent/child relationship).
Here's a simple repro template:
    // Fill the arrays with refinement values
for (var i = 0; i < listData.length; i++){
  var filter = listData[i];
  if(!$isNull(filter)){
    filter.RefinementTokens = [filter.RefinementToken];
    filter.RefinementTokenWrappedValues = [Srch.RefinementUtil.stringValueToEqualsToken(filter.RefinementValue)];

    EnsureScriptFunc("sp.js", false, function(){

            var context = SP.ClientContext.get_current();

            // load some data

            context.executeQueryAsync(Function.createDelegate(this, function(){}
                outputFilter(filterData.Name, filter.RefinementCount, refiners, addMethod, "ms-displayBlock", true);

            ),Function.createDelegate(this, function(){}

            ));

            });
        });
    });

  }
}

A: Instead of displaying the values from the filter by default, you have to do it from within your PostRender function.
Best is to create an empty container with a unique class like this:
<!--#_
    var containerClass = ctx.ClientControl.get_nextUniqueId() + "_container";
_#-->
<div id='Container' class="_#= containerClass =#_">
</div>

In your PostRender function, you have to write your async calls like this in order to be able to know the variable when the call is completed:
AddPostRenderCallback(ctx, function() {
    (function(containerClass) {
        // Do your async calls

        // Insert the HTML on the page
        var elm = document.getElementsByClassName(containerClass);
        if (elm.length > 0) {
            elm[0].innerHTML = "YOUR-HTML-OUTPUT";
        }
    })(containerClass);
});

Be aware, you will not be able to make use of the outputFilter function. You will have to write your own HTML markup and append it to the DOM yourself.
An example of this approach can be found in one of these templates on GitHub: Retrieve the list name in a display template


text:
Q: Mobile OS, languages for their APPs and HTML 5 There are the 3 popular mobile OS:

*

*Android

*iOS

*Windows Phone

*

*Which programming language (s) is used for their apps, for each of the 3?

*Is HTML 5 a replacement for any of the languages? if not, what's the hype with HTML 5 and mobile apps?

*Java is cross platform (I believe because of JVM), can java be used to write apps for all the 3?

A: For Android the programming langauge used is Java. Eclipse/Android Studio  is the IDE used widely for it.
For IOS the programming language used is Objective C and Swift. Xcode is the IDE used for coding.
For Windows Phone the language used is C# and Visual Studio is the IDE.
Now to create an App in this 3 platform you would have to code separately for each. This is where creating Hybrid Apps can save time and money.
Using Phonegap ( http://phonegap.com/) you can code using HTML5 , CSS and Javascript and then you can deploy it to each of this platforms. Having said this the performance of hybrid apps is less compared to Native Apps but still for a good number of applications you can go for Hybrid Apps instead of native apps.


text:
Q: How to Inject directive in component with default value? (to avoid NullInjectorError) I want to have reusable component which works regardless of if its ancestor have customRootDirective or not.
My component:
@Component({
  selector: 'component5',
  templateUrl: './component5.html',
  styleUrls: [ './component5.scss' ],
})
export class Component5 {
  constructor(
    public customRootDirective: CustomRootDirective,
  ) {}

  someMethod(){
    console.log(this.customRootDirective.elementRef.nativeElement.innerText);
  }

}

Directive usage in some template (here it works):
<component1>
  <component2 customRootDirective>
    <component3>
      <component4>
        <component5>
            here I'd like to use reference to component2 and some customRootDirective methods
            but it is possible that ancestors don't have customRootDirective
        </component5>
      </component4>
    </component3>
  </component2>
</component1>

Here it gives error:
NullInjectorError: No provider for CustomRootDirective!
<component1>
  <component2>
    <component3>
      <component4>
        <component5>
            here I don't need reference to ancestors elements
        </component5>
      </component4>
    </component3>
  </component2>
</component1>

I have tried with no success:
export class Component5 {
  constructor(
    public customRootDirective: CustomRootDirective = null,
  ) {}

Please, help, I'm stuck. Thanks in advance!

A: This is where the @Optional decorator should be used:
export class Component5 {
  constructor(
    @Optional()
    readonly customRootDirective: CustomRootDirective
  ) {}
}

If the directive cannot be found, the parameter will have null as value


text:
Q: Two column (one fixed, one scrolls) using React/React Flexbox Grid I am after the following functionality:

*

*Navigation column (left) stays locked and occupies 100vh, or 100% of the browser's current height,

*Content column (right) scrolls, showing content.

Right now, the following code works well, when the browser is sized-down the Navigation column stacks on top of the Content column.
However, I'd like to keep this functionality while forcing the Navigation column to be fixed.
So far I've tried using position: fixed; under .nav-column in App.css, this resulted in the Navigation overlapping the Content.
I'm using React 16.7.0 and 'react-flexbox-grid'. Checked this out as well, this solution just involved using basic HTML/CSS and has nothing to do with React nor React Flexbox Grid.
Any help? Here's the code:
(Sorry, I can't get the snippet to run. Guessing it's the react-flexbox-grid stuff.)

import React, { Component } from 'react';
import { Grid, Row, Col } from 'react-flexbox-grid';
import './App.css';

class App extends Component {
  render() {
    return (
      <Grid fluid className='app-main'>

        <Row>
          <Col className='nav-column' xs={12} sm={3}>

Nav

          </Col>

          <Col className='content-column' xs >

Content

            "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

          </Col>
        </Row>

      </Grid>
    );
  }
}

export default App;
.app-main {
  font-family: Helvetica;
}

.nav-column {
  font-family: Helvetica;
  font-size: 18px;
  background-color: aqua;
}

.content-column {
  font-size: 18px;
  background-color: darkkhaki;
}

A: I took some liberty with your design thinking this is what you are after from your description. The biggest changes are removing the <Row> since that complicates scrolling only one column and solved the rest with CSS.
import React from "react";
import ReactDOM from "react-dom";
import { Grid, Row, Col } from "react-flexbox-grid";
import "./styles.css";

function App() {
  return (
    <Grid fluid className="app-main">
      <Col className="nav-column" xs={12} sm={3}>

Nav

      </Col>

      <Col className="content-column" xs>

Content

            "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
            eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
            ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
            aliquip ex ea commodo consequat. Duis aute irure dolor in
            reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
            pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
            culpa qui officia deserunt mollit anim id est laborum."

      </Col>
    </Grid>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

CSS
.app-main {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.nav-column {
  font-family: Helvetica;
  font-size: 18px;
  background-color: aqua;
  overflow: hidden;
}

.content-column {
  font-size: 18px;
  background-color: darkkhaki;
  overflow: scroll;
}

The app is written as a function to make using the live editor easier. So here it is in the live editor.
https://codesandbox.io/s/n4n779pj4m


text:
Q: Fourier decay rate of Cantor measures For $0<\theta<\frac{1}{2}$, denote by $C_\theta$ the Cantor set with dissection ratio $\theta$, i.e. the Cantor set obtained from dissection parttern $(\theta, 1-2\theta,\theta)$. It is known that $C_\theta$ carries a uniform measure $\mu_\theta$ which is usually called Cantor measure. And it is not hard to show that the Fourier–Stieltjes transform of $\mu_\theta$ is (up to scaling and constant multiple)
$$\hat{\mu}_\theta(\xi)=\prod^{\infty}_{k=1} \cos(\theta^k\xi)$$
But unlike integrable function we do not have Riemann-Lebesgue lemma for these Cantor measures. In fact a theorem of Erdős and Salem says $\hat{\mu}_\theta (\xi)=o(1)$ as $|\xi|\rightarrow\infty$ if and only if $\theta^{-1}$ is a not PV number. On the other hand, it is known that for some $\theta^{-1}$ not a PV number, $\hat{\mu}_\theta (\xi)$ does not decay at any positive rate, even though $\hat{\mu}_\theta (\xi)=o(1)$.
My question is whether there exists $\theta$ such that $\hat{\mu}_\theta (\xi)=O(|\xi|^{-\alpha})$ for some $\alpha>0$? How much is known about the precise decay rate of $\hat{\mu}_\theta (\xi)$?
Thanks in advance.
Edit: To make the second question precise, I was actually wondering if there exists Salem set (as pointed out by Pablo) among these Cantor sets. So the rate of decay I was expecting is (or arbitrarily close to) half of the Hausdorff dimension $\frac{1}{2}\dim_H(C_\theta)=\frac{1}{2}\frac{\log(1/2)}{\log(\theta)}$.

A: The first part of the question is easy: the power decay is typical. Let's look, say, at $\theta\in[1/3,1/2)$. Take any $\xi>0$ and consider the sequence $\nu_k=\pi^{-1}\xi\theta^k$ up to the moment it goes below $1$. Let $m$ be the number of terms in this sequence. Let $n_k$ be the nearest integer to $\nu_k$. The power decay will be ensured if we show that a noticeable portion of the differences $|\nu_k-n_k|$ are not too small for all sufficiently large $m$.
Fix $\alpha,\delta>0$ and assume that we have at most $\alpha m$ differences $|\nu_k-n_k|$ exceeding $\delta$. Let's trace the sequence $n_k$ backwards. Assume that $n_k$, $n_{k+1}$, and $n_{k+2}$ approximate the corresponding $\nu's$ with error less than $\delta$. Then we have $n_k\approx n_{k+1}^2n_{k+2}^{-1}$ with the relative error about $\delta(2n_{k+1}^{-1}+n_{k+2}^{-1})<\frac 13 n_k^{-1}$ if $\delta$ is chosen small enough. But then $n_k$ is completely determined by $n_{k+1}$ and $n_{k+2}$.
The same argument shows that even if we only know that the approximation error is at most $\frac 12$, we can have just some fixed number $A$ of choices for $n_k$.
Now, let's count the "bad" sequences of $m$ terms. We have ${m\choose \alpha m}$ ways to select the "bad approximation positions". Then we have some constant number of starting pairs $n_{m-1}, n_m$. When going backwards, we have only $3\alpha m$ places where we have any freedom. Thus, we have just $C{m\choose \alpha m}A^{3\alpha m}\le Ce^{q(\alpha)m}$ bad sequences where $q(\alpha)\to 0$ as $\alpha\to 0$. On the other hand, $n_0$ and $n_1$ determine $\theta$ with an error of order $n_1^{-1}\le 2^{-m}$. Thus, the measure of $\theta$ that are bad for some particular $m$ is exponentially small in $m$ if $\alpha$ is small enough. The rest should be clear.
The second part of the question is harder to answer. I have no doubt that people have figured out most of what would be worth figuring out here but I doubt very much they bothered to publish any of it or, if they did, the papers made it past the referees. If you need something particular, state a precise question and we'll see if we can figure it out.
Edit in response to the edit of the question.

So the rate of decay I was expecting is (or arbitrarily close to) half of the Hausdorff dimension $\frac12 dim_H(C_\theta)=\frac 12\frac{\log(1/2)}{\log(\theta)}$.

Now, that is far too optimistic. Take large $\lambda=\theta^{-1}$. Take any integer. Multiply by $\lambda$. Correct the product to the nearest integer. Multiply by $\lambda$. Correct the product to the nearest integer, and so on. After $m$ steps, you'll get $\xi\approx\lambda^m$ while the cumulative effect of all corrections in each position is at most $\theta+\theta^2+\theta^3+\dots\approx\theta$, so all the cosines are about $1-\theta^2$ and you get $\alpha$ not much better than $\frac{\theta^2}{\log(1/\theta)}$

A: Edit in response to the editing of the second question:
The central Cantor sets are never Salem (for any $\theta$). Here is a way to see this. If $A\subset \mathbb{R}$ is a Salem set, then
$$
\dim(A+B) \ge \min(\dim(A)+\dim(B),1)
$$
for any Borel set $B\subset\mathbb{R}$, where $\dim$ is Hausdorff dimension and $A+B=\{a+b:a\in A, b\in B\}$ is the arithmetic sum. This follows from the expression of the $t$-energy $\int\int |x-y|^{-t}d\mu(x)\mu(y)$ in terms of the Fourier transform, and Frostman's Lemma (let me know if you want more details).
On the other hand, it is easy to see the above fails for the central Cantor sets $C_\theta$. If $\theta<1/3$, then $C_\theta+C_\theta$ is easily seen to be self-similar set with three pieces of relative size $\theta$, so
$$
\dim(C_\theta+C_\theta) = \frac{\log 3}{|\log\theta|} < \frac{2\log 2}{|\log\theta|} = 2\dim(C_\theta).
$$
If $\theta\ge 1/3$, you instead consider the sum $C_\theta+C_{\theta^k}$ where $k$ is small enough that $\dim(C_\theta)+\dim(C_{\theta^k})<1$. Again it is not hard to see that
$$
\dim(C_\theta+C_{\theta^k}) < \dim(C_\theta)+\dim(C_{\theta^k}),
$$
from the fact that there is an "exact overlap" in $C_\theta+C_{\theta^k}$.
This argument can be turned into an effective upper bound for the decay of the Fourier transform of an arbitrary measure supported on $C_\theta$ (using the specific structure of $\mu_\theta$ one can get better bounds). But one cannot expect sharp bounds from this approach.

Original answer:
Interesting question. Some remarks that were too long to fit into a comment:

*

*If $\theta^{-1}$ is a Salem number, then there is no polynomial rate of decay for $\widehat{\mu}_\theta$. I don't have a reference at hand but believe this is not too hard.

*For a given Borel probability measure $\mu$, the supremum of all $\beta$ such that $|\widehat{\mu}(\xi)|=O(|\xi|^{-\beta/2})$ is called the Fourier dimension of $\mu$. This is always bounded above by the Hausdorff dimension of the measure (the infimum of the Hausdorff dimensions of sets of full measure). This gives an upper bound for the possible $\alpha$ in your question, since the Hausdorff dimension of $\mu_\theta$ is well known to be $\log 2/|\log \theta|$.

*A measure is a Salem measure if its Fourier dimension is equal to its Hausdorff dimension, or in other words if its Fourier transform decays as fast as its dimension allows. Many random measures are known to be Salem measures, but there are very few deterministic examples. For example, if you randomize the construction of $\mu_\theta$ by translating each interval by some small random number (with all the choices independent), you end up with a Salem measure, see the paper "Fourier asymptotics of statistically self-similar measures" by C. Bluhm. Of course  the random translations would kill the resonances that occur along sequences of frequencies of the form $c \theta^{-n}$ so this doesn't give any hint on the original question.

*Using the specific structure of $\mu_\theta$ it is possible to give better upper bounds for $\alpha$. For example, if $\theta<1/3$ then $\mu_\theta * \mu_\theta$ is easily seen to be supported on a Cantor set of dimension $<1$, in particular it is singular. This implies that $\alpha\le 1/4$, for otherwise the self-convolution would be in $L^2$. For $\theta\in (1/4,1/3)$ this is better than the general bound coming from Fourier dimension. It is possible to improve this bound in various ways (for example, using more precise information about the self-convolution), in particular $\mu_\theta$ is not a Salem measure for any $\theta$.

A: I would start looking here:
MR1785620 (2001m:42020)
Peres, Yuval; Schlag, Wilhelm; Solomyak, Boris,
Sixty years of Bernoulli convolutions.
Fractal geometry and stochastics, II (Greifswald/Koserow, 1998), 39–65,
Progr. Probab., 46, Birkhäuser, Basel, 2000.

A: There seems to be a negative answer to this in this paper:
MR1900879 (2003d:42011) Hu, Tian-You; Lau, Ka-Sing Fourier asymptotics of Cantor type measures at infinity. Proc. Amer. Math. Soc. 130 (2002), no. 9, 2711–2717.


text:
Q: request.POST not being picked up in django I am using apiary to send API calls via POST. The method being sent is POST and it's sending the corret POST DATA, but django is not picking it up in the request.POST dict:
# this is printing request.method, request.body
[remote IP:43306] POST b'{\\n    "email": "tomas@gmail.com",\\n    "password": "hellopassword"\\n}'

# this is printing request.POST
[pid 4974:tid 140607472903936] [remote 54.81.191.72:43306] 333 POST <QueryDict: {}>

Why can't django properly parse the POST data here?

A: Check request.data instead.
request.POST is normally only present when posting a form. Technically, it's only present when the content type header is form encoded e.g. 'multipart/form-data'


text:
Q: How to process two long lines with constant memory? Input file consists of two lines, each of which holds many numbers
1 2 3 4...
5 6 7 8...

I want to process each line's data, like this:
doSomething :: [Int] -> [Int] -> Int
doSomething [] y = 0 -- stop execution. I'm concerted in memory behavior only.
doSomething (x:xs) y = doSomething xs y
main = do
    inputdata <- getContents
    let (x:xs) = lines inputdata
        firstLine = map (read ::String->Int) $ words $ x
        secondLine = map (read ::String->Int) $ words $ head xs
    print $ doSomething firstLine secondLine

When I run this program, heap profiling shows like this:

If I don't use secondLine (xs) then this program runs with constant memory.
Each entry of list firstLine is processed then discarded by GC.

*

*Why the consumed memory is so large?
I see the amount of allocated memory is ~100MB, but actual input data size is 5MB.

*Does head xs force reading entire first line into memory,
even secondLine is not used at all? And is this the main cause
of memory increase of heap profiling graph?

*How can I process two lines with constant memory, like latter execution graph?

*If the answer to 3) depends on processing order, how can I process second line first, and then first line?

A:
Q1) Why the consumed memory is so large? I see the amount of allocated memory is ~100MB, but actual input data size is 5MB.

String in Haskell is a type alias for [Char], so along the actual bytes, the compiler also has to keep a constructor, a pointer to the boxed character and a pointer to the next constructor for every character in the memory, results >10 times of memory usage than a C-style string. Even worse the text is stored multiple times in memory.

Q3) How can I process two lines with constant memory, like latter execution graph?
  Q4) If the answer to Q3) depends on processing order, how can I process second line first, and then first line?

No you can't process the second line first since the lines function have to evaluate every byte in the first line to hit the '\n' newline character.

Q2) Does head xs force reading entire first line into memory, even secondLine is not used at all? And is this the main cause of memory increase of heap profiling graph?

It's not the head that prevents the first line from being GCed. The space leak still occurs if you adjust the type signature of doSomething and pass xs directly to it. The point is the (not optimizing) compiler won't know that secondLine isn't used before doSomething finally hits the first pattern, so the program keeps a reference to xs . BTW if compiled with -O2 your program runs with constant memory.
What caused the space leak of your program is mainly this line:
let (x:xs) = lines inputdata

When either x or xs is discarded, this let clause will be in-lined in the dumped Core. Only when both of them are referenced later the Core behaves strangely: it constructs a tuple, destruct it by pattern matching, then construct the two part into a tuple again, therefore by keeping a reference to secondLine the program in fact keeps a reference to a tuple (x,  xs) so the first line will never be GCed.
Core with secondLine commented out:
Rec {
doSomething_rjH
doSomething_rjH =
  \ ds_d1lv y_alG ->
    case ds_d1lv of _ {
      [] -> I# 0;
      : x_alH xs_alI -> doSomething_rjH xs_alI y_alG
    }
end Rec }

main
main =
  >>=
    $fMonadIO
    getContents
    (\ inputdata_app ->
       print
         $fShowInt
         (doSomething_rjH
            (map
               (read $fReadInt)
               (words
                  (case lines inputdata_app of _ {
                     [] -> case irrefutPatError "a.hs:6:9-32|(x : xs)"# of wild1_00 { };
                     : x_auf xs_aug -> x_auf
                   })))
            ([])))

main
main = runMainIO main

Core with space leak:
Rec {
doSomething_rjH
doSomething_rjH =
  \ ds_d1ol y_alG ->
    case ds_d1ol of _ {
      [] -> I# 0;
      : x_alH xs_alI -> doSomething_rjH xs_alI y_alG
    }
end Rec }

main
main =
  >>=
    $fMonadIO
    getContents
    (\ inputdata_app ->
       -- *** Construct ***
       let {
         ds_d1op
         ds_d1op =
           case lines inputdata_app of _ {
             [] -> irrefutPatError "a.hs:6:9-30|x : xs"#;
             : x_awM xs_awN -> (x_awM, xs_awN)
           } } in
       -- *** Destruct ***
       let {
         xs_awN
         xs_awN = case ds_d1op of _ { (x_awM, xs1_XwZ) -> xs1_XwZ } } in
       let {
         x_awM
         x_awM = case ds_d1op of _ { (x1_XwZ, xs1_XwU) -> x1_XwZ } } in
       -- *** Construct ***
       let {
         ds1_d1oq
         ds1_d1oq = (x_awM, xs_awN) } in
       print
         $fShowInt
         -- *** Destruct ***
         (doSomething_rjH
            (map
               (read $fReadInt)
               (words (case ds1_d1oq of _ { (x1_Xx1, xs1_Xx3) -> x1_Xx1 })))
            (map
               (read $fReadInt)
               (words
                  (head (case ds1_d1oq of _ { (x1_Xx1, xs1_Xx3) -> xs1_Xx3 }))))))

main
main = runMainIO main

Replace the let clause by a case .. of clause will fix the space leak:
doSomething :: [Int] -> [Int] -> Int
doSomething [] _ = 0 -- stop execution. I'm concerted in memory behavior only.
doSomething (_:xs) y = doSomething xs y

main :: IO ()
main = do
  inputdata <- getContents
  case lines inputdata of
    x:xs -> do
      let
        firstLine = map (read ::String->Int) $ words x
        secondLine = map (read ::String->Int) $ words $ head xs
      print $ doSomething firstLine secondLine

The dumped Core. The "construct then destruct" pattern didn't happen this time:
Rec {
doSomething_rjG
doSomething_rjG =
  \ ds_d1o6 ds1_d1o7 ->
    case ds_d1o6 of _ {
      [] -> I# 0;
      : ds2_d1o8 xs_alG -> doSomething_rjG xs_alG ds1_d1o7
    }
end Rec }

main
main =
  >>=
    $fMonadIO
    getContents
    (\ inputdata_apn ->
       case lines inputdata_apn of _ {
         [] -> patError "a.hs:(8,3)-(13,46)|case"#;
         : x_asI xs_asJ ->
           print
             $fShowInt
             (doSomething_rjG
                (map (read $fReadInt) (words x_asI))
                (map (read $fReadInt) (words (head xs_asJ))))
       })

main
main = runMainIO main


text:
Q: Problems import csv indexed by dates I am trying to import a csv file with OHLC data to use with quantmod. I keep getting errors with the date column.
here is the error:
Error in read.zoo(file2, sep = ",", format = "%Y-%m-%d h:m:s.S", header = TRUE,  : index has 4706262 bad entries at data rows: 1 2 3...

what I am using to import the data:
zz <- read.zoo(file2, sep = ",",format="%Y-%m-%d h:m:s.S",
header=TRUE,index.column=1,colClasses=c("character",rep("numeric",5)))
head(zz)

xx<- as.xts(zz)

I tried looking at docs but it didn't help me.
Here is an example from my csv file
time,open,high,low,close,volume,
2005-01-02 10:29:00.0,1.356,1.356,1.356,1.356,1,
2005-01-02 10:38:00.0,1.356,1.356,1.356,1.356,1,
2005-01-02 10:51:00.0,1.3567,1.3567,1.3567,1.3567,1,
2005-01-02 10:52:00.0,1.3565,1.3565,1.3565,1.3565,1,
2005-01-02 10:55:00.0,1.3568,1.3568,1.3568,1.3568,1,
2005-01-02 10:57:00.0,1.3567,1.3567,1.3567,1.3567,1,
2005-01-02 11:04:00.0,1.3569,1.3569,1.3569,1.3569,1,
2005-01-02 11:07:00.0,1.357,1.357,1.3569,1.3569,2,

A: The format (see ?strptime) and colClasses (see ?read.table) arguments in the question are wrong and some of the arguments specified there are unnecessary.
1) The following shorter code should do. In the time it ignores the part after the dot but that is zero anyways so it does not matter.  If there are non-zero digits after the dot in some rows in the real data then see the help file mentioned above for the correct percent codes to use in format.
library(zoo)
read.zoo(text = Lines, header = TRUE, sep = ",", colClasses = c(X = "NULL"))

giving:
                      open   high    low  close volume
2005-01-02 10:29:00 1.3560 1.3560 1.3560 1.3560      1
2005-01-02 10:38:00 1.3560 1.3560 1.3560 1.3560      1
2005-01-02 10:51:00 1.3567 1.3567 1.3567 1.3567      1
2005-01-02 10:52:00 1.3565 1.3565 1.3565 1.3565      1
2005-01-02 10:55:00 1.3568 1.3568 1.3568 1.3568      1
2005-01-02 10:57:00 1.3567 1.3567 1.3567 1.3567      1
2005-01-02 11:04:00 1.3569 1.3569 1.3569 1.3569      1
2005-01-02 11:07:00 1.3570 1.3570 1.3569 1.3569      2

(We have used text = Lines to keep this self contained -- Lines is given in the Note below -- you would replace that with your filename as in the question.)
1a) Even shorter would be the following.
read.csv.zoo(text = Lines, colClasses = c(X = "NULL"))

2) Alternately, this two-step approach is particularly simple:
DF <- read.csv(text = Lines)[-7]
read.zoo(DF)

3)
library(zoo)

read.zoo(text = Lines, read = function(...) read.csv(...)[-7])

Note: The input is:
Lines <- "
time,open,high,low,close,volume,
2005-01-02 10:29:00.0,1.356,1.356,1.356,1.356,1,
2005-01-02 10:38:00.0,1.356,1.356,1.356,1.356,1,
2005-01-02 10:51:00.0,1.3567,1.3567,1.3567,1.3567,1,
2005-01-02 10:52:00.0,1.3565,1.3565,1.3565,1.3565,1,
2005-01-02 10:55:00.0,1.3568,1.3568,1.3568,1.3568,1,
2005-01-02 10:57:00.0,1.3567,1.3567,1.3567,1.3567,1,
2005-01-02 11:04:00.0,1.3569,1.3569,1.3569,1.3569,1,
2005-01-02 11:07:00.0,1.357,1.357,1.3569,1.3569,2,"

Update: At the time this was originally posted some of the commands here required the development version of zoo but that is now out so they all work with regular zoo on CRAN.

A: Assuming your data is in a file named 'testFile.csv' and in your working directory, you can do the following to get the asked for xts-object:
testFile <- read.csv("testFile.csv", header=TRUE, colClasses=c("character",rep("numeric",5),NULL))

>as.xts(testFile[,2:6],order.by = as.POSIXct(testFile[,1]))

                      open   high    low  close volume
2005-01-02 10:29:00 1.3560 1.3560 1.3560 1.3560      1
2005-01-02 10:38:00 1.3560 1.3560 1.3560 1.3560      1
2005-01-02 10:51:00 1.3567 1.3567 1.3567 1.3567      1
2005-01-02 10:52:00 1.3565 1.3565 1.3565 1.3565      1
2005-01-02 10:55:00 1.3568 1.3568 1.3568 1.3568      1
2005-01-02 10:57:00 1.3567 1.3567 1.3567 1.3567      1
2005-01-02 11:04:00 1.3569 1.3569 1.3569 1.3569      1
2005-01-02 11:07:00 1.3570 1.3570 1.3569 1.3569      2


text:
Q: Open JavaScipt URL in new window Wondering if anyone can help. I've created some code that depending on what option the user picks, they get taken to a specific URL. I have it all working fine, however, the URL won't open in a new window.
Any help would be brilliant.
This is the code:

 $(document).ready(function() {
    var selectVal1 = $("#selectBox1").val();
    var selectVal2 = $("#selectBox2").val();
    $("#selectBox1").change(function() {
            selectVal1 = $("#selectBox1 option:selected").val();
    });
    $("#selectBox2").change(function() {
            selectVal2 = $("#selectBox2 option:selected").val();
    });

    $("#click").click(function() {

    if(selectVal1 == 'A' && selectVal2 == 'A'){
        location = "https://www.google.com/animalmanagement-25thaug", '_blank';}
    else if(selectVal1 == 'A' && selectVal2 == 'B'){
        location = "https://www.google.com/animalmanagement-26thaug", '_blank';}
    if(selectVal1 == 'B' && selectVal2 == 'A'){
        location = "https://www.google.com/artdesign-25thaug", '_blank';}
    else if(selectVal1 == 'B' && selectVal2 == 'B'){
        location = "https://www.google.com/artdesign-26thaug", '_blank';}
});
});

Book Your Enrolment Slot

<select id="selectBox1">
  <option value="">Select which subject you would like to study?</option>
  <option value="A">Animal Management</option>
  <option value="B">Art & Design</option>
</select>
<select id="selectBox2">
  <option value="">Select what date you would like to come in and enrol</option>
  <option value="A">Tuesday 25th August 2020</option>
  <option value="B">Wednesday 26th August 2020</option>
</select>
<input id="click" type="button" value="Book Now" class="button">

A: window.open might help
window.open(<url>);

Or
window.open(<url>, "_blank"); // opens in new tab

A: You can use window.open(your url) ..
Or you can refer this doc.
https://developer.mozilla.org/en-US/docs/Web/API/Window/open

A: You can use code below
$("#click").click(function() {

   if(selectVal1 == 'A' && selectVal2 == 'A'){
       var  location = "https://www.google.com/animalmanagement-25thaug";
   } else if (selectVal1 == 'A' && selectVal2 == 'B'){
       var location = "https://www.google.com/animalmanagement-26thaug";
   } else if (selectVal1 == 'B' && selectVal2 == 'A'){
       var location = "https://www.google.com/artdesign-25thaug";
   } else if (selectVal1 == 'B' && selectVal2 == 'B'){
       var location = "https://www.google.com/artdesign-26thaug";
   }
   var wind = window.open(location, '_blank');
   //wind.focus(); // If required

});


text:
Q: Can not open boost header from my static lib C++ VS I have created test C++ static library in VS and I am using boost in that.
Now this static lib is used/linked in DLL I have created. Now I want to link this DLL in a c++ console application.
Static lib and DLL both compiles fine. When I am using this dll in console application, I am getting error in static lib's header file that can not open include file #include "boost/config.hpp"
I copied static lib's header and dll's headers in console application and linked through properties/linker/additional library directores
I really dont want any user who are using my dll to link with boost and all. I just want to supply dll and they should be good to use it.
Please guide me. I am dealing with DLL and static lib. for the first time.
So If I include all boost headers in my application, it should be good to use. Is there any other solution?

A: The header files from your static library are including boost.  When you include these in your application, the compiler is looking for the boost includes as well.  If the boost declarations are not a part of your library interface, then these includes need to be moved out of header files referenced by your application.

A:
I really dont want any user who are using my dll to link with boost and all. I just want to supply dll and they should be good to use it.

That's pretty much tough, not least because most of Boost is header-only.


text:
Q: Replacing placeholder text in LaTeX \input file I am using the Dia graphics editor and exporting my diagrams to TikZ code. I am trying to address Dia's inability to easily typeset formulas e.t.c. by using LaTeX for this part. Unfortunately that editor does not (and will not) allow raw text to be exported directly - any LaTeX code inserted in e.g. a text label is escaped in the output, which makes it (mostly) useless:
\ifx\du\undefined
  \newlength{\du}
\fi
\setlength{\du}{15\unitlength}
\begin{tikzpicture}
\pgftransformxscale{1.000000}
\pgftransformyscale{-1.000000}
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
\pgfsetfillcolor{dialinecolor}
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (4.000000\du,6.000000\du){PlaceHolder0};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (4.000000\du,8.000000\du){PlaceHolder1};
% setfont left to latex
\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
\pgfsetstrokecolor{dialinecolor}
\node at (4.000000\du,10.000000\du){!@\#\$\%\^{}\&*()|\{\}\ensuremath{[}\ensuremath{]}<>};
\end{tikzpicture}

The code above corresponds to a diagram with three text labels. The line before the last one is a label with a bunch of symbols: !@#$%^&*()|{}[]<> becomes !@\#\$\%\^{}\&*()|\{\}\ensuremath{[}\ensuremath{]}<>. Not every symbol is escaped, but quite a few of them are.
I was hoping to get around this limitation, using the catchfile package to "import" the TikZ code and then StrSubstitute from the xstring package to replace specific placeholder text with raw TeX code. My current code looks like this:
\newcommand{\inputfigure}[1]{{
    \CatchFileDef{\tmp}{#1}{}%
    \noexpandarg%
    \expandafter\StrSubstitute\expandafter{\tmp}{PlaceHolder0}{Text0}[\tmp]%
    \expandafter\StrSubstitute\expandafter{\tmp}{PlaceHolder1}{Text1}[\tmp]%
    \tmp%
}}

Unfortunately it does not seem to work - LaTeX runs for an inordinate amount of time at 100% CPU and then the output still has the original text.
How can I make this work? Alternatively, is there another way to do this that does not involve external programs?

A: A bit long for a comment. You could write in the label a command as |mytext and in the tex document locally change the catcode of | so that it can be use instead of the backslash:
\documentclass{scrreprt}
\def\mytext{abc}
\begin{document}
\begingroup
\catcode`\|=0
|mytext
\endgroup
\end{document}

(This naturally will only work if | is not used somewhere else in your tikz code.)


text:
Q: How can I undo a sha change from git rebase interactive? I did an interactive rebase with more commits than I needed to change. I was surprised that the shas of the unnessisary changes were updated. Unfortunately I only realised this happened after I force pushed my updates.
What I did
Starting point
X - Y \
A - B - C  *master (C is a merge commit)
         \
          - D - E *feature-branch

*

*ran git rebase -i head~3

*squashed D and E (we'll call this
D1)

*changed the commit message of the new D1 commit

*Left A, B, and C as pick and didn't make any changes

My expectation was that everything would look like this:
X - Y \
A - B - C  *master
         \
          - D1 *feature-branch

*

*force pushed my branch

When I went to my PR, things actually looked like this:
X - Y \
A - B - C  *master
         \
          - A1 - B1 - C1 - D1 *feature-branch

Where A1, B1, and C1 had the same commit messages and changes as A, B, and C, but with different shas.
Questions

*

*How can I remove A1, B1, and C1 from my PR without impacting master's A, B, and C?

*What's going on with rebase -i? Why did including A, B, and C in my rebase command make any changes since I just left them as pick?

A: The easiest way if you just want to delete A1/B1/C1 is to do a git rebase -i C. Mark A1 as 'reword', and B1 through D1 as 'fixup'. Edit the commit message for A1 to be what you want as the final message.
Now, as to what went wrong: C is a merge commit.
That means your history graph probably actually looked like this:
   A - B - C  *master
          / \
...-X-Y-Z    - D - E *feature-branch

When you said HEAD~5, that took the first parent of HEAD five times. Let's say the first parent of C is Z instead of B. That means you're rebasing onto commit X, and one of the commits you're planting there is A. The new A gets a new commit hash because its ancestry (and possibly its content) changed.
You might not have noticed Y and Z showing up in the rebase-interactive editor window and just left them as pick.
Basically, the rebase takes your nonlinear history and squishes it into being a line. I can't say I recommend using a rebase across a merge commit.

A: If you run git revert for A1 - B1 - C1 , your new branch will effectively be the one that you desire. And this operation is safer


text:
Q: Replacing the value without splitting the structure This is some part of my structure, what i want to do is 'd' value is empty so i want to replace 'd' value with value'xky'.Please help me how to replace that value without splitting and constructing the structure.
Array
(
    [0] => stdClass Object
        (
            [a] => 1
            [b] => 1B
            [c] => DEL
            [d] =>
            [e] => 2015-01-08T0555
            [f] => BOM
            [g] => t
            [h] => XYZ
            [i] => 2015-01-08T0815
            [j] => 1C
            [k] => 851
        )

)

Note : Why I am telling is if i split this it will cause lot of complications for me since this only a part of the structure. Please help this out.

*

*After updating it should look like below.

Array
    (
        [0] => stdClass Object
            (
                [a] => 1
                [b] => 1B
                [c] => DEL
                [d] => xky
                [e] => 2015-01-08T0555
                [f] => BOM
                [g] => t
                [h] => XYZ
                [i] => 2015-01-08T0815
                [j] => 1C
                [k] => 851
            )

    )

A: Something like that?

$array[0]->d = 'xky'


text:
Q: Symfony 4.2 Creating Repository as service in vendor/acme/demo-bundle I am working on a third party bundle which is in the vendor/ directory.
I have an Entity class which looks like this:
/**
 * @ORM\Entity(repositoryClass="Acme\DemoBundle\Repository\ArticleRepository")
 * @ORM\Table(name="acme_demo_article")
 */
class Article

And a Repository class like this:
class ArticleRepository extends ServiceEntityRepository
{
    public function __construct(RegistryInterface $registry)
    {
        parent::__construct($registry, Article::class);
    }
}

This generates the following error:

The "Acme\DemoBundle\Repository\ArticleRepository" entity repository
  implements
  "Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface",
  but its service could not be found. Make sure the service exists and
  is tagged with "doctrine.repository_service".

If i remove the repositoryClass from the entity definition, I dont have the error anymore and i can use doctrine as such from my controller:
this->getDoctrine()->getRepository(Article::class)->findBy([], null, $limit, ($page - 1) * $limit);

I tried adding the repository as a service in the bundle service definition but it does not change anything:
vendor/Acme/demo-bundle/Resources/config/services.yaml
services:
  Acme\DemoBundle\Repository\:
    resource: '../../Repository/ArticleRepository.php'
    autoconfigure: true
    tags: ['doctrine.repository_service']

bin/console debug:autowire or debug:container wont show the service.
I also tried adding the extension:
namespace Acme\BlogBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class AcmeBlogExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new YamlFileLoader(
            $container,
            new FileLocator(__DIR__.'/../Resources/config')
        );
        $loader->load('services.xml');
    }
}

Did not work either. I dont have the impression that the extension is being called. I tried adding a constructor to it and dump, die in the constructor, but there are no results of the dump.
So my question is how do i define my repositories as a service from the vendor directory ?
The source code is overhere: https://github.com/khalid-s/sf4-bundle-test

A: After much struggling, i succedded in my task. I dont think that's it should be done like this, but if this can help someone...
I added in my DependencyInjection folder of the bundle:
class AcmeBlogExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new YamlFileLoader(
            $container,
            new FileLocator(__DIR__.'/../Resources/config')
        );
        $loader->load('services.yaml');
    }
}

I created a compiler (this is the part which i struggled to figure out) to register my service
class RepositoryCompiler implements CompilerPassInterface
{
    /**
     * @inheritdoc
     */
    public function process(ContainerBuilder $container)
    {
        $container->register('acme_blog.repository', ArticleRepository::class);
    }
}

I added in my Bundle class:
class AcmeBlogBundle extends Bundle
{
    /** @info this function normally is useless */
    public function getContainerExtension()
    {
        // This is only useful if the naming convention is not used
        return new AcmeBlogExtension();
    }

    /**
     * @inheritDoc
     */
    public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(new RepositoryCompiler());

        parent::build($container);
    }
}

And finally the service itself:
services:
  Acme\BlogBundle\Repository\:
    resource: '../../Repository/*Repository.php'
    autoconfigure: true
    autowire: true
    tags: ['doctrine.repository_service']

The autoconfigure and autowire are useless since they are not taken into consideration when i debug:container which looks like this:
php bin/console debug:container acme

Information for Service "acme_blog.article.repository"
=======================================================

 ---------------- -----------------------------------------------
  Option           Value
 ---------------- -----------------------------------------------
  Service ID       acme_blog.article.repository
  Class            Acme\BlogBundle\Repository\ArticleRepository
  Tags             doctrine.repository_service
  Public           yes
  Synthetic        no
  Lazy             no
  Shared           yes
  Abstract         no
  Autowired        no
  Autoconfigured   no
 ---------------- -----------------------------------------------

One very important note which made me loose a lot of time:

Do clear your cache after every change to your services. Even in dev
  mode they are not reloaded after every refresh


text:
Q: Number of spanning trees of a graph with k multiple edges Question:
Let $G$ be a simple graph on $n$ vertices, and let $H$ be the graph obtained from $G$ by replacing each edge of $G$ by $k$ multiple edges. Show that $t(H)=k^{n-1}t(G)$. (Here, $t(G)$ denotes the number of spanning trees.)
Attempt 1: Try to find the eigenvalues of the Laplacian matrix $L$ of $H$.
$L=D-A$ with $D$ the degree matrix of $H$ and $A$ the adjacency matrix of $H$
$$
D=k
\begin{bmatrix}
d(v_1) & 0 & \cdots & \cdots & 0\\
0 & d(v_2) & 0 & \cdots & \vdots\\
0 & \cdots & \ddots & \cdots & \vdots\\
0 & \cdots & \cdots & \ddots & \vdots\\
0 & \cdots & \cdots & \cdots & d(v_n)
\end{bmatrix}
=
\begin{bmatrix}
D_1 & \boldsymbol{0}\\
\boldsymbol{0} & D_2
\end{bmatrix}
$$
and
$$
A=k
\begin{bmatrix}
B_1^0 & B_2\\
B_3 & B_4^0
\end{bmatrix}
$$
with $B_i$ for $1\leq i\leq 4$ denoting Boolean matrices. The superscript $0$ denotes that the entries of the diagonal of the matrix are $0$s.
Thus,
$$
L=k
\begin{bmatrix}
D_1-B_1^0 & -B_2\\
-B_3 & D_2-B_4^0
\end{bmatrix}
$$
Here's where I'm stuck: Trying to find the eigenvalues of $L$. I don't know if it's possible based on the given information.
Attempt 2: Using $t(G)=t(G\setminus e)+t(G/e)$ with $e$ a link of $G$.
Thus $t(H)=t(H\setminus e)+t(H/e)$; however, how would I find $t(H\setminus e)$ or $t(H/e)$? I'm not sure where to begin.
I am looking for hints in the right direction. Thank you for your assistance.

A: Here are a few hints. (Suggestion: give each hint some thought before moving on to the next hint.)
Hint 1:

 Note that the Laplacians of $G$ and $H$ are related by a simple formula.

Hint 2:

 The relation is $L_H = k \cdot L_G$. This is all you need.

Hint 3:

 Alternative approach: let $T(G)$ denote the set of all spanning trees of $G$. Define $f : E(H) \to E(G)$ to be the function that forgets the multiple edges, i.e. that maps each of the $k$ parallel edges in $H$ between $v_1$ and $v_2$ to the unique edge in $G$ between $v_1$ and $v_2$. Then $f$ induces a function $F : T(H) \to T(G)$. How often does every spanning tree occur in the image of $F$?


text: Q: How do you use exe python package installer with Anaconda? I have a .exe installer for a python package that I want to use on one of my Anaconda environments. When I click on the .exe the installer want me to "Select python installation to use" and the python installation for my Anaconda environment doesn't appear. I tried messing around with PATH variables and it didn't work.


text:
Q: Simple_form & Twitter Bootstrap: Form labels unaligned, missing HTML in production? When I go into production, my forms change causing the labels and fields to be unaligned from each other. In development it works correctly but not in production.
Here is what I mean:
Development

                *
             Business

        <input type="text" size="50" name="store[business_name]" id="store_business_name" class="string required span3">

            The Business the store will belong to

Production

            *
         Business

        <input type="text" size="50" name="store[business_name]" id="store_business_name" class="string required span3">

            The Business the store will belong to

If you look closely, the
 disappears in production. I'm not using any type of bootstrap gem (dependent on gems I can't install). Is this a known issue, how is this fixed?

<%= simple_form_for(@store, :html => { :class => 'form-horizontal' }) do |f| %>
    <%= render :partial => "shared/error_message", :locals => { :f => f } %>

        <%= f.input :business_name, :label => 'Business', :input_html => { :class => "span3" }, :hint => "The Business the store will belong to" %>
        <%= f.input :online_store, :label => 'Online Store', :as => :boolean %>
        <%= f.input :address, :input_html => { :class => "span3" }, :placeholder => "451 University Avenue, Palo Alto, CA 94301", :hint => "For offline store" %>
        <%= f.input :website, :input_html => { :class => "span3" }, :placeholder => "www.somewebsite.com", :hint => "For online store" %>
        <%= f.input :phone_number, :input_html => { :class => "span3" }, :placeholder => "(650) 798-2800" %>

            <%= f.button :submit, "Done", :class => 'btn btn-primary span2' %>

<% end %>

A: What version of Simple_form are you using? How did you integrate bootstrap?
Presuming you used simple_form's wiki to integrate with twitter/bootstrap then please verify:

*

*lib/simple_form/contained_input_component.rb is being loaded and is implemented as-is

*config/initializers/simple_form.rb is calling the above library

*there is only one simple_form.rb in config/initializers and config/production

If all of the above is in order, please update the question with your view code.


text:
Q: Can we create wordcloud by executing Rscript from the terminal I'm developing an application where I need to create Wordcloud of twitter data and also some plots. I tried from RStudio. Now I need to develop a client server application which require all the Rscript to be executed from backend.
Is there any way to create a wordcloud from terminal and save it


text:
Q: Como posso definir uma área de "delimitadora" para o meu objeto arrastável em javascript? Ola!
Tenho um objeto com funcao drag no adobe edge animate e gostaria de saber como e possivel definir uma area onde sera possivel arrastar o objeto.
grata

A: Se você modificar a função de drag: Antes de você atualizar a posição do objeto "arrastável" você só precisa checar se:

*

*
*

*o X vai ser maior que ou igual ao X do X da área;

*

*o X + largura vai ser menor que o X da área + a largura da área;

*

*o Y vai ser maior que ou igual ao Y do Y da área;

*

*o Y + altura vai ser menor que o Y da área + a altura da área;

Se não, a posição do objeto não é atualizada. Onde você atualiza a posição do objeto quando arrastado você faz algo como isso:
if(obj.x >= limit.x && obj.x + obj.width <= limit.x + limit.width
obj.y >= limit.y && obj.y <= limit.y + obj.height ) {
    // Deve ser provavelmente assim que você atualiza a posição?
    obj.x = e.clientX;
    obj.y = e.clientY;
}
// `limit` seria algo como {x: 10, y: 10, width: 200, height: 200}
// O limit pode ser declarado de forma que possa ser usado.
// var limit = {x: 10, y: 10, width: 200, height: 200};

Mas parece que você está utilizando jQuery e a função de arrastar o objeto (no seu caso) é interior. Eu não conheço muito bem o jQuery. Talvez tentar atualizar o Y do objeto toda vez que o ponteiro do mouse se move pode ser funcional, caso o Y seja atualizado depois de o objeto ser arrastado.
sym.$('car2').mousemove(function() {
    $(this).css({'top': y});
});


text:
Q: Insert snippet in mac LaunchDaemon install4j has the option to insert custom fragments into plist files. I cannot get my head around to make it work. The launcher is a mac service. My custom fragment is
<key>EnvironmentVariables</key>
<dict>
      <key>SERVICE_HOME</key>
      <string>/Users/Shared/MyService/Home</string>
      <key>JAVA_HOME</key>
      <string>/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/</string>
</dict>

But it is ignored with no hint in the log

A: install4j generates service executables on Mac OS X as Unix shell scripts and not as Mac OS application bundles, so the Info.plist fragment is not inserted in that case.
Instead, you have to add the definition of the environment variables as a shell script on the "Executable info->Unix options" step of the launcher wizard:
export SERVICE_HOME=/Users/Shared/MyService/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/


text:
Q: Simpler way to parse XML I have the following xml which is returning from an api:
<?xml version="1.0" encoding="utf-8"?>
  <response>
   <error>
    <errorcode>1002</errorcode>
    <errortext>there is already an open session</errortext>
   </error>
</response>

I would like to read the error code. I write up the following code:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result1);
XmlNode node = xmlDoc.DocumentElement.SelectSingleNode("/response").ChildNodes[0].ChildNodes[0].InnerText

Is there any other way of doing this by using linq or some other technique?
I am using an api to call as follows
HttpClientHandler handler = new HttpClientHandler();
HttpClient client = new HttpClient(handler);
var result = client.GetAsync(new Uri("https://api/access.mth?username=xyz&password=xyz@2021)).GetAwaiter().GetResult();
StreamReader reader = new StreamReader(result.Content.ReadAsStringAsync().Result);

A: You can use the XML serializer which is located in the namespace System.Xml.Serialization. Create a class with a paramterless constructor that has public properties with getters and setters according to your XML elements:
public class response
{
   public error error {get;set;}
}

public class error
{
   public int errorcode {get;set;}
   public string errortext {get;set;}
}

Note: the parameterless constructor is created here implicitly by the compiler, because no constructor is defined at all.
You can load the file via
using StreamReader reader = new StreamReader("file.xml");
XmlSerializer serializer = new XmlSerializer(typeof(response));
var result = (response)serializer.Deserialize(reader);
int errorCode = result.error.errorcode;

You have some flexibility regarding the format of the XML file. For example if you have also this file to parse:
<response>
<returncode>
   100
   <description>successful</description>
</returncode> <authkey>xxxx<authkey>
</response>

You can modify your class structure:
public class response
{
   public error error {get;set;}
   public returncode returncode {get;set;}
   public string authkey {get;set;}
}

public class error
{
   public int errorcode {get;set;}
   public string errortext {get;set;}
}

public class returncode
{
   public int code {get;set;}
   public string description {get;set;}
}

If you parse a file of first format, returncode and authkey will be null. If you parse a file of second format, error will be null.


text:
Q: Wix launches application when uninstalling I have got a strange problem when using Wix to create a Windows Installer Setup for an application I'm working on.
Basically, when the application uninstalls it seems to be launching the application's executable before finalizing the uninstall.  I am not sure why it is doing this as I am a newbie on Wix.
Here is the full Wix code, which I got from here.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <?define Product_Name="Orbit Invoice System"?>
  <?define Product_Manufacturer="Orbit"?>
  <?define Product_Name_Short="OIS"?>
  <?define Product_Manufacturer_Short="Orbit"?>
  <?define MainExeID="MainExeID"?>
  <!--<?define Product_Version=!(bind.fileVersion.$(var.MainExeID))?>-->
  <?define Product_Version=!(bind.assemblyVersion.$(var.MainExeID))?>
  <?define SetupResourcesDir=$(var.SolutionDir)\icons\?>

  <Product Id="*" Name="$(var.Product_Name)" Version="$(var.Product_Version)" Manufacturer="$(var.Product_Manufacturer)"
           Language="1033"
           UpgradeCode="F9A23E67-669B-40E5-9995-D8425D08F35F">

    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <!--Check for .Net Framework 3.5 SP 1-->
    <PropertyRef Id='NETFRAMEWORK40FULL'/>
    <Condition Message="This application requires .NET Framework 4.0. Please install the .NET Framework then run this installer again.">
      <![CDATA[Installed OR NETFRAMEWORK40FULL]]>
    </Condition>

    <MajorUpgrade DowngradeErrorMessage="A newer version of $(var.Product_Name) is already installed."
                  Schedule="afterInstallValidate"
                  />

    <MediaTemplate EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="$(var.Product_Name) Setup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <!--Icon must be 16x16-->
    <Icon Id="AddRemoveProgramsIcon" SourceFile="$(var.SetupResourcesDir)libra.ico"/>
    <Property Id="ARPPRODUCTICON" Value="AddRemoveProgramsIcon" />
    <!--<Property Id="ARPHELPLINK" Value="" />-->

    <InstallExecuteSequence>
      <Custom Action="CleanUpUserData" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE AND NOT REINSTALL</Custom>
      <!--<Custom Action="LaunchApplication" Before="InstallFinalize" >UPGRADINGPRODUCTCODE OR REINSTALL OR NOT Installed</Custom>-->
    </InstallExecuteSequence>

  </Product>

  <Fragment>
    <CustomAction Id="CleanUpUserData" FileKey="$(var.MainExeID)" ExeCommand="cleanUpUserData" Execute="immediate" Impersonate="yes" Return="ignore"/>
    <!--<CustomAction Id="LaunchApplication" FileKey="$(var.MainExeID)" ExeCommand="mustBeSomethingOrTheUpdateWillFailWithError2753" Execute="commit" Impersonate="yes" Return="asyncNoWait"/>-->
  </Fragment>

  <!--Directory general structure-->
  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <!--Program Files-->
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="$(var.Product_Name)" />
      </Directory>
      <!--Startup Programs Menu-->
      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="$(var.Product_Manufacturer)">
          <Component Id="ProgramMenuDir" Guid="*" >
            <Shortcut Id="UninstallProduct"
                      Name="Uninstall $(var.Product_Name)"
                      Target="[SystemFolder]msiexec.exe"
                      Arguments="/x [ProductCode]"
                      Description="Uninstalls $(var.Product_Name)" />
            <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
            <RegistryValue Root='HKCU' Key='Software\$(var.Product_Manufacturer_Short)\$(var.Product_Name_Short)' Type='string' Value='' KeyPath='yes' />
          </Component>
        </Directory>
      </Directory>
      <!--Desktop-->
      <Directory Id="DesktopFolder" Name="Desktop" />
    </Directory>
  </Fragment>

  <!--Directory file structure-->
  <Fragment>
    <DirectoryRef Id="INSTALLFOLDER">
      <Component Id="MainExecutable" Guid="*">
        <File Id="$(var.MainExeID)" Name="$(var.Product_Name).exe" Source="$(var.Invoice.TargetPath)" DiskId="1" KeyPath="yes" Vital="yes"
              Assembly=".net" AssemblyApplication="$(var.MainExeID)">
          <Shortcut Id="MainExeDesktop" Directory="DesktopFolder" Name="$(var.Product_Name)" WorkingDirectory="INSTALLFOLDER"
                    Icon="MainExeIcon.exe"
                    Description="Launches the $(var.Product_Name) application" Advertise="yes" >
            <Icon Id="MainExeIcon.exe" SourceFile="$(var.Invoice.TargetPath)"/>
          </Shortcut>
          <Shortcut Id="MainExeProgramMenu" Directory="ProgramMenuDir" Name="$(var.Product_Name)" WorkingDirectory="INSTALLFOLDER"
                    Icon="MainExeIcon.exe"
                    Description="Launches the $(var.Product_Name) application" Advertise="yes" />
          <Shortcut Id="CleanUpLocalFiles" Directory="ProgramMenuDir" Name="CleanUp the Local Files" Arguments="cleanUpUserData" WorkingDirectory="INSTALLFOLDER"
                    Icon="MainExeIcon.exe"
                    Description="Cleanup all the downloaded files of the $(var.Product_Name) for the current user" Advertise="yes"/>
        </File>
      </Component>
      <Component Id="MainExecutableConfig" Guid="BDFC3501-CB6A-4C75-A4AE-05C0F7FE2DC2">
        <File Id="MainExeConfig" Name="$(var.Product_Name).exe.config" Source="$(var.Invoice.TargetPath).config" DiskId="1" KeyPath="yes" Vital="yes" />
        <File Id="InvoiceConfig" Name="InvoiceConfiguration.dll" Source="$(var.Invoice.TargetDir)\InvoiceConfiguration.dll" DiskId="1" Vital="yes" />
        <File Id="DocumentFormatOpenXml" Name="DocumentFormat.OpenXml.dll" Source="$(var.Invoice.TargetDir)\DocumentFormat.OpenXml.dll" DiskId="1" Vital="yes" />
        <File Id="SalesInvoiceTemplate" Name="SalesInvoiceTemplate.docx" Source="$(var.Invoice.TargetDir)\SalesInvoiceTemplate.docx" DiskId="1" Vital="yes" />
      </Component>
    </DirectoryRef>
  </Fragment>

  <!--Components groups-->
  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <ComponentRef Id="MainExecutable" />
      <!--<ComponentRef Id="Dlls" />
      <ComponentRef Id="LetterTemplates"/>-->
      <ComponentRef Id="MainExecutableConfig" />
      <ComponentRef Id="ProgramMenuDir" />
    </ComponentGroup>
  </Fragment>
</Wix>

Any ideas?

A: CleanUpUserData custom action run the $(var.MainExeID) application.
<CustomAction Id="CleanUpUserData" FileKey="$(var.MainExeID)" ExeCommand="cleanUpUserData" Execute="immediate" Impersonate="yes" Return="ignore"/>

The below condition (Installed AND NOT UPGRADINGPRODUCTCODE AND NOT REINSTALL) means the Custom action will be run if setup installed and not in upgrade or reinstall. So it will run in Repair or Uninstall(both will meet this condition). So your application is running in Uninstall.
<Custom Action="CleanUpUserData" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE AND NOT REINSTALL</Custom>

Check more about install and uninstall Conditions here.

A: After reviewing the answer given by @Vinoth I have changed the 'CleanUpUserData' custom action to this:
<Custom Action="CleanUpUserData" After="InstallInitialize">INSTALLED OR UPGRADINGPRODUCTCODE OR REINSTALL</Custom>

And this has now resolved the problem.


text:
Q: Java/C# Serial port write to Arduino reading wrong bytes I have a program I wrote originally in Java that writes to a serial port that I have an arduino pro mini plugged into. Each chunk of data is 6 bytes, and when the arduino receivies the data, it just spits it back out to the console to I can see that. The problem is when the data is spit back out, it is often in the wrong order with some bytes appearing to be sent twice. I wrote the same functionality in c# and the same thing is happening. I wrote some arduino code to write data to itself and echo it back, and that is correct.
So the problem must be my non arduino code, or some hardware settings. In my code, I added a delay after every write that allows the data to stay correct for a while, but it eventually starts getting screwed up.
I tried messing with the baud rate, but it didn't help. Why could this be happening??
Here's my arduino code.
//wait for seven bytes to come
if (Serial.available() >= 7) {
    /* read the most recent byte */
   Serial.print("Data: ");
   //set the enable byte
   data[0] = ENABLE;
   Serial.print((int)data[0], DEC);
   Serial.print(" ");
   for(int i = 1; i < DATA_SIZE; i++)
    {
      data[i] = Serial.read();
        Serial.print((int)data[i], DEC);
        Serial.print(" ");
     }

     Serial.println();
}