text:
Q: how sessions disabled by .htaccess
I am using the wordpress for my website, i create sub domain and use some php code for it,it works good.
the problem is this:
when i use the .htaccess for wordpress, my php code can not store the sessions.
Please help me and tell me which line of the .htaccess removes the sessions
 here is my .htaccess content:
# BEGIN iThemes Security - Do not modify or remove this line
# iThemes Security Config Details: 2
# Protect System Files - Security > Settings > System Tweaks > System Files
<files .htaccess>
    <IfModule mod_litespeed.c>
        Order allow,deny
        Deny from all
    </IfModule>
</files>
<files readme.html>
    <IfModule mod_litespeed.c>
        Order allow,deny
        Deny from all
    </IfModule>
</files>
<files readme.txt>
    <IfModule mod_litespeed.c>
        Order allow,deny
        Deny from all
    </IfModule>
</files>
<files install.php>
    <IfModule mod_litespeed.c>
        Order allow,deny
        Deny from all
    </IfModule>
</files>
<files wp-config.php>
    <IfModule mod_litespeed.c>
        Order allow,deny
        Deny from all
    </IfModule>
</files>

# Disable Directory Browsing - Security > Settings > System Tweaks > Directory Browsing
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Protect System Files - Security > Settings > System Tweaks > System Files
    RewriteRule ^wp-admin/includes/ - [F]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteCond %{SCRIPT_FILENAME} !^(.*)wp-includes/ms-files.php
    RewriteRule ^wp-includes/[^/]+\.php$ - [F]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F]
    RewriteRule ^wp-includes/theme-compat/ - [F]

    # Disable PHP in Uploads - Security > Settings > System Tweaks > Uploads
    RewriteRule ^wp\-content/uploads/.*\.(?:php[1-6]?|pht|phtml?)$ - [NC,F]

    # Filter Request Methods - Security > Settings > System Tweaks > Request Methods
    RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK) [NC]
    RewriteRule ^.* - [F]

    # Filter Suspicious Query Strings in the URL - Security > Settings > System Tweaks > Suspicious Query Strings
    RewriteCond %{QUERY_STRING} \.\.\/ [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*\.(bash|git|hg|log|svn|swp|cvs) [NC,OR]
    RewriteCond %{QUERY_STRING} etc/passwd [NC,OR]
    RewriteCond %{QUERY_STRING} boot\.ini [NC,OR]
    RewriteCond %{QUERY_STRING} ftp\:  [NC,OR]
    RewriteCond %{QUERY_STRING} http\:  [NC,OR]
    RewriteCond %{QUERY_STRING} https\:  [NC,OR]
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR]
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(%24&x).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(127\.0).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(request|concat|insert|union|declare).* [NC]
    RewriteCond %{QUERY_STRING} !^loggedout=true
    RewriteCond %{QUERY_STRING} !^action=jetpack-sso
    RewriteCond %{QUERY_STRING} !^action=rp
    RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
    RewriteCond %{HTTP_REFERER} !^http://maps\.googleapis\.com(.*)$
    RewriteRule ^.* - [F]
</IfModule>

# Disable XML-RPC - Security > Settings > WordPress Tweaks > XML-RPC
<files xmlrpc.php>
    <IfModule mod_litespeed.c>
        Order allow,deny
        Deny from all
    </IfModule>
</files>

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Reduce Comment Spam - Security > Settings > WordPress Tweaks > Comment Spam
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} /wp-comments-post\.php$
    RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
    RewriteCond %{HTTP_REFERER} !^https?://(([^/]+\.)?ashrafiprint\.com|jetpack\.wordpress\.com/jetpack-comment)(/|$) [NC]
    RewriteRule ^.* - [F]
</IfModule>

# Enable HackRepair.com's blacklist feature - Security > Settings > Banned Users > Default Blacklist
# Start HackRepair.com Blacklist
RewriteEngine on
# Start Abuse Agent Blocking
RewriteCond %{HTTP_USER_AGENT} "^Mozilla.*Indy" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Mozilla.*NEWT" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^$" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Maxthon$" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^SeaMonkey$" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Acunetix" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^binlar" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^BlackWidow" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Bolt 0" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^BOT for JCE" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Bot mailto\:craftbot@yahoo\.com" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^casper" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^checkprivacy" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^ChinaClaw" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^clshttp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^cmsworldmap" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^comodo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Custo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Default Browser 0" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^diavol" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^DIIbot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^DISCo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^dotbot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Download Demon" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^eCatch" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^EirGrabber" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^EmailCollector" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^EmailSiphon" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^EmailWolf" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Express WebPictures" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^extract" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^ExtractorPro" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^EyeNetIE" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^feedfinder" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^FHscan" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^FlashGet" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^flicky" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^g00g1e" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^GetRight" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^GetWeb\!" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Go\!Zilla" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Go\-Ahead\-Got\-It" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^grab" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^GrabNet" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Grafula" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^harvest" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^HMView" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^ia_archiver" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Image Stripper" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Image Sucker" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^InterGET" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Internet Ninja" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^InternetSeer\.com" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^jakarta" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Java" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^JetCar" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^JOC Web Spider" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^kanagawa" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^kmccrew" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^larbin" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^LeechFTP" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^libwww" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Mass Downloader" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^microsoft\.url" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^MIDown tool" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^miner" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Mister PiX" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^MSFrontPage" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Navroad" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^NearSite" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Net Vampire" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^NetAnts" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^NetSpider" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^NetZIP" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^nutch" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Octopus" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Offline Explorer" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Offline Navigator" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^PageGrabber" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Papa Foto" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^pavuk" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^pcBrowser" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^PeoplePal" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^planetwork" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^psbot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^purebot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^pycurl" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^RealDownload" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^ReGet" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Rippers 0" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^sitecheck\.internetseer\.com" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^SiteSnagger" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^skygrid" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^SmartDownload" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^sucker" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^SuperBot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^SuperHTTP" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Surfbot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^tAkeOut" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Teleport Pro" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Toata dragostea mea pentru diavola" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^turnit" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^vikspider" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^VoidEYE" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Web Image Collector" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Web Sucker" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebAuto" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebBandit" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebCopier" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebFetch" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebGo IS" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebLeacher" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebReaper" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebSauger" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Website eXtractor" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Website Quester" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebStripper" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebWhacker" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WebZIP" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Wget" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Widow" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WPScan" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WWW\-Mechanize" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^WWWOFFLE" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Xaldon WebSpider" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^Zeus" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "^zmeu" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "360Spider" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "AhrefsBot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "CazoodleBot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "discobot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "EasouSpider" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "ecxi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "GT\:\:WWW" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "heritrix" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "HTTP\:\:Lite" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "HTTrack" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "ia_archiver" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "id\-search" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "IDBot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Indy Library" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "IRLbot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "ISC Systems iRc Search 2\.1" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "LinksCrawler" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "LinksManager\.com_bot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "linkwalker" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "lwp\-trivial" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "MFC_Tear_Sample" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Microsoft URL Control" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Missigua Locator" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "MJ12bot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "panscient\.com" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "PECL\:\:HTTP" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "PHPCrawl" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "PleaseCrawl" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "SBIder" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "SearchmetricsBot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "SeznamBot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Snoopy" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Steeler" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "URI\:\:Fetch" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "urllib" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Web Sucker" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "webalta" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "WebCollage" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Wells Search II" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "WEP Search" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "XoviBot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "YisouSpider" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "zermelo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "ZyBorg" [NC,OR]
# End Abuse Agent Blocking
# Start Abuse HTTP Referrer Blocking
RewriteCond %{HTTP_REFERER} "^https?://(?:[^/]+\.)?semalt\.com" [NC,OR]
RewriteCond %{HTTP_REFERER} "^https?://(?:[^/]+\.)?kambasoft\.com" [NC,OR]
RewriteCond %{HTTP_REFERER} "^https?://(?:[^/]+\.)?savetubevideo\.com" [NC]
# End Abuse HTTP Referrer Blocking
RewriteRule ^.* - [F,L]
# End HackRepair.com Blacklist, http://pastebin.com/u/hackrepair

# Enable the hide backend feature - Security > Settings > Hide Login Area > Hide Backend
RewriteRule ^(/)?my_rule/?$ /wp-login.php [QSA,L]
RewriteRule ^(/)?wp-register-php/?$ /wplogin?action=register [QSA,L]
# END iThemes Security - Do not modify or remove this line

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

A: try to delete each line and test the result, maybe you can success


text:
Q: How do I save each plot in individual pdf files while batch processing the x and y for the plot? I came back to do some python work after not practicing it for a while. I feel like my issue may be a simple problem.. But I'm not sure how to address it. If you could share your insights, it would be a huge help. My current code is as the following:
 import numpy as np
 import matplotlib.pyplot as plt
 import csv
 import os

 myfiles = os.listdir('input') #'all my input files are accessed

Then I do a whole bunch of math then generate my output files and save them in 'output' folder. Output folders consist output files of which each contains x and y columns as the code suggests in the following.
 with open('output/'+file,'w') as f:
    for a,b in zip(my_x,my_y):
        f.write('{0:f},{1:f}\n'.format(a,b))

My biggest question lies here in the following, where I want to plot each output file and save them in pdf.
with open('output/'+file,'w') as f:
    for a in zip(my_x,my_y):
        fig, ax = plt.subplots()
        ax.plot(my_x,my_y)
        plt.xlim(3500,5700)
        plt.show()
        ax.set_ylabel('y_value')
        ax.set_title('x')
        fig.savefig()

The error message I get is
savefig() missing 1 required positional argument: 'fname'

Without the figure part of the code, the code runs fine (reads the input and generates the output files fine).
Any suggestions as to how to save figure for each of the output file?
If my code provided here is not sufficient enough to understand what's going on, let me know. I can provide more!

A: Would this do what you want?
with open('output/'+file,'w') as f:
    for a in zip(my_x,my_y):
        fig, ax = plt.subplots()
        ax.plot(my_x,my_y)
        plt.xlim(3500,5700)
        plt.show()
        ax.set_ylabel('y_value')
        ax.set_title('x')
        fig.savefig('output/' + file + '.pdf')

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I make one grid column proportionately larger than another? I need to make two columns proportionally sized so that the second column is 4 times larger than the first one.
How would I do that?
main{
    display: grid;
    grid-template-columns: ???
    grid-gap: 10px;
    grid-auto-rows: minmax(50pc, auto);
}

A: You need to use the fr unit, like this:
main{
    display: grid;
    grid-template-columns: 1fr 4fr
    grid-gap: 10px;
    grid-auto-rows: minmax(50pc, auto);
}

That will make the two columns take all the available space with the second column occupying four times as much space as the first one.


text:
Q: Control problems in skyrim Starting a couple of days ago, when playing Skyrim when I try to walk forward, every now and then my character tries to move toward the left. Is this likely a problem with my controller? (Doesn't happen with other games though) or is this a bug in the game; or even my PlayStation?

A: As others said in the comments, it is more than likely your joystick. I actually had a similar problem happen with one of my Xbox 360 controllers. The problem is simply from usage. I am unsure what you could do to stop the problem, other than buy a new controller.
One other thing (if your controller has sentimental value :P) is to take it to a tech repair shop and have it fixed. Game Stop might fix it, but more and likely just replace it and say they fixed it.


text:
Q: Python invalid value encountered in log10 This block for calculating Q_train_ref is giving me the log10 error
RuntimeWarning: invalid value encountered in log10
 Q_train_ref = 20 * np.log10(np.sqrt(2) * special.erfcinv(2 * BER_train_ref))
Epoch now 0 SR now 25.655268675901986
Q_train Sim now -31.973141549095576 Q_train Sim ref now nan
Traceback (most recent call last):
  File "/users/f/freiredp/anaconda3/envs/MScProject/lib/python3.9/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/home/freiredp/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/221.5591.52/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/home/freiredp/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/221.5591.52/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/users/f/freiredp/MScProject/multitask.py", line 115, in <module>
    result = ch.full_line_model(channel, wdm)
  File "/home/freiredp/MScProject/channel_model.py", line 949, in full_line_model
    nl_shift_x = nonlinear_shift(points_x, points_orig_x)
  File "/home/freiredp/MScProject/channel_model.py", line 891, in nonlinear_shift
    return np.dot(np.transpose(np.conjugate(points_orig)), points_orig) / np.dot(np.transpose(np.conjugate(points_orig)), points)
  File "<__array_function__ internals>", line 180, in dot
ValueError: shapes (262144,) and (229376,) not aligned: 262144 (dim 0) != 229376 (dim 0)


text:
Q: Using an infinitive in subordinate clause The Infinitive phrase may be

subject: For you to learn English is good
subjective complement: My desire is for my family to be happy
object: I consider it better for children to learn English early

...
But I don't know whether the infinitive phrase may be determiner of a preceding noun head as in

"In any cities for there to be a lot of accidents children shouldn't go out alone".

Could you explain that?

A: Your sentence is more or less(*) grammatical, but probably doesn't convey the meaning you want it to convey.

In any cities / for there to be a lot of accidents / children shouldn't go out alone.

Your main clause is at the end of your sentence, and both of your other clauses are subordinate to the main clause - they don't depend on each other:

In any cities, children shouldn't go out alone.
For there to be a lot of accidents, children shouldn't go out alone.

The problem is that your infinitive clause has a different meaning that you expect: for there to be means the same as in order for there to be. In other words, your sentence means that if children don't go out alone, there will be a lot of accidents.
What you probably wanted to say is:

In any cities in which there are a lot of accidents, children shouldn't go out alone.

(*) "any" isn't really natural as an object without something to narrow it down (?"Take any book" vs "Take any book you want"), and you need a comma if your subordinate clause comes before the clause that's modified by it:

In cities, for there to be a lot of accidents, children shouldn't go out alone.


text:
Q: "No child processes" error thrown by OCaml Sys.command function I am trying to use Frama-c via python application. This python application sets some env variables and system path. From this application, I am calling Frama-c as a python process as following:
cmd = ['/usr/local/bin/frama-c', '-wp', '-wp-print', '-wp-out', '/home/user/temp','/home/user/project/test.c']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)

When this code is executed from Python application I am getting following error:
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] warning: your preprocessor is not known to handle option ` -nostdinc'. If pre-processing fails because of it, please add -no-cpp-gnu-like option to Frama-C's command-line. If you do not want to see this warning again, use explicitely -cpp-gnu-like option.
[kernel] warning: your preprocessor is not known to handle option `-dD'. If pre-processing fails because of it, please add -no-cpp-gnu-like option to Frama-C's command-line. If you do not want to see this warning again, use explicitely -cpp-gnu-like option.
[kernel] Parsing 2675891095.c (with preprocessing)
[kernel] System error: /usr/bin/gcc -c -C -E -I.  -dD -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2675891095.cc8bf16.i' '/home/user/project/test.c': No child processes

I am finding it hard to debug what is causing the error:

System error: /usr/bin/gcc -c -C -E -I.  -dD -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2675891095.cc8bf16.i' '/home/user/project/test.c': No child
  processes

Is there a way to generate more error log from Frama-c that might help me figure out the issue?
Note that this error only occur when I start the process(to execute Frama-c) from my application, and not if I start it from a python console. And it happens only on Linux machine and not on Windows machine.
Any help is appreciated. Thanks!!
Update :
I realized that by using -kernel-debug flag I can obtain stack trace. So I tried the option and get the following information:

Fatal error: exception Sys_error("gcc -E -C -I.  -dD -D__FRAMAC__
  -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2884428408.c2da79b.i'
  '/home/usr/project/test.c': No
  child processes")
Raised by primitive operation at file
  "src/kernel_services/ast_queries/file.ml", line 472, characters 9-32
Called from file "src/kernel_services/ast_queries/file.ml", line 517,
  characters 14-26
Called from file "src/kernel_services/ast_queries/file.ml", line 703,
  characters 46-59
Called from file "list.ml", line 84, characters 24-34
Called from file "src/kernel_services/ast_queries/file.ml", line 703,
  characters 17-76
Called from file "src/kernel_services/ast_queries/file.ml", line 1587,
  characters 24-47
Called from file "src/kernel_services/ast_queries/file.ml", line 1667,
  characters 4-27
Called from file "src/kernel_services/ast_data/ast.ml", line 108,
  characters 2-28
Called from file "src/kernel_services/ast_data/ast.ml", line 116,
  characters 53-71
Called from file "src/kernel_internals/runtime/boot.ml", line 29,
  characters 6-20
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml",
  line 787, characters 2-9
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml",
  line 817, characters 18-64
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml",
  line 228, characters 4-8
Re-raised at file "src/kernel_services/cmdline_parameters/cmdline.ml",
  line 244, characters 12-15
Called from file "src/kernel_internals/runtime/boot.ml", line 72,
  characters 2-127

And I looked at the file "src/kernel_services/ast_queries/file.ml", line 472 and the code executed is Sys.command cpp_command.
I am not sure why "No Child Processes" error is thrown when trying to execute execute gcc.
Update: I have Ocaml version: 4.02.3, Python version: 2.7.8 and Frama-C version: Silicon-20161101

A: I know nothing about Frama-C. However, the error message is coming from somebody's (OCaml's? Python's?) runtime, indicating that a system call failed with the ECHILD error. The two system calls that system() makes are fork() and waitpid(). It's the latter system call that can return ECHILD. What it means is that there's no child process to wait for. One good possibility is that the fork() failed. fork() fails when the system is full of processes (unlikely) or when a per-user process limit has been reached. You could check whether you're running up against a limit of this kind.
Another possibility that occurs to me is that some other part of the code is already handling child processes using signal handling (SIGCHLD). So the reason there's no child process to wait for is that it has already been handled elsewhere. This gets complicated pretty fast, so I would hope this isn't the problem.


text:
Q: Visual Studio creating blank aspx:1 files I'm currently using VS Community 2013 but I've seen this behaviour in previous versions of VS.
Scenario: I have previously saved and closed a solution whilst it has several tabs open. I then re-open the solution. The open tabs reload, but (as far as I can tell randomly) one or more of the aspx files that were open when I last saved and closed the solution, are recreated as a blank file with the extension aspx:1 or aspx:2.
Closing the blank file & reopening that file from the Solution Explorer restores the correct version of the file. No work is lost, so I admit this is an irritation rather than a crisis.
What's going on, and more importantly any idea how I can make it stop? I have got the Preview Tab functionality (Options >> Environment >> Tabs and Windows) turned off. Thanks

A: http://ambracode.com/index/show/161001
it says there:
"It's the naming convention for Visual Studio when the window is cloned. Sometimes, however, Visual Studio just gets confused and names it that way."


text:
Q: Iterate Napi::Object Properties (Keys) in Node.js C++ N-API I am having a problem using c++ n-api api and I have reviewed the documentation here, and I do not see a way to iterate the keys of a Napi::Object. I must be missing something because this is possible in JavaScript, so it must be possible in the C++ API.
How can I list or iterate the keys (properties) in a Napi::Object.

A: It seems the Doxygen documentation which Google surfaced at https://nodejs.github.io/node-addon-api/ is out-of-date.
The right place to look is on the Node.js Github repo at https://github.com/nodejs/node-addon-api/blob/master/napi.h
Looking at the correct header version, Napi::Object has a function GetPropertyNames() which is exactly what I needed (though it is oddly not const).


text:
Q: Copying database in SQL server without the GUI? Is it possible to export a database' schema and data, similar to https://stackoverflow.com/a/1515975/14731, programmatically (without using the GUI)?
I'm trying to:

*

*Export a database' schema and data from a remote server to a local file.

*I want the schema for all tables, but the data for a subset of the tables. Meaning, I need to exclude data from some tables up-front. We are talking about terabytes of data which are too big to duplicate or send over the wire.

*Import the data from the local file to a different remote server.

*Ideally do this all programmatically, without using the GUI


text:
Q: Write VideoWriter before close I'm using the VideoWriter object to create a movie in Matlab. However, the movie file doesn't write until the program stops.
Is there any way to force it to write as it's going? Looking online I don't see anything.
I'm currently writing to as an avi but I don't care which format I use.
please specify your findings and search result for what you have already tried


text:
Q: Send Esc key in KDE 4? I am trying to set up a custom shortcut to map Esc to Esc:Esc, i.e. simulate a double press on Esc key, and so far have had no luck.
(systemsettings -> gestures and shortcuts -> custom shortcuts)
I also tried Escape:Escape, didn't work either.
It would be better to have a comprehensive list of how every key should be represented.


text:
Q: how can i get all ERC20 addresses in brownie to use in frontend I want to create app like uniswap using brownie and react how can i access all tokens addresses and abi for my project and use it in frontend. How can i implement this in best optimized way ?

A: What you want to do is to take information from a Token like uniswap
uniswap didn't save all the existing tokens, that's an impossible thing to do
every time you write the address of a token on uniswap, it makes requests to the smart contract, calling up existing functions thanks to the ERC-20 standard
the functions that are called are
totalSupply() // to get the total supply

decimals() // to get the number of decimals

name() // to get the name of the token (e.g. Bitcoin)

symbol() // to get the symbol of the token (e.g. BTC)

to obtain this data you have to make a call through web3, which will return the data you request
// initialize web3
const Web3 = require("web3");

// save only the ABI of the standard, so you can re-use them for all the tokens
// in this ABI you can find only the function totalSupply ()
const ABI = [
     {
         "type": "function",
         "name": "totalSupply",
         "inputs": [],
         "outputs": [{"name": "", "type": "uint256"}],
         "stateMutability": "view",
         "payable": false,
         "constant": true // for backward-compatibility
     }
];

// run the JS function
async function run() {
     const web3 = new Web3(<YourNodeUrl>);
// create the web3 contract
     const contract = new web3.eth.Contract(ABI, <TokenAddress>);
// call the function and get the totalSupply
     const totalSupply = await contract.methods.totalSupply().call();
     console.log(totalSupply);
}


text:
Q: I think emoji are killing my WordPress site… How can I debug? I have had a rather frustrating last couple of days… after quite a bit of trial and error, I have come to the suspicion that emoji are killing my WordPress installation. Specifically, emoji in the settings of my theme.

In retrospect, I can see that even trying to use emoji was a bit of a risky proposition. As I understand it, they are not officially a part of the UTF-8 character set.
For the time being, I have tried to carefully go back through all of my theme settings and eliminate any use of emoji anywhere. But now, I would like to find out exactly how they are breaking WordPress and where. Trouble is, I'm not familiar with PHP beyond the basics I've needed to pick up for theme customization.
Where should I begin to debug this problem?

A: This is a limitation of MySQL's UTF-8 implementation: it supports just a limited set of valid UTF-8 characters. You can convert your database to utf8mb4, and emojis will work. But there may be other side effects.
See ticket #21212 for details.


text:
Q: What's is the relationship/difference between NSCell and NSControl? I come from iOS background and when creating custom controls, you simply subclass UIControl. I am trying to build a custom NSSlider (one with 2 knobs instead of one) and noticed that there are 2 classes to deal with NSControl and NSCell.
Why?

A: This is for performance reasons in the past. It made it possible to reuse cells without always creating new ones for example in a table. Additionally you did not have very deep view hierarchies, being a problem 10 years ago.
Please note that NSCell works completely different from what you know in iOS, esp. it is no view.


text:
Q: Center MKMapView BEFORE displaying callout I am trying to center an MKMapView after an annotation was selected. I also have enabled canShowCallout but it seems that iOS is first displaying the callout (which is shifted when it would not fit in the screen) and then the map is being moved, resulting in the callout being not completely visible on the screen.

How can I center the map BEFORE the callout's position is being rendered and displayed?

A: I wanted to accomplish the same thing and ended up doing the following.
A word of caution before I begin: I know the solution is pretty ugly!...but hey, it works.
Note: I am targeting iOS 9 but it should work on prior versions of iOS:
Okay, here we go:

*

*first off, create a new property in your view controller, e.g.: @property(nonatomic, assign, getter=isPinCenteringOngoing) BOOL pinCenteringOngoing;

*in mapView:viewForAnnotation: set canShowCallout to NO for your annotationViews

*in mapView:didSelectAnnotationView: do the following:
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    if([view isKindOfClass:$YOURANNOTATIONVIEWCLASS$.class])
    {
        if(!self.isPinCenteringOngoing)
        {
            self.pinCenteringOngoing = YES;
            [self centerMapOnSelectedAnnotationView:($YOURANNOTATIONVIEWCLASS$ *)view];
        }
        else
        {
            self.pinCenteringOngoing = NO;
        }
    }
}

*in mapView:didDeselectAnnotationView: do the following:
- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view
{
    if([view isKindOfClass:$YOURANNOTATIONVIEWCLASS$.class])
    {
        if(!self.isPinCenteringOngoing)
        {
            view.canShowCallout = NO;
        }
    }
}

*and finally create a new method that does the actual work:
- (void)centerMapOnSelectedAnnotationView:($YOURANNOTATIONVIEWCLASS$ *)view
{
    // Center map
    CGPoint annotationCenter = CGPointMake(CGRectGetMidX(view.frame), CGRectGetMidY(view.frame));
    CLLocationCoordinate2D newCenter = [self.mapView convertPoint:annotationCenter toCoordinateFromView:view.superview];
    [self.mapView setCenterCoordinate:newCenter animated:YES];

    // Allow callout to be shown
    view.canShowCallout = YES;

    // Deselect and then select the annotation so the callout is actually displayed
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void)
    {
        [self.mapView deselectAnnotation:view.annotation animated:NO];

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void)
        {
            [self.mapView selectAnnotation:view.annotation animated:NO];
        });
    });
}

To complete my answer, here is a textual explanation of what I'm doing in the code above and why I'm doing it:

*

*What I want is the annotation to be centered on screen, and the callout to be centered above it.

*What I get by default is:

*

*When selecting an annotation, the map opens the callout, and if necessary adjusts the map so the callout fits on screen. By no mean does that standard implementation guarantee, that the callout is "centered" above the annotation.

*By centering the map with setCenterCoordinate:, the annotation view is centered on the map.

*Now the two previous points combined can result in the callout to be "cut off" as the annotation is centered on the map, but the callout is not centered above the annotation.

*To fix this, I do the following:

*

*first I disable the callout to be displayed by default, setting canShowCallout to NO for every annotationView

*when the user selects an annotation, I first center the map

*I then allow the callout to be shown, setting canShowCallout to YES for the selected annotation

*I then deselect and then again select the annotation, so the callout is actually displayed

*in order for the callout to be correctly centered above the annotation, I need to do the deselecting/selecting somewhat delayed so that the map centering can complete

I hope my answer may prove useful.

A: Here an other solution :

*

*Create a new boolean property var selectFirstAnnotation = false in your controller

*Set it to true before to center the annotation

*Add this is in regionDidChangeAnimated.
func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
        if selectFirstAnnotation == true {
          if let annotation = mapView.annotations.first(where: { !($0 is MKUserLocation) }) {
            mapView.selectAnnotation(annotation, animated: true)
            selectFirstAnnotation = false
    }}}

Works fine for my behaviour

A: I tried both previous solutions and Greg's is the correct answer with a couple of tweaks... I put the map centering in and animation block to slow down the animation.
UIView.animate(withDuration: 0.8) {
     self.mapView.setCenter(CLLocationCoordinate2D(latitude: newCenter.latitude, longitude: newCenter.longitude), animated: true)
}

Then I was getting an unacceptable blip from the separation of the deselect and select calls into different dispatches with different times and discovered they can both go in the same dispatch. Adding  animated: true to the select call adds a nice touch as well.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.9) {
     mapView.deselectAnnotation(view.annotation, animated: false)
     mapView.selectAnnotation(view.annotation!, animated: true)
}


text:
Q: why cp -p does not keep ctime why cp -p does not keep ctime?
I think all timestamps should be preserved as described
   --preserve[=ATTR_LIST]
          preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all

[root@node101 test]# stat 1
  File: '1'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d    Inode: 54395143    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-08-08 11:00:04.207486784 +0800
Modify: 2019-08-08 11:00:04.207486784 +0800
Change: 2019-08-08 11:00:04.207486784 +0800
 Birth: -
[root@node101 test]# cp -p 1 2
[root@node101 test]# stat 2
  File: '2'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d    Inode: 54395144    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-08-08 11:00:04.207486784 +0800
Modify: 2019-08-08 11:00:04.207486784 +0800
Change: 2019-08-08 11:00:28.478788113 +0800
 Birth: -


text:
Q: Why the PHP code in the index.php execute multiple times? (.htaccess) When you open "Home Page" on my website (index.php), PHP code stores information about your IP address in a database MySQL. Unfortunately, he does it several times in a row. Most likely the problem is with the .htaccess file. When I emptied its contents, everything was back to normal, but I have some rules there that I would like to have. Where did I go wrong?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Redirect to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Hide .PHP
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
</IfModule>

# Cache for img and fonts 1 year
<FilesMatch ".(jpg|jpeg|png|gif|svg|woff2)$">
Header set Cache-Control "max-age=31536000"
</FilesMatch>

# Cache for js and css 30 days
<FilesMatch ".(css|js)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>

# Redirect 404 to homepage
ErrorDocument 404 https://xyz.pl/

# Hide Apache version in signature
ServerSignature Off


text:
Q: Coordenadas de área selecionada em imagem Tenho a seguinte dúvida:
Tenho uma imagem e quero fazer a seleção de uma área qualquer dessa imagem, como no exemplo marcado pelo quadrado vermelho (considere que isso seja a seleção).
Dessa seleção, preciso saber qual a coordenada de cada um dos pontos, como por exemplo na imagem: Ponto 01 = Coordenada XY | Ponto 02 .....
Alguém pode me dar uma ideia de como faço isso?

A: Aqui fica um ponto de partida para fazer isso com JavaScript nativo.
Não é dificil, o meu exemplo pode precisar de uns ajustes mas assim aprendes melhor também como funciona.
Basicamente precisas de controlar alguns parâmetros:

*

*saber quando e onde o mouse clica na imagem para começar a arrastar

*saber onde o mouse se move e cancelar o drag nativo

*ir mudando a largura da selecao à medida que se arrasta

*juntar o auscultador de evento do mousemove à window, para saber quando o arraste acaba

*usar o getBoundingClientRect para saber as posições dos cantos da selecao

Esse passos estão no código abaixo, isso na prática poderia ser assim:
JavaScript:
var info = document.getElementById('info');
var img = document.querySelector('img');
var selecao = document.getElementById('selecao');

var inicio;

function arrastador(e) {
    e.preventDefault();
    selecao.style.width = e.pageX - inicio.x + 'px';
    selecao.style.height = e.pageY - inicio.y + 'px';
    gerarInfo();
}

function gerarInfo() {
    var pos = selecao.getBoundingClientRect();
    var coords = {
        se: [pos.left, pos.top],
        sd: [pos.right, pos.top],
        ie: [pos.left, pos.bottom],
        id: [pos.right, pos.bottom]
    };
    info.innerHTML = JSON.stringify(coords);
}
img.addEventListener('mousedown', function(e) {
    inicio = {
        x: e.pageX,
        y: e.pageY
    };
    selecao.style.display = 'block';
    selecao.style.left = inicio.x + 'px';
    selecao.style.top = inicio.y + 'px';
    selecao.style.width = 0;
    selecao.style.height = 0;
    window.addEventListener('mousemove', arrastador);
});
window.addEventListener('mouseup', function(e) {
    inicio = null;
    window.removeEventListener('mousemove', arrastador);
    gerarInfo();
});

CSS:
#selecao {
    border: 2px #aaf solid;
    position: absolute;
    display: none;
    background-color: rgba(255, 0, 0, 0.3);
}

HTML:

Aqui vai aparecer info...

jsFiddle: https://jsfiddle.net/akncqxht/2
No exemplo os resultados são

*

*"canto superior direito" como se

*"canto superior esquerdo" como sd

*etc

Se tiveres dúvidas diz que explico melhor.

A: encontrei uma solução prática no plugin Cropper. Ele retorna exatamente essas informações da imagem. Seleção feita no browser com interação do utilizador. Retorna as coordernadas X, Y, Width e Height.
https://fengyuanchen.github.io/cropper/


text:
Q: How to reserve all arguments (include whitespce in arg list) in m4 How to reserve all arguments (include whitespce in arg list) in m4, such that:
define(foo, FOO)

foo(a, b, c)

expand to
FOO(a, b, c)

and
foo(
a, b, c
)

expand to
FOO(
a, b, c
)


text:
Q: verify sketchy equation with conditional expectation I saw this sketchy equation and wondered what is correct or wrong and which assumptions are needed for (1) and (2) (maybe it is due to unfamiliar/sloppy notation):
$$\mathbb{E}[A|B=b] \overset{(1)}{=} \int a P(a|B=b) = \int a P(B=b|a) P(a) \overset{(2)}{=} \mathbb{E}[a P(B=b|a)]$$
(1) I thought I would need the conditional density $f_A(\centerdot|B=b)$, but looks intuitively ok. What is required for this to hold (if in any case it holds)?
(2) I do not get this. I would expect Fubini, but..

Step-by-step filling in details:
$$\mathbb{E}[A|B=b] \overset{(1)}{=} \int_\Omega a P(A=a|B=b) \propto \int_\Omega a P(B=b|A=a) P(A=a) \overset{(2)}{=} \mathbb{E}[a P(B=b|A=a)]$$

*

*$A$ and $B$ are random variables

*I assume that the integral are proportional, since according to Bayes the divisor is missing.

*$a$ inside $P$ meant the event $A=a$

*I added $\Omega$ as sample space to the integral, then the Integral should be $dP$? I am not sure.. Maybe the integral is in the pushforward measure of $A$.

A: Assume that $A$ and $B$ have densities $f_A$ and $f_B$ respectively and that $A$ conditionally on $B$ and $B$ conditionally on $A$ have conditional densities $f_{A\mid B}(\ \mid\ )$ and $f_{B\mid A}(\ \mid\ )$ respectively. Then the joint density $f_{A,B}$ of $(A,B)$ exists and is such that, for almost every $(a,b)$,
$$
f_{A,B}(a,b)=f_{A\mid B}(a\mid b)f_B(b)=f_{B\mid A}(b\mid a)f_A(a).
$$
Thus, for every measurable function $u$,
$$
E[u(A)\mid B=b]=\int_\mathbb Ru(a)f_{A\mid B}(a\mid b)\mathrm da=f_B(b)^{-1}\int_\mathbb Ru(a)f_{B\mid A}(b\mid a)f_A(a)\mathrm da,
$$
where the first = sign is a definition and the second = sign follows from the identity above. Consequently, the "Step-by-step filling in details" suggested in the question is mostly correct, with three exceptions. First, the integrals are not on $\Omega$ but on the image set of $A$, which we assumed to be $\mathbb R$. Second, when the random variables $A$ and $B$ have densities, every $P(A=a|B=b)$, $P(B=b|A=a)$ and $P(A=a)$ is actually zero. Third, notations such as $E[aP(B=b|A=a)]$ cannot be recommended.


text:
Q: Testcafe - display steps while running tests How do I display step by step information while running the test? Currently runs the command

testcafe chrome .\test\customer.js

Generally speaking, need to see more info as to whats executed.

A: For now, such a capability does not exist in TestCafe. But there is a corresponding suggestion in the TestCafe GitHub repository. You can subscribe on it to be informed about its status.


text:
Q: Automorphism of graph Let $G$ be a connected vertex transitive graph and $G_v$ denote stabilizer of the vertex $v$. If $h$ is any automorphism of  $G$ for which $d(v,h(v))=1$, and $G$ is symmetric,the $h$ and $G_v$ generate $\operatorname{Aut}(G)$.
We say that $G$ is symmetric if ,for all vertices $u,v,x,y$ of $G$ such that $u$ and $v$ adjacent, and $x$ and $y$ are adjacent there is an automorphism $g$ in $\operatorname{Aut}(G)$ for which $g(u)=x$ and $g(v)=y$

I think we should use this fact: Let $G$ be group acting transitively  on set $X$, $H$ be a subgroup of $G$ and $G_a$ be  stabilizer of G then $G=HG_a$ if and only if H is transitive.
Please advise me.

A: I wasn't sure what a symmetric graph was, but according to Wikipedia it means the same as arc-transitive. So $G_v$ is transitive on the set of vertices adjacent to $v$. Let $X = \langle G_v, h \rangle$ and let $H$ be the orbit of $X$. Then, since $H$ contains $h(v)$, and $v$ and $h(v)$ are adjacent, so $H$ contains all vertices adjacent to $v$. Also, since the conjugate of $G_v$ by $x \in X$ is $G_{x(v)}$, $X$ contains $G_w$ for all $w \in H$ so now, by a straightforward induction on $n$, $H$ contains all vertices at distance $n$ from $v$, and hence $H=G$ since $G$ is connected. Then, by the result you mention, $X={\rm Aut}(G)$.
Exercise: find an example in which the result is false if we do not assume that $G$ is symmetric.


text:
Q: Is there a logfile for the find command? Accidentally executed find . -type d -empty -delete in home directory. Was wondering if there's a way to see the list of deleted items.

A: No; there is no log of the output of
find . -type d -empty -delete

On the plus side, many programs will recreate missing directories on demand, especially those that are well written.


text:
Q: awk syntax error a[$1] I have the following awk command:
awk -F $'\t'
'BEGIN
{ OFS = FS }
{ if($1 % 5 == 0) {a[$1][$2][$3]+=$4; } }
END
{for (i in a) for (j in a[i]) for (k in a[i][j]) print i, j, k, a[i][j][k]}'

And an input file containing a list of 4 tuple id's:
9374    2150    26  1
7477    1808    58  1
4972    787 28  1
5617    8342    15  1

etc..
When I run the command on the input file I get the error:

awk: syntax error at source line 1  context is    BEGIN { OFS = FS } {
  if($1 % 5 == 0) >>>  {a[$1][ <<<  awk: illegal statement at source
  line 1 awk: illegal statement at source line

I am not sure what the command is supposed to do, probably create an ID lookup file of some sort.

A: You're using gawk-only syntax in a non-GNU awk. Get gawk or use a[$1,$2,$3] or similar instead of a[$1][$2][$3] and fix the rest of your code to match. Unfortunately not only didn't you provide any expected output but you didn't even provide input that could produce any output (none of your $1 values modded by 5 evaluate to 0) so this is obviously untested but it might be what you want:
BEGIN {
    FS=OFS="\t"
}
($1 % 5) == 0 {
    a[$1 OFS $2 OFS $3] += $4
}
END {
    for (key in keys) {
        print key, a[key]
    }
}


text:
Q: General formula for the numerators? Suppose that $a$ is a natural number. The numerator of $\dfrac {1}{a}$ is $1$. The numerator of $\dfrac {1}{a} + \dfrac {1}{a+1}$ is $2a+1$ [Note: Here for our purpose we don't cancel common factors of the numerator and denominator]. The numerator of $\dfrac {1}{a} + \dfrac {1}{a+1} + \dfrac {1}{a+2}$ is $3a^2+6a+2$. And so on. I tried a lot to come up with a general formula for the numerator of the sum of $n$ consecutive terms but I couldn't. I think there should exist some formula for it same as we have a formula for the coefficients of a binomial expansion. Any idea?
Saying in a more mathematical language:
The numerator of $\dfrac {1}{a} + \dfrac {1}{a+1} + \dots + \dfrac {1}{a+n}$ is $b_1+b_2a+ \dots + b_na^n$. What are the $b_i$'s?

A: The expression is:
$\frac{1}{a} + \frac{1}{a+1} + \frac{1}{a+2} ... $
The numerator is going to be sum of the product of all the denominators with one term missing.
$(a+1) * (a+2) *.... (a+n)$ [a missing]
$+ a*(a+2)... (a+n)... $ [a+1 missing]
.
.
$+ a*(a+1)... (a+n-1)$ [a+n missing]
Each term can be expressed in terms of factorials.
$= \sum_{i = a}^{a+n} \frac{(a+n)!}{(a-1)!i}$
$ = \frac{(a+n)!}{(a-1)!} \sum_{i = a}^{a+n} \frac{1}{i}$
I don't think there is a closed form for the numerator though.
EDIT: Thanks to Rick Decker's useful comment, I remembered the forgotten Harmonic numbers, so the sum of 1/i becomes H(a+n) - H(a - 1)
Where H(n) is the $n^{th}$ Harmonic number = $\sum_{i=1}^{n} \frac{1}{i}$

A: The $b_i$ are simple multiples of unsigned Stirling numbers of the first kind.  In a common notation, the coefficient of $x^k$ in the combined sum of $n$ terms is $(k+1)\left[{n \atop k+1}\right]$
Take the triangle of values in Wikipedia
which starts
n \ k    0    1    2    3    4

0        1
1        0    1
2        0    1    1
3        0    2    3    1
4        0    6   11    6    1

multiply the values in the triangle by the index at the top and drop the initial column and the indices to get a revised triangle
              1
              1    2
              2    6    3
              6   22   18    4

This new triangle corresponds to the coefficients in

*

*$\dfrac{1}{a} = \dfrac{1}{a}$

*$\dfrac {1}{a} + \dfrac {1}{a+1} =\dfrac {1+2a}{a(a+1)}$

*$\dfrac {1}{a} + \dfrac {1}{a+1} + \dfrac {1}{a+2}=\dfrac {2+6a+3a^2}{a(a+1)(a+2)}$

*$\dfrac {1}{a} + \dfrac {1}{a+1} + \dfrac {1}{a+2}+ \dfrac {1}{a+3}=\dfrac {6+22a+18a^2+4a^3}{a(a+1)(a+2)(a+3)}$

and so on


text:
Q: how to parse customer message? i use customer message and send it broadcast over radio channel, i use example 6 (CounterSend ) from this link .
when i build this project as micAz on mote 1, after this i use Xsniffer (TOSBase) on the mote that i will use it on the serial usb board (520).
after that i open Xsniffer program to see the radio packet and they appeared as following :

on other hand, to use Xserver i use XMeshBase then type on cygwin terminal :
xserve -device=com4

i got this!! but i can't understand what it received ?

how can i parse the data received ?? and named them as i want ?? ex: i need first byte be the source ??
how to do that ?


text:
Q: create restapi with token authentication I'm trying to create RestApi first time. Looking for assistance after reading text present online.
My requirement is, I want to create an rest api which will be having username and password. Password will be in encrypted format. So when this api client will request to a web server, that password will be decrypted first on server side and then if the user name and password authenticates then it will send back a temporary token with expiry date. Then again that token will be used in rest api to request data from the web server in xml format.
How can we achieve this ?
And I also want to understand if we encrypt a password in client server then how its get decrypts on web server side. Is the same instance travels from client to web server side while making request ?
Second, The data which I'm trying to consume from web server are the email ids of users which registers on website. My question, If user is getting registered on website then website must be storing those email ids somewhere like in database right ? And my restApi will be accessing the code on web-server side  which is responsible to get email ids from database in xml format. Is my understanding correct ?

A: First, don't concern yourself directly with encrypting details client-side and decrypting them server-side.  If you are using TLS/HTTPS (which you should be) then all is well, everything is already encrypted.
The token generation is slightly more difficult but still easy enough.  A commonly used and simple to implement method is to use JWT tokens.  The general idea is that you create a JSON object like the following:
{ "userID": "FC5A47CC", "expiry": "12/10/2017" }

And then run it through an HMAC using a key only your server knows.  You append the result of the HMAC to the JSON object using base64 encoding and then send this to your client after they have logged in.
Using this method, authentication is very fast, as your web server won't need to make any requests to your database server to determine if the token is valid.  You can read more about JWT here.  I've answered a similar question in more detail here.
As your question asks, these userIDs will obviously need to be stored in your database.

A: Seems like you want client app to consume resources on behalf of user. I propose OAuth 2.0, which provides mechanism, which you have described to access protected resources without storing passwords. Client app requests a username and password from the user (for example by using a login form) and then send that credentials to the server. Upon receipt and validation server returns token to the client. Client stores token locally and discards username and password. All subsequent request are authorized by token, which can be accomplished using a custom HTTP header, for example X-Auth-Token. Server can optionally provide a refresh token along with the access token, which is used by client to obtain new access token, once current expires. HTTPS/SSL technology is required by OAuth 2.0, so data over wire will be encrypted.
There are 4 roles defined by OAuth 2.0 :
1) Authorization Server — does identity verification and grants token to the client app.
2) Resource Server — Server which hosts actual protected user resource.
3) Resource Owner — User willing to provide access to his protected resource.
4) Client — application that gets access to a user's resources.
You can use Spring Security OAuth framework to implement this requirement.


text:
Q: Service Fabric application instance configuration How do you configure different application instances?  I know you can parameterize the ApplicationManifest and service Config packages, but how would you specify a different port for the webservice in two different application instances?  The endpoint for the webservice is defined in the ServiceManifest, which can not be parameterized afaik.

<Resources>
  <Endpoints>
    <!-- This endpoint is used by the communication listener to obtain the port on which to
           listen. Please note that if your service is partitioned, this port is shared with
           replicas of different partitions that are placed in your code. -->
    <Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="80" />
  </Endpoints>
</Resources>

Say I have an Application Type MyAppType which contains  a service type MyWebSvcType.  I create two instances of the application type MyAppTenant1 and MyAppTenant2.  How do I specify that the webservice of MyAppTenant1 listens on port 80 and the webservice of MyAppTenant2 listens on port 81.  This is because they could be on the same node, and thus should listen to different ports.

A: If you omit the Port attribute, your service instance will get a dynamic port assigned. You can find the service endpoints by using code or you can access it through the built in reverse proxy.
More info here and here.


text:
Q: Finding the next term in a sequence. So this came up in a math competition some of students participated in over the weekend.  Expected highest level of mathematics is calculus 1.
Let $a_n$ be an arithmetic sequence, $b_n$ be a geometric sequence and suppose that $c_n=a_n-b_n$.  The first four terms of $c_n$ are $2, 8, 6, 20$.  Find $c_5$.
My students had two minutes and no calculator to answer this... I've played with this a bit and think that partial sums is probably the direction to go if this is going to be a 2 minute problem but I'm stuck!  I've gotten to a couple spots that I think are along the right direction but perhaps I'm not thinking about this correctly.  Here's what I know:
$c_5=S_5-S_3-c_4$
So if I could find the partial sum at 5 I've got this... The other idea that I have is that the common ratio of the geometric series is $(-b_2)/(b_1)$ (I believe) but I'm still fairly at a loss as how to get our next term.  Some help would be appreciated!

A: Let $d$ denote the common difference of the arithmetic sequence and $r$ denote the common ratio of the geometric sequence.  Then:
\begin{align*}
  c_1 &= a_1 - b_1\\
  c_2 &= a_2 - b_2\\
    &= (a_1 + d) - (b_1r)\\
  c_3 &= a_3 - b_3\\
    &= (a_1 + 2d) - (b_1r^2)\\
  c_4 &= a_4 - b_4\\
    &= (a_1 + 3d) - (b_1r^3)
\end{align*}
And you want to find this value:  $c_5 = a_5-b_5 = (a_1+4d) - (b_1r^4)$.
We have this system:
\begin{align*}
  2 &= a_1 - b_1\\
  8 &= a_1 + d - b_1r\\
  6 &= a_1 + 2d - b_1r^2\\
  20 &= a_1 + 3d - b_1r^3
\end{align*}
It's mildly unpleasant but it's four equations with four variables, and there is indeed a unique solution.  Can you take it from here?

A: I don't think my solution can be calculated within two minutes, but it is pretty straightforward and can be calculated fast too. Let $a_i = x+(i-1)\cdot y$. Since $b_i = a_i-c_i$, we have $$b_2^2 = b_1b_3\implies (x+y-8)^2=(x-2)\cdot(x+2y-6)\implies y^2-12y+52=8x$$
$$b_3^2=b_2b_4 \implies (x+2y-6)^2=(x+y-8)(x+3y-20)\implies y^2+20y-124=-16x$$
Multiplying the first equation by $2$ and adding the second equation, $$3y^2-4y-20=0\implies y=-2,x=10\ \ \text{or} \ \ \ y=\frac{10}{3}, x=\frac{26}{9}$$
The first case is not what we are looking for because it gives $b_2=b_3=0$, so the second case must be true.
Hence, we can get $a_5=x+4y=\frac{146}{9}$. Further, $$b_1=a_1-c_1=\frac{8}{9}, b_2 = a_2-c_2 = -\frac{16}{9}\implies b_5 = \frac{128}{9}$$ Thus, $$c_5=a_5-b_5=\frac{18}{9}=2$$


text:
Q: Laptop get hanged after the 30 minutes of proper startup I have got below laptop configuration:
DELL Insiprion
Windows 7 Home premium
Ram 4 GB
Hard Disk 500 GB
Processor Intel core i3

My Laptop was working fine till this problem occurs, suddenly from last two days, whenever I start my laptop it starts perfectly and after working of 30 minutes or 1 hours it gets hanged and then there is no way to do proper shutdown.
Finally, I have to do Hard Shutdown by pressing the power buttom. I have tried a to restart the laptop and problem is same after using 30 min to 1 hour it get hanged.
I have run CHKDSK but no luck, I though there may be heating issue to I bought cooling pad.
Please suggest how to fix this issue, do I need to reinstall windows 7 or my hard drive/RAM is having problem.
Thanks.

A: You can use CPU-Z for your device temperature about CPU, Mainboard, Ram and etc. I think is your device very hot maybe solve your problem with this way. I think you should find final bios update and install it. If the ways aren't useful, your device hardware has a problem about Ram or VGA.

A: Please list the following details:

*

*List of recently installed updates (past week) and their install dates.

*List of any driver updates you have done.

*List of any delayed start services (in win 7 type (services) in the start menu, an image of two cogs named services should be in the list, you can gather info here).

*List of items in the startup tab of msconfig.

*Version of Antivirus software you are using.

*Download speedfan from http://www.almico.com/forumindex.php and use the s.m.a.r.t. function, click "perform an in-depth online analysis of this hard disk" and then, at the bottom of the page that opens, click on the "link to this report" link, then post that here.

Please also provide a detailed description of the freezing issue, i.e. when it freezes can you move the mouse, does it blue screen, is it terribly slow or completely unresponsive? Do you get artefacts on the screen, do you get artefacts in sound? Any and all additional info is useful for a diagnosis.


text:
Q: Unable to read the selected drop down list value on page load after pressing browser back button Unable to read the selected drop down list value on page load after pressing browser back button.But this happen only during the first function call.
I'll explain in details:
When a page loads initially i have attached an ajax javascript as shown below
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", "_Initialize_Chart();", true);

Below is the javascript AJAX function
    function _Initialize_Chart() {

    var selectedDeptId = $(ddlQueues).val();
    var selectedMonth = $(ddlMonth).val();
    var selectedYear = $(ddlYear).val();
    $.ajax({
        type: "GET",
        url: ajaxCallHandlerUrl,
        data: {
            OpCode: "GetCallAverageMonthlyReportForGraph",
            Params: "DeptId^" + selectedDeptId + "~Month^" + selectedMonth + "~Year^" + selectedYear
        },
        dataType: "xml",
        beforeSend: function () {
            $('#' + lblCallAverageDetails).html('');
            document.getElementById(chartdiv).style.backgroundImage = "url('../images/ajax-loader_new_.gif')";
        },
        success: function (responseString) {
            document.getElementById(chartdiv).style.backgroundImage = "";
            _Load_Chart(responseString);
            _Load_CallAverageGridData();
        },
        error: function (xhr, errorType, exception) {
            var errorMessage = exception || xhr.statusText;
            alert("There was an error Initializing Charts :: " + errorMessage);
        }
    });
}

    function _Load_CallAverageGridData() {
    var selectedDeptId = $(ddlQueues).val();
    var selectedMonth = $(ddlMonth).val();
    var selectedYear = $(ddlYear).val();
    $.ajax({
        type: "GET",
        url: ajaxCallHandlerUrl,
        data: {
            OpCode: "GetCallAverageReportDetail",
            Params: "DeptId^" + selectedDeptId + "~Month^" + selectedMonth + "~Year^" + selectedYear
        },
        dataType: "",
        success: function (responseString) {
            $('#' + lblCallAverageDetails).html(responseString);
        },
        error: function (xhr, errorType, exception) { //Triggered if an error communicating with server
            var errorMessage = exception || xhr.statusText; //If exception null, then default to xhr.statusText
            alert("There was an error Fetching Call Average Data :: " + errorMessage);
        }
    });
}

So this javascript loads the page content which is a graph and a grid.
On clicking the rows in the Grid, it navigates to another page.
Now on pressing the browser back button,the above shown javascript is initially called but the  var selectedMonth = $(ddlMonth).val(); doesn't give me the value of the actually selected value in drop down list.
On Success of first Ajax call, another Ajax call _Load_CallAverageGridData(); is made in which i'm getting the value of var selectedMonth = $(ddlMonth).val(); correctly.
Can any one throw some light why this is happening.

A: your code in page load
 this.Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", "_Initialize_Chart();", true);

is not executed on page load, for it to excecute you need to use url hash function.
for it simply use this
where you click on product/image on page there call onclick javascript function i.e.
function getHashOnBack(valueget)
{
   location.hash = "#backTo=" + $(window).scrollTop();$(document).height();
}

Now, put
$(document).ready(function ()
{
var ab = window.location.hash.substring(1).split("=");
if (ab[0] == "backTo")
{
 // this would be called automatically when back putton pressed and hav #back=1234   etc. // value in url

 $(window).scrollTop(parseInt(ab[1]));
}
}


text:
Q: In prebid.js, How do I set floor price for each bidder while sending request? In DFP I'm able to set line item and key value pair to target bidders and price. In prebid.js how do I send floor price dynamically to each bidders while sending request?
I have searched in prebid site's and got one function pbjs.adserverTargeting() which returns following details during response:

{ "hb_bidder": "appnexus",
   "hb_adid": "7a53a9d3",
   "hb_pb: 1.0" }

Here hb_pb means floor price? If yes how can I sent those details during request?

A: pbjs.adserverTargeting() returns the ad server targeting constructed corresponding to the bids received from the exchanges.
According to the prebid docs only certain bidders allow for sending floor prices through their params, like for example rubicon(http://prebid.org/dev-docs/bidders.html#rubicon) which has an optional param "floor" where you can set the floor price.

A: As far as I know, it depends on the bidders you're working with. Because there are some bidders who don't allow the passing of floor price in the parameters.
If your bidder partners support floor price, then the bidder parameter consists of "bidFloor" i.e. that represents the floor value. Some of the bidders pass floor price via "floorPriceMap"
hb_pb is just a bidder-key that is used to target the line items in the Google Ad Manager. It doesn't mean floor price. If you've integrated Prebid without any header bidding service provider, you can get it from the bidder partners. In case, if you have a provider, then they provide this data which has to be used in the "Targeting section" under Line items settings in Google Ad Manager.

floors: {
                   currency: 'USD',
                   schema: {
                       fields: [ 'mediaType' ]
                   },
                   values: [
                       {key: 'banner', floor: 1.10},
                       {key: 'video', floor: 2.00}
                   ]
               },

If the ad slots are controlled by Google Publisher Tags, then you can take a hint from the following code:

pbjs.setConfig({
    floors: {
        data: {
            currency: 'USD',
            schema: {
                fields: [ 'gptSlot', 'mediaType' ]
            },
            values: [
                {key: '/1111/homepage/top-rect|banner', floor: 0.80},
                {key: '/1111/homepage/top-rect|video', floor: 1.20},
                {key: '/1111/homepage/left-nav|banner', floor: 0.90},
                ...
                {key: '/1111/tech/left-nav|banner', floor: 1.50}
            ],
            default: 0.75
        }
    }
});

Also, you can delay the auction for some time to receive optimal floor price for specific pages or ad units if you're working with a third-party floor provider:

pbjs.setConfig({
    floors: {
        auctionDelay: 100,   // in milliseconds
        endpoint: {
            url: 'https://floorprovider.com/a1001-mysite.json',
            method: 'GET'
        },
        data: {     // default if endpoint doesn't return in time
            currency: 'USD',
            schema: {
                fields: [ 'mediaType' ]
            },
            values: [
                {key: 'banner', floor: 0.80},
                {key: 'video', floor: 1.20}
            ]
        }
    }
});

A: hb_pb means Header Bidding Price Bucket which is different from Price Floor. A price floor is the lowest CPM price a bid will need to meet for each Prebid auction. It is a way of preventing low bids from winning your impressions. It also helps filter cheap ads that may be malicious in nature since bad actors don't spend too much on ads.
There are 2 ways o set a price floor.

*

*From your ad server - If you use GAM as your ad server, you can do this by going into inventory/pricing rules/New unified price rules. The rest is self-explanatory. You can set a price floor for the device, placement, or bidder.

*From the bidder's dashboard - Most bidders let you set a price floor from the dashboard. Those who don't can usually do it for you if you reach out to them.


text:
Q: PSQLException: ERRO: listas de alvos podem ter no máximo 1664 entradas Estou tentando persistir um objeto no banco mais recebo este erro:
WARN:   SQL Error: 0, SQLState: 54000
ERROR:   ERRO: listas de alvos podem ter no máximo 1664 entradas
Advertência:   A system exception occurred during an invocation on EJB OrdemServicoFacade, method: public void br.com.curso.ejb.OrdemServicoFacade.salvar(br.com.curso.entidade.OrdemServico)

Meu Metodo Salvar
     @Override
    public void salvar(OrdemServico entity) {

        if (entity.getVenda().equals(false)) {

            entity = em.merge(entity);

        } else if (entity.getTipoDoc().equals("DINHEIRO")) {

            entity = em.merge(entity);

            geraContasReceber(entity);

        } else if (entity.getTipoDoc().equals("CHEQUE")) {
            entity = em.merge(entity);
            geraCheque(entity);
            if (entity.getEntrada().compareTo(BigDecimal.ZERO) == 1) {

                geraContasRecebidas(entity);

            }

        } else if (entity.getTipoDoc().equals("CARTÃO CRÉDITO")) {
            entity = em.merge(entity);
            geraCartaoCredito(entity);

            if (entity.getEntrada().compareTo(BigDecimal.ZERO) == 1) {

                geraContasRecebidas(entity);

            }
            //CONTROLE CARTÃO CREDITO
        } else if (entity.getTipoDoc().equals("CARTÃO DÉBITO")) {
            entity = em.merge(entity);
            geraCartaoDebito(entity);
            if (entity.getEntrada().compareTo(BigDecimal.ZERO) == 1) {

                geraContasRecebidas(entity);

            }
            //CONTROLE CARTÃO DÉBITO

        } else if (entity.getTipoDoc().equals("CREDIÁRIO")) {
            entity = em.merge(entity);
            geraContasReceber(entity);
            if (entity.getEntrada().compareTo(BigDecimal.ZERO) == 1) {

                geraContasRecebidas(entity);

            }
            //CONTROLE CARTÃO DÉBITO

        }
    }

Minha Entidade (Atributos)
        private static final long serialVersionUID = 1L;
    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column
    private Long id;
    @Column
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dtVenda = new Date();
    @Column
    private String nomeFun;
    @Column
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataVencimento = new Date();
    @Column
    private BigDecimal total = BigDecimal.ZERO;
    @Column
    private BigDecimal entrada = BigDecimal.ZERO;
    @Column
    private BigDecimal valorHora = BigDecimal.ZERO;
    @Column
    private BigDecimal totalDesc = BigDecimal.ZERO;
    @Column
    private BigDecimal totalDescEn = BigDecimal.ZERO;
    @Column
    private BigDecimal totalHoras = BigDecimal.ZERO;
    @Column
    private BigDecimal acrescimo = BigDecimal.ZERO;
    @Column
    private BigDecimal desconto = BigDecimal.ZERO;
    @Column
    private BigDecimal valorDesconto = BigDecimal.ZERO;
    @Column
    private Boolean venda = Boolean.FALSE;
    @Column
    private String valida;
    private String recebido;
    private String recebido2;
    private String recebido3;
    @Column
    private String localServico = "INTERNO";
    @ManyToOne
    private Bandeira bandeira;
    @Column
    private String numeroDoc;
    @Column
    private String modelo;
    @Column
    private String veiculo;
    private String contato;
    private String veiculo2;
    private String veiculo3;
    private String placa;
    private String placa2;
    private String placa3;
    private String obsVeiculo;
    @Column(length = 800)
    private String solicitacaoCliente;
    @Column
    @CPF
    private String cpfNota;
    @Column
    private String cnpjNota;
    @Column
    private String numeroSerie;
    @Column
    private String numeroHorasMaquinas;
    @Column
    private String numeroSerieMotor;
    @Column
    private String numeroSerieTranmmissao;
    @Column
    private String tipoServico;
    @Column
    private String saiuDe;
    private String chegouEm;
    @Temporal(javax.persistence.TemporalType.TIME)
    private Date horaSaida = new Date();
    @Temporal(javax.persistence.TemporalType.TIME)
    private Date horaChegada = new Date();
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dtIn;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dtFim;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dtPrevisao;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date horaViagem;

    private BigDecimal inicioServico = BigDecimal.ZERO;
    @Column(length = 600)
    private String descricaoProblema;
    @Column(length = 800)
    private String solucaoProblema;
    private BigDecimal terminoServico = BigDecimal.ZERO;
    private BigDecimal horaDeTrabalho = BigDecimal.ZERO;
    private String idFrota;
    private String kmInicial;
    private String kmFinal;
    @Column
    @Min(value = 1)
    private Integer qtdParcela = 1;
    @Column
    private String tipoPagamento = "A VISTA";
    @Column(length = 600)
    private String obs = "".toUpperCase();
    private String obs2 = "".toUpperCase();
    private String obs3 = "".toUpperCase();
    private String tipoDoc;
    @Column
    private Boolean fiscal = Boolean.FALSE;
    @ManyToOne
    private Pessoa pessoa;
    @ManyToOne
    private Funcionario funcionario;
    @ManyToOne
    private TipoDeManutencao tipoDeManutencao;
    @ManyToOne
    private SituacaoOs situacaoOs;
    @Column(columnDefinition = "TEXT")
    private String xml;
    private Boolean naoTransmitida;
    @ManyToOne
    private Banco banco;
    private String modeloNota;
    @OneToMany(cascade = CascadeType.ALL,
            fetch = FetchType.LAZY, orphanRemoval = true,
            mappedBy = "ordemServico")
    private List<ItemServico> itensServicos = new ArrayList<>();
    @OneToMany(cascade = CascadeType.ALL,
            fetch = FetchType.LAZY, orphanRemoval = true,
            mappedBy = "ordemServico")
    private List<ItemEquipamentos> itensEquipamentos = new ArrayList<>();
    @OneToMany(cascade = CascadeType.ALL,
            fetch = FetchType.LAZY,
            mappedBy = "ordemServico",
            orphanRemoval = true)
    private List<Parcela> parcelas;
    @ManyToOne
    private Empresa empresa;

    @Column(length = 900)
    private String retornoFiscal;
    @Column
    private String codNfce;
    @Column
    private String chaveNfce;
    @Column
    private String chaveNfe;
    @Column
    private String codNfe;
    @Column
    private Boolean fiscalCancelado;
    @Column
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date dataCancelamentoFiscal;
    @Column
    private String situacaoConsulta;
    @Column
    private String statusAux;

A: Este erro ocorre porque você está retornando muitas colunas ao mesmo tempo e batendo no limite do próprio PostgreSQL.
Este caso é bem típico usando Hibernate quando temos um mapeamento de entidade abusando da estratégia EAGER, carregando outras entidades junto com ela a cada consulta da mesma. Isto pode ser corrigido, principalmente, configurando os mapeamentos @OneToOne e @ManyToOne para LAZY:
@ManyToOne(fetch = FetchType.LAZY)
private Pessoa pessoa;

Na teoria até seria possível aumentar este limite de 1664 no PostgreSQL, mas parece que não é possível fazer isto hoje e não seria uma boa recomendação de qualquer forma.


text:
Q: Apriori Error in R I am working on using the apriori algorithm to create groupings/market baskets of my items. Below is summary of this dataset after converting it to a transaction class type.
I think my error has to do with the parameters being chosen in the apriori function. Any insights would be great.
summary(groceries)

transactions as itemMatrix in sparse format with
 57 rows (elements/itemsets/transactions) and
 817 columns (items) and a density of 0.03135133

most frequent items:
                  A                   B                   C                   D             (Other)
                 13                  13                  13                  12                  12                1397

element (itemset/transaction) length distribution:
sizes
  3   4   5   6   7   8   9  10  13  14  16  17  18  22  29  30  32  33  34  40  43  45  55  77  86 111 118 353
  7   4   4   4   3   4   4   3   1   3   2   1   1   1   1   2   1   1   1   1   1   1   1   1   1   1   1   1

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
   3.00    5.00    9.00   25.61   29.00  353.00

includes extended item information - examples:
  labels
1      E
2      F
3      G

groceryrules<-apriori(groceries,
                      parameter = list(support = 0.15,
                      confidence = 0.05,
                      minlen = 2))

When running this it works great but when I try lowering the support since not too many recommendations are showing up, it doesn't work.
I tried:
groceryrules<-apriori(groceries,
                      parameter = list(support = 0.14,
                      confidence = 0.05,
                      minlen = 2))

Apriori

Parameter specification:
 confidence minval smax arem  aval originalSupport maxtime support minlen maxlen target   ext
       0.05    0.1    1 none FALSE            TRUE       5    0.14      2     10  rules FALSE

Algorithmic control:
 filter tree heap memopt load sort verbose
    0.1 TRUE TRUE  FALSE TRUE    2    TRUE

Absolute minimum support count: 7

set item appearances ...[0 item(s)] done [0.00s].
set transactions ...[817 item(s), 57 transaction(s)] done [0.00s].
sorting and recoding items ... [14 item(s)] done [0.00s].
creating transaction tree ... done [0.00s].
checking subsets of size 1 2 3 4 5 done [0.00s].
writing ... [90 rule(s)] done [0.00s].
creating S4 object  ... done [0.00s].
Warning message:
In apriori(groceries, parameter = list(support = 0.14, confidence = 0.05,  :
  Mining stopped (maxlen reached). Only patterns up to a length of 5 returned!

Why would changing the support but this little of an amount cause an error?

A:   Mining stopped (maxlen reached). Only patterns up to a length of 5 returned!

minlen and maxlen are to blame. you stated minlen =2 in your parameter list. you did not specify maxlen so the algo took the default value of 10 (check out in the algo output)
however, maxtime (which you did not specify either and also was used with the default value of 5 second) means that if calculating a rule of length n, the calculation will take more than 5 seconds - then the algo stops with a warning like you got - stating - i only got to maxlen=5 before the maxtime rule was breached.
checking subsets of size 1 2 3 4 5 done [0.00s].

checking subsets of size 6 - will take too long so was skipped......
so - either change maxtime (add to the parameter list same as minlen: maxtime=10 or maxtime=20 etc) or as in most cases - ignore the warning. this is not an error.
is it really important for you to find rules longer than 5 items? I think not. you did not specify this it is only a default value


text:
Q: Plot an arbitrary data column vs another column Please consider the following list:
v1v2 = {{-10, 8.04, 8.046, 0.006}, {-9, 9.021`,
7.37`, -1.6510000000000007`}, {-8, 6.756`, 8.527`,
1.770999999999999`}, {-7, 8.058`, 6.178`, -1.88`}, {-6, 5.625`,
7.635`, 2.01`}, {-5, 5.326`, 7.626`, 2.3000000000000007`}, {-4,
5.013`, 7.5`, 2.487`}, {-3, 4.68`, 7.319`,
2.6390000000000002`}, {-2, 7.121`, 7.19`,
0.06899999999999995`}, {-1, 6.914`, 6.919`,
0.004999999999999893`}, {0, 3.504`, 5.468`, 1.964`}, {1, 3.08`,
4.831`, 1.7510000000000003`}, {2, 2.284`, 4.396`, 2.112`}, {3,
1.928`, 4.201`, 2.2729999999999997`}, {4, 1.928`, 4.201`,
2.2729999999999997`}, {5, 1.596`, 4.018`,
2.4219999999999997`}, {6, 1.286`, 3.847`, 2.561`}, {0.995`,
3.686`, 2.691`}, {0.724`, 3.531`, 2.8070000000000004`}, {0.469`,
3.387`, 2.918`}, {0.23`, 3.249`, 3.019`}};

How can I plot an arbitrary column versus another arbitrary column. For example the third column, vs the first column: {{-10,8.046},{-9,7.37},{-8,8.527}...}

A: Here is a Dataset approach:
ds = Dataset[v1v2];

ds[ListLinePlot, {1, 3}]

A: (* 3rd against first column *)

data13 = Transpose[{v1v2[[All, 1]], v1v2[[All, 3]]}];

ListLinePlot[data13, FrameLabel -> {"col 1", "col 3"}, Frame -> True,
 Epilog -> {PointSize[Large], Red, Point[data]}]

A: Edit
Here a function that will do it.
plotFrom2Col[data_, xCol_, yCol_, opts : OptionsPattern[]] :=
  Module[{pts},
    pts = Extract[#, {{xCol}, {yCol}}] & /@ data;
    ListLinePlot[pts,
      Epilog -> {Red, AbsolutePointSize[5], Point[pts]},
      opts]]

Then with
data =
  {{-10, 8.04, 8.046, 0.006}, {-9, 9.021, 7.37, -1.65}, {-8, 6.756, 8.527, 1.7701},
   {-7, 8.058, 6.178, -1.88}, {-6, 5.625, 7.635, 2.01}, {-5, 5.326, 7.626, 2.3},
   {-4, 5.013, 7.5, 2.487}, {-3, 4.68, 7.319, 2.639,}, {-2, 7.121, 7.19, 0.069},
   {-1, 6.914, 6.919, 0.005}, {0, 3.504, 5.468, 1.964}, {1, 3.08, 4.831, 1.751},
   {2, 2.284, 4.396, 2.112}, {3, 1.928, 4.201, 2.273}, {4, 1.928, 4.201, 2.273},
   {5, 1.596, 4.018, 2.422}, {6, 1.286, 3.847, 2.561}, {7, 0.995, 3.686, 2.691},
   {8, 0.724, 3.531, 2.807}, {9, 0.469, 3.387, 2.918}, {10, 0.23, 3.249, 3.019}};

plotFrom2Col[data, 1, 3]

plotFrom2Col accepts plot options
plotFrom2Col[data, 3, 2, PlotStyle -> Dashed, Frame -> True]

Update
I got to thinking it would be a good idea to make showing the data points optional rather than mandatory as it is above. As usual there are multiple ways to modify plotFrom2Col to provide this additional capability. I experimented with two different ways and finally decided that the following is the better of the two.
Clear[plotFrom2Col]
plotFrom2Col[data_, xCol_, yCol_, showPts : (True | False) : True,
             opts : OptionsPattern[]] :=
  Module[{pts, opseq},
    pts = Extract[#, {{xCol}, {yCol}}] & /@ data;
    opseq =
      If[showPts,
       {Epilog -> {Red, AbsolutePointSize[5], Point[pts]}, opts},
       {opts}];
   ListLinePlot[pts, opseq]]

Default usage.
plotFrom2Col[data, 1, 3]

ListLinePlot options may be given.
plotFrom2Col[data, 1, 3, PlotStyle -> Dashed]

The default epilog may be suppressed.
plotFrom2Col[data, 1, 3, False, PlotStyle -> Dashed]

The default epilog may be overridden.
plotFrom2Col[data, 1, 3, False,
  PlotStyle -> Dashed,
  Epilog -> {Text["Column 3 plotted\nagainst column 1", Scaled[{.2, .3}]]}]

The data points can be shown without the plot.
plotFrom2Col[data, 1, 3, PlotStyle -> None, Frame -> True, Axes -> False]

A: You can use Apply to extract the columns you want (here, 3 and 1) and place them a new list that can be entered as input to ListLinePlot.
data13 = Apply[{#1, #3} &, v1v2, 1];

ListLinePlot[data13, FrameLabel -> {"col 1", "col 3"}, Frame -> True,
 Epilog -> {PointSize[Large], Red, Point[data13]}]

This is easily modified to work with rows:
data13r = Apply[{#1, #3} &, v1v2] // Transpose;

ListLinePlot[data13r, FrameLabel -> {"row 1", "row 3"}, Frame -> True,
  Epilog -> {PointSize[Large], Red, Point[data13r]}]


text:
Q: iPad crashes when Simulator doesn't when loading a view my app crashes on iPad when I open a new view even though in the simulator it works like a charm.
Any help is strongly appreciated!
Thanks in advance
Console Output:
2012-07-18 10:32:19.783 Coverdale[3484:707] *** Terminating app due to uncaught exception  'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 4 beyond bounds [0 .. 3]'

First throw call stack:
(0x3757688f 0x315eb259 0x374bf9db 0x37745 0x35c3f 0x306e3c8b 0x30708481 0x306ccbd5 0x3078f359 0x306d53b5 0x306d53d1 0x306d5263 0x3078f31f 0x307446cb 0x3074400f 0x3078dc05 0x3078c367 0x307e76a7 0x2c4fb 0x3075c93d 0x307d6627 0x33093933 0x3754aa33 0x3754a699 0x3754926f 0x374cc4a5 0x374cc36d 0x376c5439 0x306d8cd5 0x22103 0x220a8)
terminate called throwing an exception(lldb)

Crash Report
Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x3757688f __exceptionPreprocess + 163
1   libobjc.A.dylib                 0x315eb259 objc_exception_throw + 33
2   CoreFoundation                  0x374bf9db -[__NSArrayM objectAtIndex:] + 271
3   Coverdale                       0x00092745 -[PreparationViewController setDetails:newFile:] (PreparationViewController.m:376)
4   Coverdale                       0x00090c3f -[PreparationViewController viewDidLoad] (PreparationViewController.m:70)
5   UIKit                           0x306e3c8b -[UIViewController view] + 167
6   UIKit                           0x30708481 -[UIViewController nextResponder] + 21
7   UIKit                           0x306ccbd5 -[UIResponder _containsResponder:] + 37
8   UIKit                           0x3078f359 -[UINavigationController defaultFirstResponder] + 57
9   UIKit                           0x306d53b5 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 25
10  UIKit                           0x306d53d1 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 53
11  UIKit                           0x306d5263 -[UIResponder(Internal) _promoteDeepestDefaultFirstResponder] + 31
12  UIKit                           0x3078f31f -[UIWindowController transitionViewDidStart:] + 83
13  UIKit                           0x307446cb -[UITransitionView _didStartTransition] + 71
14  UIKit                           0x3074400f -[UITransitionView transition:fromView:toView:] + 999
15  UIKit                           0x3078dc05 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 4937
16  UIKit                           0x3078c367 -[UIViewController presentViewController:withTransition:completion:] + 3123
17  UIKit                           0x307e76a7 -[UIViewController presentModalViewController:animated:] + 31
18  Coverdale                       0x000874fb -[IntroTableViewController tableView:didSelectRowAtIndexPath:] (IntroTableViewController.m:498)
19  UIKit                           0x3075c93d -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 945
20  UIKit                           0x307d6627 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 159
21  Foundation                      0x33093933 __NSFireDelayedPerform + 415
22  CoreFoundation                  0x3754aa33 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 15
23  CoreFoundation                  0x3754a699 __CFRunLoopDoTimer + 365
24  CoreFoundation                  0x3754926f __CFRunLoopRun + 1207
25  CoreFoundation                  0x374cc4a5 CFRunLoopRunSpecific + 301
26  CoreFoundation                  0x374cc36d CFRunLoopRunInMode + 105
27  GraphicsServices                0x376c5439 GSEventRunModal + 137
28  UIKit                           0x306d8cd5 UIApplicationMain + 1081
29  Coverdale                       0x0007d103 main (main.m:17)
30  Coverdale                       0x0007d0a8 start + 40

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x3291b32c __pthread_kill + 8
1   libsystem_c.dylib               0x34c90208 pthread_kill + 48
2   libsystem_c.dylib               0x34c89298 abort + 88
3   libc++abi.dylib                 0x3229ef64 abort_message + 40
4   libc++abi.dylib                 0x3229c346 _ZL17default_terminatev + 18
5   libobjc.A.dylib                 0x315eb350 _objc_terminate + 140
6   libc++abi.dylib                 0x3229c3be _ZL19safe_handler_callerPFvvE + 70
7   libc++abi.dylib                 0x3229c44a std::terminate() + 14
8   libc++abi.dylib                 0x3229d81e __cxa_rethrow + 82
9   libobjc.A.dylib                 0x315eb2a2 objc_exception_rethrow + 6
10  CoreFoundation                  0x374cc506 CFRunLoopRunSpecific + 398
11  CoreFoundation                  0x374cc366 CFRunLoopRunInMode + 98
12  GraphicsServices                0x376c5432 GSEventRunModal + 130
13  UIKit                           0x306d8cce UIApplicationMain + 1074
14  Coverdale                       0x0007d0fc main (main.m:17)
15  Coverdale                       0x0007d0a0 start + 32

A: I deleted the App on the iPad and run it again.
It looks like that an array generated from a text file which i am reading out with componentsSeparatedByString: had less entries than i was accessing.


text:
Q: generate public key from pk8 file I have a pk8 file with private key (ecc256) , I need to get the public key.
I tried to look over the web, and i found some openssl forums discussing pem files
I didnt find about pk8

A: found a way:
first convert .pk8 to pem :
openssl pkcs8 -in keys.pk8 -inform DER  -out prv.pem

then, convert prv.pem to pub.pem:
openssl ec -in prv.pem -pubout -out pub.pem


text:
Q: How to draw vertical text in Windows GUI? I need to draw a column of vertical text (in Japanese language - it is drawn top-to-bottom instead of left-to-right) in my native C++ Win32 GUI application. I've looked through MSDN and only found how to draw right-to-left text.
How do I output top-to-bottom text except drawing each character separately?

A: The straight Win32 API has no way to draw (unrotated) vertical text (with an arbitrary font) in that way except 1 character at at time.
You can do more complex text output with GDI+
But that probably isn't what you want either, since the text will be vertical, but the characters will also be rotated.
Similarly, you can use CreateFont with an lfEscapement value of 900 or 2700 to get rotated text, but this will rotate everything. So that doesn't help either.
To do Japanese Top to Bottom drawing, you want the characters to be unrotated, but the placment of each character to advance in Y but not in X.  Windows has no API that does this for all fonts. (you can do right-to-left and left-to-right, but not top-to-bottom).
In theory creating a font with an Orientation of 900 and an escapement of 2700 would do what you want, but it appears that if you set the escapement, then the orientation is ignored for most fonts. It's possible that for Japanese fonts, this will work differently. It's worth spending some time to play with. (see the addendum for more information on this)
I think your best bet is a probably a loop drawing one character at a time with ExtTextOut which gives you full control over the placement of each character.
If you use ETO_OPAQUE to draw the first character in a column, and not with all of the others, then you will be permitted to kern the characters vertically if you need to.
Addendum
Roygbiv points to an interesting article that says that fonts whose names begin with an @ behave differently then other fonts when you use CreateFont a font with an lfEscapement value of 2700, These special fonts produce upright characters while still advancing down the page.  So while there is no way to do what you want for arbitrary fonts, you may be able to get it working using certain fonts.
Options for Displaying Text
Out of curiosity, i wrote a small console app to enum fonts and list the names.  My Windows Server 2003 machine has not fonts with names beginning with @.  But my Windows 7 machine has a few.  All seem to be Chinese fonts though, I see no Japanese fonts in the default Windows 7 Ultimate install.

A: The correct answer is:
There are three methods to do this:

*

*Using the Edit or RichEdit controls to render your text

*Using the Uniscribe API

*Using the TextOut function with a font face name that begins with an at sign (@).

Here is an article that discusses some of these approaches.

Fortunately, with Win32 you do not need to write code to rotate characters. To display text vertically on Windows 2000 and Windows XP, enumerate the available fonts as usual, and select a font whose font face name begins with the at sign (@). Then create a LOGFONT structure, setting both the escapement and the orientation to 270 degrees. Calls to TextOut are the same as for horizontal text.

A: In Win32, use the lfEscapement member of a LOGFONT structure to define the rotation of a font:
LOGFONT LogFont

LogFont.lfEscapement = 900;  // 90 degreees rotated text
... // Many more initializations
HFONT newFont = CreateFontIndirect(LogFont);
SelectObject(hdc, newFont);

char tx[255];
strcpy(tx, "vertical text");
TextOut(hdc, x, y, tx, strlen(tx)); // draw a vertical font

For More Information see the online Help of LOGFONT structure and of the CreateFontIndirect Function

A: HFONT gui_font  =   CreateFont( -MulDiv( 9, GetDeviceCaps( GetDC( hWnd ), LOGPIXELSY ), 72 ),
                        0,
                        900,  // here
                        0,
                        FW_THIN, 0, 0, 0,
                        DEFAULT_CHARSET,
                        OUT_DEFAULT_PRECIS,
                        CLIP_DEFAULT_PRECIS,
                        DEFAULT_QUALITY, FF_MODERN | FIXED_PITCH,
                        L"Segoe UI" );

A: Using lfEscapement (and if necessary lfOrientation) is superior in many ways to making the rectangle minimally wide (for instance: the dutch word 'wij' would have the 'i' and 'j' next to each other, because their combined width is less than the 'w'), or inserting a newline after each character.

A: The method this library uses sounds slow, but if do want it, it appears source code is provided:
http://www.ucancode.net/faq/CDC-DrawText-Drawing-Vertical-Text.htm
You may also find this discussion useful - http://www.eggheadcafe.com/forumarchives/win32programmergdi/Aug2005/post23542233.asp - apparently you need a vertical font (one beginning with @) and the API will take care of the rest.

A: As a quick hack type of answer, what happens if you use a standard control (CEdit for instance) and insert a new-line after every character typed?

A: Just an idea:
Did you try using DrawText or DrawTextEx using a very narrow rectangle that just fits the widest character?


text:
Q: ListView Item binding does not work I'm new to asp.net(webforms). I follow this tutorial --> http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/ui_and_navigation
in the Site.Master I've added the following code as described in the tutorial:

        <asp:ListView ID="categoryList"
            ItemType="VanchoWorks.Models.Category"
            runat="server"
            SelectionMethod="GetCategories" >
            <ItemTemplate>

                    <a href="/ProductList.aspx?id=<%#: Item.CategoryID %>">
                        <%#: Item.CategoryName %>

            </ItemTemplate>
            <ItemSeparatorTemplate> - </ItemSeparatorTemplate>
        </asp:ListView>

in the code-behind(Site.Master.cs)
    public IQueryable<Category> GetCategories()
    {
        var db = new ProductContext();
        IQueryable<Category> query = db.Categories;
        return query;
    }

But no sign of ListView is shown when I run the application. I added breakpoint in GetCategories() line 1, but it does not stop there, which makes me think I've not setup the SelectionMethod very well. Why is that?

A: Change SelectionMethod="GetCategories" to SelectMethod="GetCategories"

A: Bind the listview Like this
public  GetCategories()
    {
        var db = new ProductContext();
        IQueryable<Category> query = db.Categories;

        ListView1.DataSource=query;
        ListView1.DataBind();
    }

call this method in page load Remove  SelectionMethod="GetCategories"  from html other vise it will show errors.
Hope it will help you


text:
Q: Is there a simple way to know which Tensorflow ops have a registered GPU kernel? I have been trying to optimize some Tensorflow code that was pretty memory inefficient (use of large dense tensors containing very sparse information), and would thus limit batch size and scalability, by trying to make use of SparseTensors.
After some struggle I finally come up with a decent solution with satisfactory speedup on CPU and very low memory usage, and when the time comes to use a GPU I realize that the previous memory inefficient is orders of magnitude faster...
Using tensorboard profiling I've discovered that two of the operations I have used in my ""optimized"" version only run on CPU (namely UniqueV2 and sparse_dense_matmul), but I could not see any hint of that in the documentation.
The only related piece of documentation states:

If a TensorFlow operation has no corresponding GPU implementation,
then the operation falls back to the CPU device. For example, since
tf.cast only has a CPU kernel, on a system with devices CPU:0 and
GPU:0, the CPU:0 device is selected to run tf.cast, even if requested
to run on the GPU:0 device.

In turn there is nothing in the tf.cast documentation hinting that the op has no GPU kernel.
Thus, is there a simple way to know whether a TF ops has a registered GPU kernel, without having to use a GPU to find it out?
The custom ops guide suggest that this could be seen by looking at the ops C files, but this seems a rather cumbersome way to do it...
I'm using TF v2.8
Thanks!