text:
Q: Can X-ray diffraction be applied to liquids, gasses or non-crystalline materials? I learned that X-ray diffraction happens due to the periodic arrangement of atoms in a crystalline material, so can X-ray diffraction studies be done on liquids and non-crystalline materials?

A: (I'm going to focus on protein crystallography here)
Yes, in fact Small-angle X-ray Scattering, in which (usually) proteins are not in the crystalline state, is used extensively in biochemistry, molecular biology, etc. to determine the size and shape of biomolecules, and to capture large structural changes for which the atomic-scale picture is not necessary.

Additionally, depending on your definition of "liquid", normal X-ray protein crystallography might still interest you, as the scattering of X-rays through imperfect crystals and amorphous solids is an incredibly ripe field for study (it's the field I study).
Protein crystals are by no means actually periodic, they are dynamic systems that are not-identical from unit cell to unit cell, and experience correlated motions that are by no means captured by small, independent, Gaussian (B-factor/thermal factor) motion.
The fact that proteins in the crystalline state are dynamic, and exhibit correlations within and across unit-cell boundaries leads to "continuous" or "diffuse" scattering, which is the cloudy, loosely structured background radiation that accompanies the Bragg peaks in studies which use detectors sensitive enough to measure it.
(Shameless plug of a truly stunning paper on ALL OF THIS here before you get bored)
This diffuse scattering can (in principle) be analyzed to capture information about the dynamics of the protein under study (rather than just the average electron density). In fact, small-molecule X-ray crystallography has developed a robust understanding of diffuse scattering.
One of the most commonly used models to try to understand diffuse scattering in protein crystallography is called the "Liquid-like motions model", proposed by Caspar and Clarage in 1988, which assumed that correlations in electron density fluctuations decay exponentially with distance (think water molecules -- close water molecules move together, water molecules far apart don't really have any relationship to each other at all). This model does remarkably well for how simple it is, but it is definitely not the full story.
Our understanding of diffuse scattering is still very much in its nascency.

A: Yes. Even single molecule imaging is possible and will be practical in the near future.
More precisely: at modern x-ray free electron laser facilities it is possible to image single particles such as molecules without the need to crystalize them. Currently, there are still many technical limitations, but rapid progress is being made.
See for example HN Chapman, Annual review of biochemistry 88, 35-58 (2019) for a review. From the abstract (emphasis mine):

X-ray free-electron lasers provide femtosecond-duration pulses of hard X-rays with a peak brightness approximately one billion times greater than is available at synchrotron radiation facilities. One motivation for the development of such X-ray sources was the proposal to obtain structures of macromolecules, macromolecular complexes, and virus particles, without the need for crystallization, through diffraction measurements of single noncrystalline objects. Initial explorations of this idea and of outrunning radiation damage with femtosecond pulses led to the development of serial crystallography and the ability to obtain high-resolution structures of small crystals without the need for cryogenic cooling. This technique allows the understanding of conformational dynamics and enzymatics and the resolution of intermediate states in reactions over timescales of 100 fs to minutes. The promise of more photons per atom recorded in a diffraction pattern than electrons per atom contributing to an electron micrograph may enable diffraction measurements of single molecules, although challenges remain.


text:
Q: Kcheckpass errors? Running Fedora 33 with Plasma. I've noticed these repeating errors in journalctl for yesterday.
Mar 11 16:11:43 lap.localdomain kcheckpass[159270]: pam_unix(kde:auth): auth could not identify password for [name]
Mar 11 16:11:43 lap.localdomain kcheckpass[159270]: pam_unix(kde:auth): conversation failed

If i lock the laptop now though, then unlock, these errors are not repeated today.
Any ideas please on what they maybe caused by?
Thanks

redpajama_set_name: RedPajamaStackExchange


text:
Q: Save telegram bot logs in a text file A telegram bot I created in python uses pyTelegramBotAPI API.
To review logs, I was advised to use this line:
logger = telebot.logger

Now I can see my logs only in the terminal I'm running the bot with and when I close this terminal, the log data is lost.
How can I save this logs to a text file?

A: From what I read in documentation here, it should be possible to use Python's handler to logger.
Have you tried something like this
import logging
logger = telebot.logger
telebot.logger.basicConfig(filename='filename.log', level=logging.DEBUG,
                    format=' %(asctime)s - %(levelname)s - %(message)s')


text:
Q: How can I persist cached tables in memory after the program ends (Apache Spark)? I'm new to Apache Spark and have a simple question about DataFrame caching.
When I cached a DataFrame in memory using df.cache() in python, I found that the data is removed after the program terminates.
Can I keep the cached data in memory so that I can access the data for the next run without doing df.cache() again?

A: The cache used with cache() is tied to the current spark context; its purpose is to prevent having to recalculate some intermediate results in the current application multiple times. If the context gets closed, the cache is gone. Nor can you share the cache between different running Spark contexts.
To be able to reuse the data in a different context, you will have to save it to a file system. If you prefer the results to be in memory (or have a good chance of being in memory when you try to reload them) you can look at using Tachyon.

A: If you are talking about saving the RDD into disk , use any of the following -

The link is for pyspark , same is available for Java/ Scala as well-#
https://spark.apache.org/docs/latest/api/python/pyspark.sql.html
If you were not talking about disk , then cache() is already doing the job of saving the same in memory


text:
Q: how to initialization script C++ before windows shutdown i have no ideal for initialization code c++ before windows shutdown. For protect algorithm of my code when running. Any ideal here?

A: I am not sorry to report you cannot do this reliably. You can handle WM_QUERYENDSESSION or WM_ENDSESSION Windows messages, but that really traps logoff not shutdown. Alternately you could try a Windows service and react to the stop signal. But that is exactly that, your service being stopped.
HOWEVER; none of this happens reliably. If you have some defenses best broken by the shutdown code not running, somebody who wants to break them will just power the machine off. If I thought you were writing software that needed to be fault tolerant I would now advise you on crash-only software.
To make a backing store that can survive being powered off without being corrupted, the cheapest way is to use sqlite.

A: I think you should create an object of your own class and write something inside the destructor (or ~YourClass()).


text:
Q: TimeZoneInfo in different language on RDP In the source code of our app we have got following line:
pcTimezone = System.TimeZoneInfo.Local.Id;
When I work locally on my office PC (Windows 10 in English, regional settings: English (USA)) everything is fine and pcTimezone is set to "Central European Standard Time", but when I am connected from home by RDP System.TimeZoneInfo.Local.Id returns

"Środkowoeuropejski Czas stand"

which is in Polish.
This leads to error

Time zone ID "Środkowoeuropejski Czas stand" was not found on the local computer

on line TimeZoneInfo.FindSystemTimeZoneById(pcTimezone)
I tried setting everything what I could to English on my home computer (system language is unchangeable so it is Polish still) and it did not help.
Is there any way to force value of System.TimeZoneInfo.Local?
Or maybe you are able to set RDP not to override it from outer computer?

A: It turned out that for a some strange reason, when connected via RDP, a Time zone of the office PC got set to the earliest possible: (UTC-12:00) International Date Line West.
All I had to do was setting this value to the correct one, and the problem was gone.


text:
Q: How to remove text after alpha characters in python? So I have strings like:
FirstName LastName - SomeText
FirstName LastName / SomeMoreText

I was wondering how to remove everything after a character that is not in the alphabet?
Thanks

A: Try something like this:
a_string = "ab-cd"

split_string = a_string.split("-", 1)

substring = split_string[0]

print(substring)

if you need specific answer, then you've to give more description

A: sentense="abcdώdfgdfg"
result=""
validchars="abcdefghijklmnopqrstuvwxyz"
validchars+=validchars.upper()

for letter in sentense:
    if letter in validchars:
        result=result+letter
    else:
        break
print(result)

it checks all letter from the sentense and if is in valid letters it is added to resul else it stops and displays the final result

A: This should work - just add whatever chars you want to chars:
txt = "some?text"
chars = ["?","!","&","-","+","#",")","(","[","]"]
for char in chars:
    if char in txt:
        splittxt = txt.split(char)[0]

This builds off of https://stackoverflow.com/a/68041566/16263236, but adds support for more chars.

A: This is a perfect use case for Regex. Python's re library provides a .split command, which does exactly what you want.
The regex string [^a-zA-Z\s] matches everything that isn't alphabet characters (a-zA-Z) or whitespace (\s) by using the negate character ^. Then, you pass maxsplit=1 to the split command since you only want the first group resulting from the split.
import re

data = [
    "FirstName LastName - SomeText",
    "FirstName LastName / SomeMoreText"
]

for string in data:
    split = re.split(r"[^a-zA-Z\s]", string, maxsplit=1)
    result = split[0]
    print(result)


text:
Q: Why can the Ruby File#read or File#readlines only be used once? Why can Ruby's File#read and File#readlines only be used once?
For example:
txt = File.open "test.txt"
puts txt.read  # returns the content
puts txt.read  # returns ""

A: When you call File.open you are opening an I/O stream to the file. Internally, the stream has a "cursor," which represents what part of it you read from last. When you call File#read with no length argument, it reads from the cursor (which starts at the beginning of the file when you open it) until the end of the stream, i.e. the end of the file. In so doing, the cursor is also moved to the end of the file. If you call read again, then, the cursor is still at the end of the file, and since there is nothing more for it to read it returns nothing ("").
If you need to read the file a second time you can move the cursor back to the beginning of the stream using File#rewind.


text:
Q: Creating an asynchronous method that contains a linq query I have a .Net Core 2.2 web app that uses Entity Framework.
In the project, I have this controller that uses Linq to join two tables, and then uses Select to create a node model, like this:
    [HttpGet("GameDownloadLinks/{libraryId}")]
    public async Task<ActionResult<IEnumerable<GameDownloadLinks>>> GetGameLinksForlibraryAsync(Guid libraryID)
    {
        var libraryGameLinks =  (from gk in _context.GameLinks
                                   join gl in _context.GameList on gk.GameId equals gl.GameId
                                   where gl.libraryId == libraryId
                                   select new GameDownloadLinks
                                   {
                                       LibraryId = gl.libraryId,
                                       LinkText = gk.LinkText,
                                       Price = gk.Price,
                                       GameId = gl.GameId
                                   }).ToList();

        var asyncGameDownloadLinks = await Task.WhenAll(libraryGameLinks).toListAsync();
        return asyncGameDownloadLinks;
    }

I'm trying to make this method asynchronous, but I get this error:
cannot convert from 'System.Collections.Generic.List<Models.GameDownloadLinks>'  to 'System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task>'

Some of the answers I found for similar questions indicated this is most likely due to a missing async keyword in the method declaration, but I have included that in mine.
Is there anyway to make this work?
Thanks!

A: try this
  [HttpGet("GameDownloadLinks/{libraryId}")]
    public async Task<ActionResult<IEnumerable<GameDownloadLinks>>> GetGameLinksForlibraryAsync(Guid libraryID)
    {
        var libraryGameLinks = await (from gk in _context.GameLinks
                                   join gl in _context.GameList on gk.GameId equals gl.GameId
                                   where gl.libraryId == libraryId
                                   select new GameDownloadLinks
                                   {
                                       LibraryId = gl.libraryId,
                                       LinkText = gk.LinkText,
                                       Price = gk.Price,
                                       GameId = gl.GameId
                                   }).ToListAsync();

       // var asyncGameDownloadLinks = await Task.WhenAll(libraryGameLinks).toListAsync();
        return libraryGameLinks ;
    }


text:
Q: How to activate custom java rules during SonarQube analysis? I implemented custom rules for java as described here enter link description here. Rules are visible on the server side at rules page, but no one from them is applied to code during analysis.
I'm using sonar 5.1.1 and updated sonar-java-plugin to v3.2.
I'm wonder what's wrong. During debug using sonar-runner I noticed that my CheckRegistrar is loaded but checks from it is ignored.

A: The solution is simple...Rules have to be included in Quality Profile.......


text:
Q: Split string at space not inside quotes in C#
Possible Duplicate:
Regular Expression to split on spaces unless in quotes

I need to split a specified string at all spaces in order to get arguments, however, I need all the text inside quotes to stay "un-split". For example:
ab "c d"
This needs to be split into 2 strings: 1. ab, 2. "c d". I attempted to use regex or write my own method to parse it, but had no luck.

A: Definitely a duplicate as Bala R mentioned above.
Regex regex = new Regex(@"\w+|""[\w\s]*""");
var str = "ab \"c d\"";

var x = regex.Matches(str).Cast<Match>().ToList();


text:
Q: Compojure: lein-ring in production? It seems that people sugget the use of lein-ring for a no-brainer deploy of a Compojure application. Isn't it just meant for development? I've benchmarked the same app running with lein-ring vs packed by leiningen with uberjar (executed with java -jar, it contains ring-jetty).
To my surprise, the performance is even slightly better with lein-ring! Am I missing something?
How can i keep on using lein-ring but avoid printing out stacktraces in case of exceptions and avoid checking for modified files?
Thanks

A: lein-ring will allow you to readily produce a war file for deployment to a container (and serves as the basis for lein-beanstalk
 for easy deployment to Amazon's Elastic Beanstalk), but I'm not aware of a common practice of using it in production.  Certainly an option, but probably rarely the best one.  I'd recommend deploying using the methods recommended by your host / container; this will most often mean deploying a war (which lein-ring can be used to build) or using some variety of containerless deployment with an embedded Jetty instance (as on Heroku with Leiningen).
If you do want to use lein-ring in production but want to turn off its development-time capabilities (code reloading, stack trace rendering, etc), you must set the RING_ENV environment variable to production, e.g.:
export RING_ENV=production
lein ring ...

A: lein-ring is a development only tool. Of course the way you package and deploy your application will have an impact on performance. Are you actually comparing apples to apples here?
I have found significant differences in lein-ring and even just an embedded jetty deployment.
This being said, with lein-ring you miss out on a ton of stuff. Putting your application in a proper container will allow for a lot more in terms of opertional support and monitorability.


text:
Q: comparing edittext input to string array Im new, so sorry if my question is lame.
But, im trying to make an AI chatbot (like, a simpler version of cleverbot that responds to certain input keywords.)
I have an edittext panel, which the user will input words to 'talk' to the AI. But, instead of coding every word in the java file, i want to compare the string input to an existing string array to check if the keyword is there and so that the AI can display the coressponding answer.
example:

if input is: Hellothere!
and on the string array, there is: Hello.

and:

If edittext=Hello, then display this: blah blah.

Here is my (amateurish) code:
  public void onClick(View v){

        Resources res = getResources();
       String[] usernames = res.getStringArray(R.array.input2);
     boolean submit_check = input1(wordy, usernames);
       public boolean input1(String wordy, String[] input2){

           if(candidate.equals(usernames))
           {

               wahh.start();
           myString = res.getStringArray(R.array.OUTPUT);
           pic.setImageResource(R.drawable.keel);
            String q = myString[rgenerator.nextInt(myString.length)];
            display.setText(q);
           }

           else{
               wahh.start();
               pic.setImageResource(R.drawable.keel);
               myString = res.getStringArray(R.array.OUTPUT);
            String q = myString[rgenerator.nextInt(myString.length)];
            display.setText(q);
           }

A: I think what you want is something more along the lines of this (pseudocode):
if(EditText.getText().Contains("Hello")) {
    EditText.setText("What's up?");
}

You'd want to check if it contains a selection from the array though. If it does, get the index of the array. Based on the index, respond accordingly. The easiest way to do that would be using a for loop and a switch statement. Although AI is actually a lot more complicated than this, and my knowledge.


text:
Q: How to Delete Session Cookie? How to dynamically, via jQuey, delete a session cookie, without manually restarting the browser?
I read somewhere that session cookie is retained in browser memory and will be removed when the browser is closed.
// sessionFooCookie is session cookie
// this code does not delete the cookie while the browser is still on
jQuery.cookie('sessionFooCookie', null);

More Info: The code snippet above is a
javascript code snippet, using jQuery
and its jQuery.cookie plugin.

A: There are known issues with IE and Opera not removing session cookies when setting the expire date to the past (which is what the jQuery cookie plugin does)
This works fine in Safari and Mozilla/FireFox.

A: Be sure to supply the exact same path as when you set it, i.e.
Setting:
$.cookie('foo','bar', {path: '/'});

Removing:
$.cookie('foo', null, {path: '/'});

Note that
$.cookie('foo', null);

will NOT work, since it is actually not the same cookie.
Hope that helps.
The same goes for the other options in the hash

A: This needs to be done on the server-side, where the cookie was issued.

A: you can do this by setting the date of expiry to yesterday.
My new set of posts about cookies in JavaScript could help you.
http://www.markusnordhaus.de/2012/01/20/using-cookies-in-javascript-part-1/

A: A session cookie is just a normal cookie without an expiration date. Those are handled by the browser to be valid until the window is closed or program is quit.
But if the cookie is a httpOnly cookie (a cookie with the httpOnly parameter set), you cannot read, change or delete it from outside of HTTP (meaning it must be changed on the server).

A: Deleting a jQuery cookie:
$(function() {
    var COOKIE_NAME = 'test_cookie';
    var options = { path: '/', expires: 10 };
    $.cookie(COOKIE_NAME, 'test', options); // sets the cookie
    console.log( $.cookie( COOKIE_NAME)); // check the value // returns test
    $.cookie(COOKIE_NAME, null, options);   // deletes the cookie
    console.log( $.cookie( COOKIE_NAME)); // check the value // returns null
});

A: If it is a session cookie + hostOnly cookie (like default tapestry session's cookies)
To delete from Javascript you also must not specify domain when editing/expire cookie, and not specify expire date and set value to null.
function clearHOnlySessionCookie(name,  path){
    var domain = domain || document.domain;
    var path = path || "/";
    document.cookie = name + "=null; path=" + path+";";
};


text:
Q: Hello to everybody, Can somebody advise me good localization plugin or extension? I'm using sencha touch 2 and i want to add localization functional to my mobile app. I spent  2 days to look for localization plugin and i found Ux.locale.Manager. But it's not suitable to my project.

A: This app has quite a good implementation of using Localisation, check it out, posted in the Sencha Touch 2 Examples area of the forum:
http://www.sencha.com/forum/showthread.php?256010-Anthologia-Mobile
Direct links to project:
More info: http://html5.mxnet.it/anthologia/mobile/
Demo: http://html5.mxnet.it/demos/anthologia/mobile/
Code: https://github.com/mxnet/AnthologiaMobile
In the localisation info section it says this:
Localization
The file index.html of the application must contains the link to the preferred localization:
<script src="resources/config/locale-en_US.js"></script>

You can edit each localized string of the included file:
<script src="resources/config/locale-en_US.js"></script>)

The contents of the file is self-explanatory, but we will improve the related documentation.
:-)


text:
Q: Testing for Nuget package version collisions in a devops pipeline BEFORE push So I have a solution of multiple project containing project which build DLLs I want to push to nuget.
People especially me are idiots and get things wrong, even automation can get things wrong.
What I am attempting to achieve is to check there are no version-number collisions/violations before I do a nuget push.
To try ensure that the push stage won't fail half way through, due to said collision.

A:
What I am attempting to achieve is to check there are no version-number collisions/violations before I do a nuget push.

As a long-term user of azure devops and nuget, we do not need to check again if there are version-number collisions before we push nuget package.
That because nuget push task or push command line has a built-in check command, if there are the same version, they will fail the task and inform nuget version of the conflict. This is a reasonable expected result.
If you want to ensure that the push stage won't fail half way, what is your next step after you get there is version-number collisions, fail your pipeline or stop push the pushing? This has the same result as our direct fail nuget push.
Besides, the failure push phase will not have other negative effects, nuget package will not be push to the feed.
Note: If you access version-number collisions when you push the nuget package, the there is an option Allow duplicates to be skipped, which allows the task to report success even if some of your packages are rejected with 409 Conflict errors:

Hope this helps.


text:
Q: C# ASP.NET trouble uploading contact page to SQL Server 2008 R2 Let me start of by saying that I am new to ASP and have done my best to learn the script the past couple weeks. I am having trouble setting up an aspx.cs page to get the information to post on the server. Any help would be much appreciated.
I have included the code for the backend and the web form below. The web form is one page that needs to collect text fields, RadioButton, dropdownlist, and checkboxlist.
RadioButton - askes question that requires a Yes or No answer
Checkboxlist - Inset a 1 if selected and a 0 if not selected.
Needs to be able to work with asp.net 2.0, IIS 6, C#, SQL Server 2008 R2.
 I replaced all of the actual ID with numbers**
Back End
public partial class _Default : System.Web.UI.Page
{
    public string GetConnectionString()
    {
        //sets the connection string from your web config file "ConnString" is the name of your Connection String
        return ConfigurationManager.ConnectionStrings["MyConString"].ConnectionString;
    }

private void ExecuteInsert(string 1, string 2, string 3, string 4, string 5, string 6, string 7, string 8, string 9, string 10, string 11, string 12, string 13, string 14, string 15, string 16, string 17, string 18, string 19, string 20, string 21, string 22, string 23, string 24, string 25, string 26, string 27, string 28, string 29, string 30, string 31, string 32, string 33, string 34, string 35, string 36, string 37, string 38, string 39, string 40, string 41, string 42, string 43, string 44, string 45, string 46, string 47, string 48, string 49, string 50, string 51, string 52, string 53, string 54, string 55, string 56, string 57, string 58, string 59, string 60, string 61, string 62, string 63, string 64, string 65, string 66)
{
    SqlConnection conn = new SqlConnection(GetConnectionString());
    string sql = "INSERT INTO webContactForm (1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66) VALUES (@1,  @2,  @3,  @4,  @5,  @6,  @7,  @8,  @9,  @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33, @34, @35, @36, @37, @38, @39, @40, @41, @42, @43, @44, @45, @46, @47, @48, @49, @50, @51, @52, @53, @54, @55, @56, @57, @58, @59, @60, @61, @62, @63, @64, @65, @66)";

    try
    {
        conn.Open();
        SqlCommand cmd = new SqlCommand(sql, conn);
        SqlParameter[] param = new SqlParameter[66];
        //param[0] = new SqlParameter("@Contact_id", SqlDbType.Int, 20);
        param[0] = new SqlParameter("@1", SqlDbType.VarChar, 200);
        param[1] = new SqlParameter("@2", SqlDbType.VarChar, 200);
        param[2] = new SqlParameter("@3", SqlDbType.VarChar, 200);
        param[3] = new SqlParameter("@4", SqlDbType.VarChar, 200);
        param[4] = new SqlParameter("@5", SqlDbType.VarChar, 200);
        param[5] = new SqlParameter("@6", SqlDbType.VarChar, 200);
        param[6] = new SqlParameter("@7", SqlDbType.VarChar, 200);
        param[7] = new SqlParameter("@8", SqlDbType.VarChar, 200);
        param[8] = new SqlParameter("@9", SqlDbType.VarChar, 200);
        param[9] = new SqlParameter("@10", SqlDbType.VarChar, 200);
        param[10] = new SqlParameter("@11", SqlDbType.VarChar, 200);
        param[11] = new SqlParameter("@12", SqlDbType.VarChar, 200);
        param[12] = new SqlParameter("@13", SqlDbType.VarChar, 200);
        param[13] = new SqlParameter("@14", SqlDbType.VarChar, 200);
        param[14] = new SqlParameter("@15", SqlDbType.VarChar, 200);
        param[15] = new SqlParameter("@16", SqlDbType.VarChar, 200);
        param[16] = new SqlParameter("@17", SqlDbType.VarChar, 200);
        param[17] = new SqlParameter("@18", SqlDbType.VarChar, 200);
        param[18] = new SqlParameter("@19", SqlDbType.VarChar, 200);
        param[19] = new SqlParameter("@20", SqlDbType.VarChar, 200);
        param[20] = new SqlParameter("@21", SqlDbType.VarChar, 200);
        param[21] = new SqlParameter("@22", SqlDbType.VarChar, 200);
        param[22] = new SqlParameter("@23", SqlDbType.VarChar, 200);
        param[23] = new SqlParameter("@24", SqlDbType.VarChar, 200);
        param[24] = new SqlParameter("@25", SqlDbType.VarChar, 200);
        param[25] = new SqlParameter("@26", SqlDbType.VarChar, 200);
        param[26] = new SqlParameter("@27", SqlDbType.VarChar, 200);
        param[27] = new SqlParameter("@28", SqlDbType.VarChar, 200);
        param[28] = new SqlParameter("@29", SqlDbType.VarChar, 200);
        param[29] = new SqlParameter("@30", SqlDbType.VarChar, 200);
        param[30] = new SqlParameter("@31", SqlDbType.VarChar, 200);
        param[31] = new SqlParameter("@32", SqlDbType.VarChar, 200);
        param[32] = new SqlParameter("@33", SqlDbType.VarChar, 200);
        param[33] = new SqlParameter("@34", SqlDbType.VarChar, 200);
        param[34] = new SqlParameter("@35", SqlDbType.VarChar, 200);
        param[35] = new SqlParameter("@36", SqlDbType.VarChar, 200);
        param[36] = new SqlParameter("@37", SqlDbType.VarChar, 200);
        param[37] = new SqlParameter("@38", SqlDbType.VarChar, 200);
        param[38] = new SqlParameter("@39", SqlDbType.VarChar, 200);
        param[39] = new SqlParameter("@40", SqlDbType.VarChar, 200);
        param[40] = new SqlParameter("@41", SqlDbType.VarChar, 200);
        param[41] = new SqlParameter("@42", SqlDbType.VarChar, 200);
        param[42] = new SqlParameter("@43", SqlDbType.VarChar, 200);
        param[43] = new SqlParameter("@44", SqlDbType.VarChar, 200);
        param[44] = new SqlParameter("@45", SqlDbType.VarChar, 200);
        param[45] = new SqlParameter("@46", SqlDbType.VarChar, 200);
        param[46] = new SqlParameter("@47", SqlDbType.VarChar, 200);
        param[47] = new SqlParameter("@48", SqlDbType.VarChar, 200);
        param[48] = new SqlParameter("@49", SqlDbType.VarChar, 200);
        param[49] = new SqlParameter("@50", SqlDbType.VarChar, 200);
        param[50] = new SqlParameter("@51", SqlDbType.VarChar, 200);
        param[51] = new SqlParameter("@52", SqlDbType.VarChar, 200);
        param[52] = new SqlParameter("@53", SqlDbType.VarChar, 200);
        param[53] = new SqlParameter("@54", SqlDbType.VarChar, 200);
        param[54] = new SqlParameter("@55", SqlDbType.VarChar, 200);
        param[55] = new SqlParameter("@56", SqlDbType.VarChar, 200);
        param[56] = new SqlParameter("@57", SqlDbType.VarChar, 200);
        param[57] = new SqlParameter("@58", SqlDbType.VarChar, 200);
        param[58] = new SqlParameter("@59", SqlDbType.VarChar, 200);
        param[59] = new SqlParameter("@60", SqlDbType.VarChar, 200);
        param[60] = new SqlParameter("@61", SqlDbType.VarChar, 200);
        param[61] = new SqlParameter("@62", SqlDbType.VarChar, 200);
        param[62] = new SqlParameter("@63", SqlDbType.VarChar, 200);
        param[63] = new SqlParameter("@64", SqlDbType.VarChar, 200);
        param[64] = new SqlParameter("@65", SqlDbType.VarChar, 200);
        param[65] = new SqlParameter("@66", SqlDbType.VarChar, 200);
    param[66] = new SqlParameter("@67", SqlDbType.VarChar, 200);

        param[0].Value = 1;
        param[1].Value = 2;
        param[2].Value = 3;
        param[3].Value = 4;
        param[4].Value = 5;
        param[5].Value = 6;
        param[6].Value = 7;
        param[7].Value = 8;
        param[8].Value = 9;
        param[9].Value = 10;
        param[10].Value = 11;
        param[11].Value = 12;
        param[12].Value = 13;
        param[13].Value = 14;
        param[14].Value = 15;
        param[15].Value = 16;
        param[16].Value = 17;
        param[17].Value = 18;
        param[18].Value = 19;
        param[19].Value = 20;
        param[20].Value = 21;
        param[21].Value = 22;
        param[22].Value = 23;
        param[23].Value = 24;
        param[24].Value = 25;
        param[25].Value = 26;
        param[26].Value = 27;
        param[27].Value = 28;
        param[28].Value = 29;
        param[29].Value = 30;
        param[30].Value = 31;
        param[31].Value = 32;
        param[32].Value = 33;
        param[33].Value = 34;
        param[34].Value = 35;
        param[35].Value = 36;
        param[36].Value = 37;
        param[37].Value = 38;
        param[38].Value = 39;
        param[39].Value = 40;
        param[40].Value = 41;
        param[41].Value = 42;
        param[42].Value = 43;
        param[43].Value = 44;
        param[44].Value = 45;
        param[45].Value = 46;
        param[46].Value = 47;
        param[47].Value = 48;
        param[48].Value = 49;
        param[49].Value = 50;
        param[50].Value = 51;
        param[51].Value = 52;
        param[52].Value = 53;
        param[53].Value = 54;
        param[54].Value = 55;
        param[55].Value = 56;
        param[56].Value = 57;
        param[57].Value = 58;
        param[58].Value = 59;
        param[59].Value = 60;
        param[60].Value = 61;
        param[61].Value = 62;
        param[62].Value = 63;
        param[63].Value = 64;
        param[64].Value = 65;
        param[65].Value = 66;
        param[66].Value = 67;

        //create loop to insert
        for (int i = 0; i < param.Length; i++)
        {
            cmd.Parameters.Add(param[i]);
        }

        cmd.CommandType = CommandType.Text;
        cmd.ExecuteNonQuery();
    }
    catch (System.Data.SqlClient.SqlException ex)
    {
        string msg = "Error occured while inserting:";
        msg += ex.Message;
        throw new Exception(msg);
    }
    finally
    {
        conn.Close();
    }
    }
    private object GetConnectionString(string p)
    {
throw new NotImplementedException();
    }
    protected void Button1_Click(object sender, EventArgs e){
        //call the method to execute insert to the database
        cmd.Parameters.Add(new SqlParameter("@MyParamter", "my value"));

        ClearControls(Page);
}
}

WEB FORM CODE:
 <%@ Page Language="C#"  AutoEventWireup="true" CodeFile="Default.aspx.cs"" Inherits="Default2" %>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Contact Us</title>

    <form id="form1" runat="server">

            TextBox column 1:

                <asp:TextBox ID="1" runat="server"></asp:TextBox>

            TextBox column 2:

                <asp:TextBox ID="LName" runat="server"></asp:TextBox>

            3 TextBox column 3,4,5:

                <asp:TextBox ID="3" runat="server" Width="60px"></asp:TextBox>-
                <asp:TextBox ID="4" runat="server" Width="59px"></asp:TextBox>-
                <asp:TextBox ID="5" runat="server" Width="62px"></asp:TextBox>

            TextBox column 6:

                <asp:TextBox ID="6" runat="server"></asp:TextBox>

            ListItem column 7:

            <asp:DropDownList ID="7" runat="server"
                              AppendDataBoundItems="true">
            <asp:ListItem Value="-1">Select</asp:ListItem>
            <asp:ListItem>A</asp:ListItem>
            <asp:ListItem>B</asp:ListItem>
            <asp:ListItem>C</asp:ListItem>
            <asp:ListItem>D</asp:ListItem>
            <asp:ListItem>E</asp:ListItem>
            <asp:ListItem>F</asp:ListItem>
            <asp:ListItem>G</asp:ListItem>
            </asp:DropDownList>

            RadioButton column 8

                <asp:RadioButton ID="Yes" runat="server" Checked="True" />
                <asp:RadioButton ID="No" runat="server" />

            TextBox column 9:

                <asp:TextBox ID="9" runat="server"></asp:TextBox>

            TextBox column 10:

                <asp:TextBox ID="ClientLName" runat="server"></asp:TextBox>

            RadioButton Column 11:

                <asp:RadioButton ID="Female" runat="server" />
                <asp:RadioButton ID="Male" runat="server" />

            3 TextBox column 12,13,14:

                <asp:TextBox ID="12" runat="server" Width="50px"></asp:TextBox>(mm)/<asp:TextBox ID="13" runat="server" Width="50px"></asp:TextBox>(dd)/<asp:TextBox ID="14" runat="server" Width="85px"></asp:TextBox>(yyyy)

            TextBox column 15:

                <asp:TextBox ID="15" runat="server"></asp:TextBox>

            TextBox column 16:

                <asp:TextBox ID="16" runat="server"></asp:TextBox>

            TextBox column 17:

                <asp:TextBox ID="17" runat="server"></asp:TextBox>

            Dropdownlist column 18:

            <asp:DropDownList ID="18" runat="server"
                              AppendDataBoundItems="true">
         <asp:ListItem value="-1">Select State</asp:ListItem>
         <asp:ListItem value="AL">Alabama</asp:ListItem>
         <asp:ListItem value="AR">Arkansas</asp:ListItem>
         <asp:ListItem value="AZ">Arizona</asp:ListItem>
         <asp:ListItem value="CA">California</asp:ListItem>
         <asp:ListItem value="CO">Colorado</asp:ListItem>
         <asp:ListItem value="CT">Connecticut</asp:ListItem>
         <asp:ListItem value="DC">District of Columbia</asp:ListItem>
         <asp:ListItem value="DE">Delaware</asp:ListItem>
         <asp:ListItem value="FL">Florida</asp:ListItem>
         <asp:ListItem value="GA">Georgia</asp:ListItem>
         <asp:ListItem value="IA">Iowa</asp:ListItem>
         <asp:ListItem value="ID">Idaho</asp:ListItem>
         <asp:ListItem value="IL">Illinois</asp:ListItem>
         <asp:ListItem value="IN">Indiana</asp:ListItem>
         <asp:ListItem value="KS">Kansas</asp:ListItem>
         <asp:ListItem value="KY">Kentucky</asp:ListItem>
         <asp:ListItem value="LA">Louisiana</asp:ListItem>
         <asp:ListItem value="MA">Massachusetts</asp:ListItem>
         <asp:ListItem value="MD">Maryland</asp:ListItem>
         <asp:ListItem value="ME">Maine</asp:ListItem>
         <asp:ListItem value="MI">Michigan</asp:ListItem>
         <asp:ListItem value="MN">Minnesota</asp:ListItem>
         <asp:ListItem value="MO">Missouri</asp:ListItem>
         <asp:ListItem value="MS">Mississippi</asp:ListItem>
         <asp:ListItem value="MT">Montana</asp:ListItem>
         <asp:ListItem value="NC">North Carolina</asp:ListItem>
         <asp:ListItem value="ND">North Dakota</asp:ListItem>
         <asp:ListItem value="NE">Nebraska</asp:ListItem>
         <asp:ListItem value="NH">New Hampshire</asp:ListItem>
         <asp:ListItem value="NJ">New Jersey</asp:ListItem>
         <asp:ListItem value="NM">New Mexico</asp:ListItem>
         <asp:ListItem value="NV">Nevada</asp:ListItem>
         <asp:ListItem value="NY">New York</asp:ListItem>
         <asp:ListItem value="OH">Ohio</asp:ListItem>
         <asp:ListItem value="OK">Oklahoma</asp:ListItem>
         <asp:ListItem value="OR">Oregon</asp:ListItem>
         <asp:ListItem value="PA">Pennsylvania</asp:ListItem>
         <asp:ListItem value="RI">Rhode Island</asp:ListItem>
         <asp:ListItem value="SC">South Carolina</asp:ListItem>
         <asp:ListItem value="SD">South Dakota</asp:ListItem>
         <asp:ListItem value="TN">Tennessee</asp:ListItem>
         <asp:ListItem value="TX">Texas</asp:ListItem>
         <asp:ListItem value="UT">Utah</asp:ListItem>
         <asp:ListItem value="VA">Virginia</asp:ListItem>
         <asp:ListItem value="VT">Vermont</asp:ListItem>
         <asp:ListItem value="WA">Washington</asp:ListItem>
         <asp:ListItem value="WI">Wisconsin</asp:ListItem>
         <asp:ListItem value="WV">West Virginia</asp:ListItem>
         <asp:ListItem value="WY">Wyoming</asp:ListItem>
            </asp:DropDownList>

            TextBox column 19:

                <asp:TextBox ID="19" runat="server"></asp:TextBox>

        Providing:

            <asp:CheckBoxList ID="CheckBoxList1" runat="server">
                <asp:ListItem Value="20">Want 1</asp:ListItem>
                <asp:ListItem Value="21">Want 2</asp:ListItem>
                <asp:ListItem Value="22">Want 3</asp:ListItem>
                <asp:ListItem Value="23">Want 4</asp:ListItem>
                <asp:ListItem Value="24">Want 5</asp:ListItem>
                <asp:ListItem Value="25">Want 6</asp:ListItem>
                <asp:ListItem Value="26">Want 7</asp:ListItem>
                <asp:ListItem Value="27">Want 8</asp:ListItem>
                <asp:ListItem Value="28">Want 9</asp:ListItem>
                <asp:ListItem Value="29">Want 10</asp:ListItem>
                <asp:ListItem Value="30">Want 11</asp:ListItem>
                <asp:ListItem Value="31">Want 12</asp:ListItem>
                <asp:ListItem Value="32">Want 13</asp:ListItem>
                <asp:ListItem Value="33">Want 14</asp:ListItem>
                <asp:ListItem Value="34">Want 15</asp:ListItem>
                <asp:ListItem Value="35">Want 16</asp:ListItem>
                <asp:ListItem Value="36">Want 17</asp:ListItem>
                <asp:ListItem Value="37">Want 18</asp:ListItem>
                <asp:ListItem Value="38">Want 19</asp:ListItem>
                <asp:ListItem Value="39">Want 20</asp:ListItem>
                <asp:ListItem Value="40">Want 21</asp:ListItem>
            </asp:CheckBoxList>

        <asp:CheckBoxList ID="CheckBoxList2" runat="server">
                <asp:ListItem Value="41">Want 22</asp:ListItem>
                <asp:ListItem Value="42">Want 23</asp:ListItem>
                <asp:ListItem Value="43">Want 24</asp:ListItem>
                <asp:ListItem Value="44">Want 25</asp:ListItem>
                <asp:ListItem Value="45">Want 26</asp:ListItem>
                <asp:ListItem Value="46">Want 27</asp:ListItem>
                <asp:ListItem Value="47">Want 28</asp:ListItem>
                <asp:ListItem Value="48">Want 29</asp:ListItem>
                <asp:ListItem Value="49">Want 30</asp:ListItem>
                <asp:ListItem Value="50">Want 31</asp:ListItem>
                <asp:ListItem Value="51">Want 32</asp:ListItem>
                <asp:ListItem Value="52">Want 33</asp:ListItem>
                <asp:ListItem Value="53">Want 34</asp:ListItem>
                <asp:ListItem Value="54">Want 35</asp:ListItem>
                <asp:ListItem Value="55">Want 36</asp:ListItem>
                <asp:ListItem Value="56">Want 37</asp:ListItem>
                <asp:ListItem Value="57">Want 38</asp:ListItem>
                <asp:ListItem Value="58">Want 39</asp:ListItem>
                <asp:ListItem Value="59">Want 40</asp:ListItem>
                <asp:ListItem Value="60">Want 41</asp:ListItem>
                <asp:ListItem Value="61">Want 42</asp:ListItem>
            </asp:CheckBoxList>

            Comment TextBox column 62:

                <asp:TextBox ID="62" runat="server"></asp:TextBox>

              <asp:CheckBoxList ID="CheckBoxList3" runat="server">
                <asp:ListItem Value="63">Have 1</asp:ListItem>
                <asp:ListItem Value="64">Have 2</asp:ListItem>
                <asp:ListItem Value="65">Have 3</asp:ListItem>
              </asp:CheckBoxList>

              <asp:CheckBoxList ID="CheckBoxList4" runat="server">
                <asp:ListItem Value="66">Have 4</asp:ListItem>
                <asp:ListItem Value="67">Have 5</asp:ListItem>
              </asp:CheckBoxList>

<asp:Button ID="Button1" runat="server" Text="Submit"
                         onclick="Button1_Click" />
</form>

A: There are several things at hand here, almost too much to cover in a single answer, so let me at least preface my comments by suggesting you pick up a basic ASP.NET book and go through some of the basics therein. Looking at your posting, I think you understand a few things, but not broadly enough just yet.
First, the ExecuteInsert method is a problem, and I'm guessing it isn't compiling. You can't name method parameters with a number; that's not a legal identifier. But, beyond that, that huge parameter list is just a problem begging to be fixed....and that brings us to the other notion...getting the data from the page to the back-end code.
Your ASP.NET Control ID declarations cannot be just a numeric ID, because it causes ASP.NET to generate intermediate declarations using that as an identifier that exposes the control to your code-behind. However, numeric identifiers are not legal. I would strongly suggest you rename those ID's to something more descriptive and constructive.
For example, while I'm not sure what its supposed to hold, let's say the asp:TextBox you've declared with ID = "3" is supposed to hold a Last Name. A good ID would, then, be "LastName," which can then be accessed in your codebehind via the identifier LastName, and its contents via the Text property, eg LastName.Text.
<asp:TextBox ID="LastName" runat="server" Width="60px"></asp:TextBox>

..
from codebehind:
..
// access the value of the textbox as (purely an example):
if (LastName.Text=="")
{
    // Do something with a blank last name
};

Obviously, you'd need to adapt this to your application, and the same notion to the other inputs.
If you repeat that process for all those ID's, you then realize you have a natural mechanism to access the values provided by a user in the Page_Load event when the Page.IsPostBack value is True. That makes your page much easier to read and programmaticallly easier to manage, because you can collect the data from your inputs and supply them to your Insert more cleanly.
The same problem exists with the identifiers in your SQL statement, although using parameters to populate it is actually a good practice.
That's a good start for now. See if what I've suggested gives you a starting point, refine what you've done so far, and see if you can get closer to a workable solution. Good luck.
EDIT based on discussion with OP
This should provide a markup and codebehind sample that demonstrates one way to extract the values from a CheckBoxList, a TextBox, and a ListBox from an ASP.NET page and adds those values as SqlParameters to a SqlCommand  for insertion into a fictional sample table.
**
ASPX Markup for sample page:
**
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DemoPage.aspx.cs" Inherits="DemoPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title></title>

    <form id="form1" runat="server">

    <asp:CheckBoxList id="SampleCheckBox" runat="server">
        <asp:ListItem Text="First Value" Value="1"></asp:ListItem>
        <asp:ListItem Text="Second Value" Value="2"></asp:ListItem>
        <asp:ListItem Text="Third Value" Value="3"></asp:ListItem>
    </asp:CheckBoxList>

    <asp:TextBox ID="SampleTextBox" Width="50" runat="server"></asp:TextBox>
    <asp:ListBox ID="SampleListBox" runat="server">
        <asp:ListItem Text="First Value" Value="A"></asp:ListItem>
        <asp:ListItem Text="Second Value" Value="B"></asp:ListItem>
        <asp:ListItem Text="Third Value" Value="C"></asp:ListItem>
    </asp:ListBox>
    <asp:Button id="SubmitButton" runat="server" UseSubmitBehavior="true" />

    </form>

Code behind:
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DemoPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {

            string strSql = @"Insert Into SampleTable (Check1, Check2, Check3, Text, ListBoxResult)
                                               Values (@Value1, @Value2, @Value3, @TextValue, @ListResult)";
            SqlCommand cmd = new SqlCommand(strSql);

            // Handle CheckBoxList values
            int checkValue=0;
            foreach (ListItem sampleItem in SampleCheckBox.Items)
            {
                checkValue++; //increment ID used to build parameter name
                string parmName=String.Format("@Value{0}",checkValue);
                SqlParameter newParameter = new SqlParameter();
                newParameter.ParameterName = parmName;
                if (sampleItem.Selected)
                {
                    newParameter.Value = "Y";
                    //column value in DB for field corresponding to sampleItem is "Y"
                }
                else
                {
                    newParameter.Value="N";
                    //column value in DB for field corresponding to sampleItem is "n"
                }
                cmd.Parameters.Add(newParameter);
            }

            // Handle TextBox value
            cmd.Parameters.Add("@TextValue", SampleTextBox.Text);

            // Handle ListBox selected value
            cmd.Parameters.Add("@ListResult", SampleListBox.SelectedValue);

            cmd.ExecuteNonQuery();
        }
    }
}

Discussion
The page hosts one three-item CheckBoxList, one TextBox, and one ListBox. The user may select any one of the items in the CheckBoxList, place any text in the TextBox, and select a value from the LIstBox. The button causes the form to submit, causing the codebehind to execute in a postback mode.
The postback mode causes the SQL data portion to fire in three parts:

*

*Regardless of the number of items checked in the CheckBoxList, the values correspond (in this example) to a Y or N value in the sample database. If an item is checked, the value should be "Y", and "N" if it is not. The code iterates through all three ListItems in the CheckBoxList, and adds Parameter objects with names corresponding to the Parameter fields named in the SQL query, setting values of "Y" or "N" as needed. The "parmName" variable is a convenience variable to construct the names of the first three parameters, named Value1, Value2, Value3.

*The next parameter is taken from the Text property of the SampleTextBox control.

*The last parameter is taken from the Value property of the selected ListBox ListItem.
With the parameters collected, the ExecuteNonQuery method of the SqlCommand object is fired, executing the statement with the provided values.
Hopefully, this illustrates at least one way of collecting values from an ASP.NET form and writing them to a database. The elements of supplying/buiding the proper connection string, as well as declaring/opening a Connection object, are not illustrated. As the database query is only for demonstration, actual test of this code against a database has not been accomplished, but it does work up to the ExecuteNonQuery() method call.


text:
Q: Passing a tuple as command line argument My requirement is to pass a tuple as command line argument like
--data (1,2,3,4)

I tried to use the argparse module, but if I pass like this it is receiving as the string '(1,2,3,4)'. I tried by giving type=tuple for argparse.add_argument, but is of no use here.
Do I have to add a new type class and pass that to type argument of add_argument?
Update
I tried the ast.literal_eval based on answers. Thanks for that. But it is giving spaces in the result as shown below.
(1,2,3,4)
<type 'str'>
(1, 2, 3, 4)
<type 'tuple'>

A: If you want to scale this, not deal with syntax trees, and provide the tuple conversion within the argument, you'll need a custom argparse type. (I needed this since my parser is in a package, and I didn't want to require my users to all write my_tuple = tuple(args.data). With an argument type, you can also receive a string with parenthesis like the original question. Also, I wouldn't include nargs, because that will wrap your custom type output into a list, which basically defeats the purpose of your custom type. I mapped a float because my input was something like "0.9, 0.99", but your int works the same:
def tuple_type(strings):
    strings = strings.replace("(", "").replace(")", "")
    mapped_int = map(int, strings.split(","))
    return tuple(mapped_int)

parser = argparse.ArgumentParser()
parser.add_argument('--data', type=tuple_type)
args = parser.parse_args()

This way you can send in --data "(1,2,3,4)" or --data "1,2,3,4"

A: Set nargs of the data argument to nargs="+" (meaning one or more) and type to int, you can then set the arguments like this on the command line:
--data 1 2 3 4

args.data will now be a list of [1, 2, 3, 4].
If you must have a tuple, you can do:
my_tuple = tuple(args.data)

Putting it all together:
parser = argparse.ArgumentParser()
parser.add_argument('--data', nargs='+', type=int)
args = parser.parse_args()
my_tuple = tuple(args.data)

A: I had same requirement. Could not find in standard packages. So, rolled this.  Python 3x. Put inside simple argv parser, called one arg at a time:

*

*var is passed in default, of correct type.

*argval is found command line string. Comma separated,no spaces. i.e. 1,2,3 or one,two,three.

Works with bash shell, may need quotes, other adjustments for other shells, OS's.
Same technique works non list types. This version creates a homogeneous list or tuple, based on var[0].
example:
./foo.py   --mytuple 1,2,3,4,5

code:
def chk_arg( var, argstr, dbg=False):
    ### loop on sys.argv here .....
    # if list/tuple type, use list comprehension
    # converts csv list to list or tuple 'type(var)' of 'type(var[0])' items.
    if type(var) is list or type(var) is tuple:
        val = type(var)([type(var[0])(i) for i in argval.split(',')])


text:
Q: Permission denied (public key). Fatal: Could not read from remote repository Could please someone help me?
I completely blocked using Github. I'm trying to solve the problem, but I can't push my code on Github.
git push --set-upstream origin main Permission denied (public key). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.


text:
Q: Is there any way to speed up the chopping down of trees? I find chopping down trees to be a long and laborious process, especially when dealing with extremely tall trees, where I need to build a tower up to the top to complete the job.
Is there any way to speed up the chopping down of trees?

A: Treecapitator does this and is highly configurable.

A: Within vanilla minecraft there are a variety of methods for quickly chopping down trees.
From the original question, it is unclear if the desire is clearcutting, or harvesting massive amounts of wood.
For clearcutting, one can use flint and steel and burn the forest.  Back in the days of beta, this could cause quite a spectacle.  In current (release 1.6.4) days, fires do not get out of control, but most wood on most trees is destroyed.
For massive wood production, best to create a farm.  The single most important feature of a farm, is a top barrier to keep trees from growing too large.  (Especially important for oaks).
Once you have a farm, then

*

*Diamond Axes

*enchanted axes of efficiency

*Beacons of Haste

*or Potions of swiftness
are all mechanisms by which your harvesting will be vastly sped up.

A: Yes there is, it's called Timber!

A: Thaumcraft Axe of the stream works nicely too. If you just want to harvest wood though, Forestry will let you set up a pretty much completely automated wood farm pretty easily which you can pipe into a chest with buildcraft pipes or redpower tubes.

A: There are now AFK designs that cage a wither, and have the wither perform the harvesting.  All that is required is steve to plant the saplings.  So, if you want infinite wood, and have infinite bonemeal there is a path:


text:
Q: How do I ignore numbers at the end of a line to compare a string? I have lines that get tested every time I run a my file they are not always the same lines. What I want to do is test them against another line to check if they are the same. The question says partially because at the end of every line there are numbers that I don't want to take into account when making the comparison.
In the snippet below I tried to add another function that compares every line against the lines that I know will come out so that if it finds it, it returns a query that I need to run onto the screen
error: there were errors found during runtime 12.0
warning: incorrect info 1.0
warning: file at 'C://localhost/myfiles' not found 0.0
warning: file at 'C://localhost/css' not found 0.0
warning: file at 'C://localhost/js' not found 0.0
warning: file at 'C://localhost/assets' not found 5615612.0

This is what I tried to do but I don't know how to ignore the numbers so that the lines could actually compare. All of this happens after the first section is ran where I get the numbers that are grater than 0.0.
Meaning this lines get compared.
error: there were errors found during runtime 12.0
warning: incorrect info 1.0
warning: file at 'C://localhost/assets' not found 5615612.0

if ("error: there were errors found during runtime 12.0" == line){
    //run this query for database runtimeDB
}
if("warning: incorrect info 1.0" == line){
    //this query
    //+1 for incorrectInfoDB
}
if("warning: file at 'C://localhost/myfiles' not found 0.0" == line){
    //this query
    //+1 for incorrectInfoDB
}
if("warning: file at 'C://localhost/css' not found 0.0" == line){
    //this query
    //+1 for outerfilesDB
}
if("warning: file at 'C://localhost/css' not found 0.0" == line){
    //this query
    //+1 for outerfilesDB
}
if("warning: file at 'C://localhost/js' not found 0.0" == line){
    //this query
    //+1 for outerfilesDB
}
if("warning: file at 'C://localhost/assets' not found 0.0" == line){
    //this query
    //+1 for outerfilesDB
}

this is the actual code that I tried. There is code reused that can be optimized. At the end everything gets saved in an array and all arrays get printed out depending on their databases the queries query on.
function compare_RT(){
    var text = $('textarea').val();
    var lines = text.split("\n");
    var runtimeDB= [];
    lines.forEach(function(line){

        var string0 = "error: there were errors found during runtime"

        if(line.includes(string0)){
            runtimeDB.push(line);
        }
    });
return runtimeDB;
}
function compare_IInfo(){
    var text = $('textarea').val();
    var lines = text.split("\n");
    var incorrectInfoDB= [];
    lines.forEach(function(line){

        var string0 = "error: there were errors found during runtime"
        var string1 = "warning: file at 'C://localhost/myfiles' not found"

        if(line.includes(string0)){
            incorrectInfoDB.push(line);
        }
        if(line.includes(string1)){
            incorrectInfoDB.push(line);
        }
    });
return incorrectInfoDB;
}

function getLines() {
  var text = $('textarea').val();
  var lines = text.split("\n");
  var requiredLines = [];
  lines.forEach(function(line) {
    number = line.match(/\d+\.\d+$/);
    if (number != null && number[0] > 0)
      requiredLines.push(line);
  });
  return requiredLines;
}

$(document).ready(
  function() {
    $('#printlogs').html(getLines().join('
'));
  });

<textarea style="width:100%;height:120px">
error: there were errors found during runtime 12.0
warning: incorrect info 1.0
warning: file at 'C://localhost/myfiles' not found 0.0
warning: file at 'C://localhost/css' not found 0.0
warning: file at 'C://localhost/js' not found 0.0
warning: file at 'C://localhost/assets' not found 5615612.0
</textarea>

Error Log

<printlogs id="printlogs"></printlogs>

A: I'm sure you can adapt it to your solution.
function trim_numbers($string) {
    //Get the numbers after the last whitespace.
    //strrchr — Find the last occurrence of a character in a string.
    $numbers = strrchr($string, ' ');

    //Replace found numbers with nothing ('').
    //$numbers is now equal to ' 12.0'.
    return str_replace($numbers, '', $string);
}

echo trim_numbers("error: there were errors found during runtime 12.0");

Output:

error: there were errors found during runtime

Working snippet


text:
Q: Add an array as request parameter with Retrofit 2 I'm looking for way to add an int array (e.g [0,1,3,5]) as parameter in a GET request with retrofit 2. Then, the generated url should be like this : http://server/service?array=[0,1,3,5]
How to do this ?

A: I have finally founded a solution by using Arrays.toString(int []) method and by removing spaces in this result because Arrays.toString return "[0, 1, 3, 5]". And my request method looks like this
@GET("http://server/service")
Observable<Void> getSomething(@Query("array") String array);

A: I faced a similar problem and had to do a couple of things to reach the acceptable form (as asked in the question).

*

*Converted an ArrayList to String
arrayList.toString().replace(" ", "")

*In RetroFit method, I changed the Query param which accepts the ArrayList above to as follows:
@Query(value = "cities", encoded = true)

This ensures that the brackets and commas are not URL encoded.

A: Using toString didn't work for me.
Instead, TextUtils.join(",", ids) does the trick.
Don't forget to mark the Query with encoded = true.

A: Just add it as a query param
@GET("http://server/service")
Observable<Void> getSomething(@Query("array") List<Integer> array);

You can also use int[], or Integer... as a last param;

A: You need to name your query param with an array syntax like so:
@GET("http://server/service")
Observable<Void> getSomething(@Query("array[]") List<Integer> array);

The syntax itself will vary by the backend technology being used, however not including the brackets "[]" will normally be interpreted as a single value.
For example, using array=1&array=2 will generally be interpreted by backends as only array=1 or array=2 instead of array=[1,2].

A: Well this did the trick for me
Step 1 :
In StateServce.kt
@GET("states/v1")
fun getStatesByCoordinates(@Query("coordinates", encoded = true) coordinates: String) : Call<ApiResponse<List<State>>>

Step 2
While calling from repository
val mCoordinate : List<Double> = [22.333, 22.22]
mStateService?.getStatesByCoordinates(mCoordinate.toString().replace(" ", ""))!!

A: Use Iterable to encapsulate the integer list, or use a two-dimensional integer array.

*

*How to define:
public interface ServerService {
    @GET("service")
    Call<Result> method1(@Query("array") Iterable<List<Integer>> array);

    @GET("service")
    Call<Result> method2(@Query("array") Integer[][] array);
}

*How to use:
Retrofit retrofit = new Retrofit.Builder()
    .baseUrl("http://server/")
    .addConverterFactory(GsonConverterFactory.create())
    .build();
ServerService service = retrofit.create(ServerService.class);

// Use the first method.
List<Integer> data1 = Arrays.asList(0,1,3,5);
Iterable array1 = Arrays.asList(data1);
Call<Result> method1Call = service.method1(array1);

// Use the second method.
Integer[] data2 = new Integer[]{0,1,3,5};
Integer[][] array2 = new Integer[][]{data2};
Call<Result> method2Call = service.method2(array2);

// Execute enqueue() or execute() of method1Call or method2Call.

Please refer to the code ParameterHandler.java of Retrofit2 for the reason why the way can solve the problem.

A: You can pass the value as below
In Repository
getApiResponse(arrayOf(0,1,3,5).contentToString())` In Kotlin.
@GET("http://server/service")
suspend fun getApiResponse(@Query("array") array: String): Response

It will work.


text:
Q: Converting Words from a Input into Values Python I am wondering how to convert words from an input into values in Python. The user would enter an input for example:
"The dog chased the cat the lion chased the dog"

I would then like it to return:
["1,2,3,1,4,1,5,6,1,2"]

I would like duplicate words to retain the same value as when the word first occurred. I have tried to do this multiple ways, I am using the following code at the moment, but it seems to return random indexes:
l = input("Enter a sentence").lower lists= list(l) valueindex = range(len(lists)) print(valueindex)

Thanks for the help,
Izaak

A: def text_process(text):
    '''split text to list and all the item are lower case'''

    text_list = text.lower().split()
    return text_list

def lookup_table(text_list):
    '''build dict contain the text and number pair'''

    lookup = {}
    start = 0
    for item in text_list:
        if item not in lookup:
            lookup[item] = start + 1
            start += 1
    return lookup

if __name__ == '__main__':
    text = "The dog chased the cat the lion chased the dog"
    text_list = text_process(text)
    lookup_table = lookup_table(text_list)
    out_put = [lookup_table[text]for text in text_list]
    print(out_put)

out:
[1, 2, 3, 1, 4, 1, 5, 3, 1, 2]


text:
Q: univariate regression in python Need to run multiple single-factor (univariate) regression models in python between a column in a dataframe and several other columns in the same dataframe
-

so based on the image, i want to run regression models between x1 & dep, x2 & dep and so on and so forth
Want to output - beta, intercept, R-sq, p-value, SSE, AIC, BIC, Normality test of residuals etc

A: There are two options you can use here. One is the popular scikit-learn library. It is used as follows
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X, y)  # where X is your feature data and y is your target
reg.score(X, y)  # R^2 value
>>> 0.87
reg.coef_  # slope coeficients
>>> array([1.45, -9.2])
reg.intercept_  # intercept
>>> 6.1723...

There are not many other statistics you can use with scikit.
Another option is statsmodels which offers far richer detail into the statistics of the model
import numpy as np
import statsmodels.api as sm

# generate some synthetic data
nsample = 100
x = np.linspace(0, 10, 100)
X = np.column_stack((x, x**2))
beta = np.array([1, 0.1, 10])
e = np.random.normal(size=nsample)

X = sm.add_constant(X)
y = np.dot(X, beta) + e

# fit the model and get a summary of the statistics
model = sm.OLS(y, X)
results = model.fit()
print(results.summary())

                            OLS Regression Results
==============================================================================
Dep. Variable:                      y   R-squared:                       1.000
Model:                            OLS   Adj. R-squared:                  1.000
Method:                 Least Squares   F-statistic:                 4.020e+06
Date:                Mon, 08 Jul 2019   Prob (F-statistic):          2.83e-239
Time:                        02:07:22   Log-Likelihood:                -146.51
No. Observations:                 100   AIC:                             299.0
Df Residuals:                      97   BIC:                             306.8
Df Model:                           2
Covariance Type:            nonrobust
==============================================================================
                 coef    std err          t      P>|t|      [0.025      0.975]
------------------------------------------------------------------------------
const          1.3423      0.313      4.292      0.000       0.722       1.963
x1            -0.0402      0.145     -0.278      0.781      -0.327       0.247
x2            10.0103      0.014    715.745      0.000       9.982      10.038
==============================================================================
Omnibus:                        2.042   Durbin-Watson:                   2.274
Prob(Omnibus):                  0.360   Jarque-Bera (JB):                1.875
Skew:                           0.234   Prob(JB):                        0.392
Kurtosis:                       2.519   Cond. No.                         144.
==============================================================================

You can see that statsmodels offer much more details, such as the AIC, BIC, t-statistics etc.


text:
Q: Proof of reflection principle for harmonic functions
My attempt:
Hi, there! I have known how to prove the above statement when $u\in C^2(U)$, however, I have question about proving the above statement. Because it is $u\in C^2(U^{+}) \cap C(\overline{ U^+})$.
It is really bothering me and I really need help. Thanks a lot.:)

A: It is sufficient to verify the mean value property for sufficient small balls for every $x\in \Omega^+ \cup T \cup \Omega^-$. This is clearly true for $x$ such that $x_n>0$, since we start with a function that is harmonic in $\Omega ^+$. By reflection, the function is also harmonic on $\Omega ^-$. Finally, when $x_n=0$, the integral over the upper half ball cancels that over the lower half ball. so we found $U$ is harmonic on the domain $\Omega^+ \cup T \cup \Omega^-$


text:
Q: LMAX disruptor: How to control the speed of producers? I recently used the LMAX Disruptor framework. How to get the number of tasks that have not been completed? If consumers consume too slowly, I want to control the production speed of producers.Does the disruptor have this function? Or how can I achieve it myself?
And I looked at the source code.
The message is stored in an array called entries.
 @SuppressWarnings("unchecked")
    protected final E elementAt(long sequence)
    {
        return (E) UNSAFE.getObject(entries, REF_ARRAY_BASE + ((sequence & indexMask) << REF_ELEMENT_SHIFT));
    }

A: It looks like there are built in wait strategies for handling slow consumers.


text:
Q: How to change data format returned from a MySQL query in PHP So, I'm working in Laravel and I have the following API GET route that returns a query from my DB with documents and their categories:
Route::get('documents', function() {
return DB::table('documents')
->join('documents_categories','documents_categories.documentCategoryID','=','documents.documentCategoryID')
->select('documentName','documentCategoryName')
->get(); });

Which returns all my documents sorted by their category:
{documentName: "Certificación de Licencia", documentCategoryName: "Aeronáutica Civil"}

{documentName: "Horas de Vuelo", documentCategoryName: "Aeronáutica Civil"}

{documentName: "Antecedente Penal", documentCategoryName: "Antecedentes"}

{documentName: "Traslado de Animales y Plantas", documentCategoryName: "Certificado de Sanidad Animal o Vegetal"}

{documentName: "Calidad y Apto para el Consumo Humano", documentCategoryName: "Certificados Comerciales"}

{documentName: "Certificado de Libre Venta", documentCategoryName: "Certificados Comerciales"}

{documentName: "Certificado de Origen", documentCategoryName: "Certificados Comerciales"}

{documentName: "Patente", documentCategoryName: "Certificados Comerciales"}

{documentName: "Registro de Producto", documentCategoryName: "Certificados Comerciales"}

{documentName: "Signos Distintivos", documentCategoryName: "Certificados Comerciales"}

Now, what I want to achieve is to return the documents categories as JSON keys with the corresponding documents inside an array. Something like this:
[
    {
        "Civiles":["document1","document2"],
        "Antecedentes":["document1","document2"]
    }
]

What's the best way to get it done?
Thanks you all for the help!

A: If you're using Laravel >=5.3 then your query will return a collection
You can use a mixture of groupBy(), map() and pluck():
Route::get('documents', function () {
    return DB::table('documents')
        ->join('documents_categories', 'documents_categories.documentCategoryID', '=', 'documents.documentCategoryID')
        ->select('documentName', 'documentCategoryName')
        ->get()
        ->groupBy('documentCategoryName')
        ->map(function ($item) {
            return $item->pluck('documentName');
        });
});

If you're using Laravel 5.4 you can take this one step further and use Higher Order Messages by changing:
->map(function ($item) {
    return $item->pluck('documentName');
});

to:
->map->pluck('documentName');

A: Sorry I mistaken your question. My bad. Thanks @Rafael
Edited Version :
Well you can use the collect method of Laravel on $documentList
$namelist = collect($documentList)->groupBy('documentCategoryName');

It's going to return something like this. Not in json format. It would be in array format.
$namelist = {
    category1: [
        {
            documentName: "d1",
            documentCategoryName: "category1"
        },
        {
            documentName: "D2",
            documentCategoryName: "category1"
        }
    ],
}

Well after that you can traverse this array
$res = array();
foreach ($namelist as $key => $value){
    array_push($res[$key], $value['documentname']);
}

And return $res. It would be your desired output.
Let the know if you looking for something like this.

A: Take a look at the Laravel docs for groupBy() on the collection class.
Since get() returns a collection, you can chain this method on the end.
Route::get('documents', function() {
    return DB::table('documents')
        ->join('documents_categories','documents_categories.documentCategoryID','=','documents.documentCategoryID')
        ->select('documentName','documentCategoryName')
        ->get()
        ->groupBy('documentCategoryName');
});


text:
Q: Replace characters within an attribute in jQuery I have several options values (attribute value) that have spaces,
<option value="Divers RF" class="">Divers RF</option>

<option value="France Bleu" class="">France Bleu</option>

How can I replace the space with a _ in the value?
So the result would be
<option value="Divers_RF" class="">Divers RF</option>
<option value="France_Bleu" class="">France Bleu</option>

and not only for these two options but for all options that have spaces in them.

A: Try this:
$('option').val(function(i,v){
   return v.replace(/\s/g, '_');
});

Working example: http://jsfiddle.net/YQWGw/

A: $("option").each(function() {
  var val = $(this).val();
  $(this).val(val.replace(/ /g, '_'));
}

thanks to @Fender, replace should be greedy
EDIT: adopted to replace value instead of text content

A: $("option").each(function() {
  $(this).val($(this).val().replace(/ /g, '_'));
});


text:
Q: gumbo-d bindings with DUB I'm trying to use gumbo-d in a project however dub is failing.
Here's the dub output:
Building: myproject (Default)
Performing main compilation...
dub build "myproject" "--build=plain"
Building package myproject in C:\Users\Matt\Documents\Projects\myproject\
Target vibe-d 0.7.23 is up to date. Use --force to rebuild.
Target gumbo-d 0.2.2 is up to date. Use --force to rebuild.
Building myproject ~master configuration "application", build type plain.
Compiling using dmd...
Linking...

OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
..\..\..\AppData\Roaming\dub\packages\gumbo-d-0.2.2\gumbo-d.lib(parse)
 Error 42: Symbol Undefined _gumbo_destroy_output
..\..\..\AppData\Roaming\dub\packages\gumbo-d-0.2.2\gumbo-d.lib(parse)
 Error 42: Symbol Undefined _gumbo_parse
--- errorlevel 2
FAIL .dub\build\application-plain-windows-x86-dmd_2066-946D41E793C045166B4DFD37035481AE\ myproject executable
Error executing command build: dmd failed with exit code 2.

Exit code 2
Build complete -- 1 error, 0 warnings

---------------------- Done ----------------------

Build: 1 error, 0 warnings

I'm at a bit of a loss of where the library file needs to go and what format it needs to be in.  There is a .lib file in the gumbo-d dependency directory, is this meant to be the library?  If so, why is the linker failing to link to it?
Here is the contents of my main dub.json file (for the overall project which includes the gumbo-d dependency)
{
    "name": "googleplayscraper",
    "description": "A simple vibe.d server application.",
    "copyright": "Copyright © 2015, Matt",
    "authors": ["Matt"],
    "dependencies": {
        "vibe-d": "~>0.7.19",
        "gumbo-d": "~>0.2.2"
    },
    "versions": ["VibeDefaultMain"]
}

And here is the dub.json file for the gumbo-d dependency:
{
    "libs-posix": [
        "gumbo"
    ],
    "version": "0.2.2",
    "description": "D bindings for Google's Gumbo HTML5 parser library",
    "authors": [
        "Christopher Bertels"
    ],
    "importPaths": [
        "source/"
    ],
    "configurations": [
        {
            "targetType": "library",
            "name": "library"
        }
    ],
    "homepage": "https://github.com/bakkdoor/gumbo-d",
    "sourcePaths": [
        "source/"
    ],
    "name": "gumbo-d",
    "copyright": "Copyright © 2013, Christopher Bertels"
}


text:
Q: Linking to multiple libraries, one of which wraps a set of system calls So this is the scenario that I'm looking at:
I have 3 libraries - A, B and C.

*

*Library A implements function foo() and exposes it as an API.

*Function foo() calls the POSIX write() call to write some data.

*Library B writes a wrapper to the write() glibc call using the linker -wrap option.

*Library C links to both A and B.

Any write() call that the library C makes will get intercepted by the wrapper
library B. But, my question is, if library C calls foo(), will the write() call inside foo() get intercepted by B?

A: If A is linked with -wrap=write, foo will call the wrapper. If it's not, it won't.
The same is true about calls to write in C. There's no difference whatsoever between A and C as far as calling write is concerned.


text:
Q: How can I reduce steps in python regular expression? This is my regex

([^>]+?[<])/?(?!a)(?:br|p)

This is example
<r> this is text which I do not want  This is what I want!

I just want to scrap text between '>' and '
]+?[<])/?(?!a)(?:br|p) pattern means:

*

*([^>]+?[<]) - Capture into Group 1 one or more (but as few as possible) chars other than > up to the first <

*/? - match an optional / symbol

*(?!a)(?:br|p) - match either br or p that do not start with a (so, the lookahead makes no sense).

Basically, it only returns text before
, <br or
([^<]+)</?(?:br|p)\b

See the regex demo (21 steps on your valid match, and 9 steps against the non-matching string <r> this is text which I do not want  This is what I want!br>).
Pattern details:

*

*> - a literal >

*([^<]+) - Capture group 1 matching one or more characters other than <

*< - a literal <

*/? - an optional (one or zero) /

*(?:br|p)\b - either br or p that are followed with a word boundary (there must be a non-word char after these values).

Python demo:
import re
p = re.compile(r'>([^<]+)</?(?:br|p)\b')
s = "<r> this is text which I do not want  This is what I want!
"
print(p.findall(s))

A: This is fewer steps:
>([^<]+)<(?:br|p)
https://regex101.com/r/hS2dI4/2


text:
Q: What are some of the most suitable platforms for creating strategy/simulation games? I have a decently planned idea for a strategy/simulation game. However, I don't want to use a "game-builder-package" to do this, as I think those will limit what I can do, and also because they are aimed towards people with no programming experience. What platforms/languages do you think would be appropriate for a game like this? I'd like to have graphics, but they can be 2D or sprite based to begin with.
Many thanks!

A: If it's a 2d game, then right now I'd pick javascript/html5. Your game will run on Win8, android, facebook...
Or, even if I'm not a huge fan, this one could do very well too: haxe language


text:
Q: Is it possible to create new types of FitNesse SLIM fixtures for .NET? I'd like to create a new fixture type in the .NET flavour of FitNesse, similar to Fabrizio Cannizzo's RestFixture, which is written in Java.  RestFixture can be used with both FIT and SLIM and I would like my .NET version to also work with both FIT and SLIM.
In FIT it's possible to create a new fixture type in .NET since the fixture classes are defined in the .NET test runner, FitSharp, and they can just be extended.
 However, I understand that in SLIM the fixture classes are included in FitNesse, not in the test-runner, and FitNesse is written in Java.  So does that mean we can't create new fixture types for SLIM in .NET?
If it is possible to create a new fixture type for SLIM in .NET, how can I do it?

A: Your understanding is correct. SLIM fixtures can only be written in Java.  This is one of the limitations of SLIM (or benefits, depending on your point of view!)


text:
Q: javafx Combobox type mismatch my problem is as follows:
class xxx {
@FXML
private Combobox<Integer> cmb_year;
...
public void method ()
{
 int year=2013;
 cmb_year.getItems().add(year);
 cmb_year.setValue(year) ---> argumenttype mismatch
}
}

It's fragments of my code, but shows the problem I encounter.
I've tried with

*

*making "int year" to "Integer year"

*Accessing overcmb_year.getSelectionModel().select(new Integer(year))

*Accessing over cmb_year.getSelectionModel().select(year)

Always leads to an argumenttype mismatch.
What can cause this?

A: If you are trying to set which item is selected, you want to work with the ComboBox's SelectionModel:
cmb_year.getSelectionModel().select(cmb_year.getItems().indexOf(year));

You could also try setSelectedItem(year) or selectLast().

A: This may simply be an issue with the ComboBox not being initialized properly or completely.  I never use ComboBoxes "out of the box".  I use several lines of code to set them up.
Following is a code excerpt from the initialize() method in one of my dialog controller classes (this ComboBox displays a list of Institution objects):
    // this first line gets the data from my data source
    // the ComboBox is referenced by the variable 'cbxInst'

    ObservableList<Institution> ilist = Institution.getInstitutionList();
    Callback<ListView<Institution>, ListCell<Institution>> cellfactory =
            new Callback<ListView<Institution>, ListCell<Institution>>() {
                @Override
                public ListCell<Institution> call(ListView<Institution> p) {
                    return new InstitutionListCell();
                }
            };

    cbxInst.setCellFactory(cellfactory);
    cbxInst.setButtonCell(cellfactory.call(null));
    cbxInst.setItems(ilist);

The key points here are:

*

*I define a cell factory to generate ListCell instances for the ComboBox to display.

*I use the factory to create a ListCell instance to initialize the Button Cell with.
For completeness, here is the private member class from which the Institution ListCell instances are created:
private final class InstitutionListCell extends ListCell<Institution> {

    @Override
    protected void updateItem(Institution item, boolean empty){
        super.updateItem(item, empty);

        if (item != null) {
            this.setText(item.getName());

        } else {
            this.setText(Census.FORMAT_TEXT_NULL);
        }
    }
}

If you were to initialize your ComboBox in a similar way, it may be that your problems will be solved.


text:
Q: CSS change color of specific text instead of all text in that class I'm new to CSS and HTML so my apologies in advance if this is a simple question.
On our website the Color of all the prices is red however i need to be able to adjust the color of one specific instance. The price is all set by one line of code:
.price { color: #e72526; }

However i need to create a rule that will allow me to adjust the color of just the price for the shopping cart.

A: Hope this helps.
STYLE:

HTML:

  $100


text:
Q: Django: return decimal instead of strange object I have a model with a decimal field.  The output of:
def special_method(self):
    return MyClass.objects.filter(product=self).order_by('-date_active')[0:1]

on this model is:
[<MyClass: 10.00>]

... and I have defined the following method on MyClass:
def __str__(self):
    return str(self.rate)

This may be a silly question but how do I correctly return the decimal number instead of this strange object?
Thanks.

A: myclass_instance.rate will give you the decimal number.
[edit]
Your method will then be something like:
def special_method(self):
    return MyClass.objects.filter(product=self).order_by('-date_active')[:1].values_list('rate', flat=True)

Or you might be able to do something like:
def special_method(self):
    return self.myclass_set.order_by('-date_active')[:1].values_list('rate', flat=True)

A: You're using filter, which always returns a QuerySet - a list-like collection of multiple instances - even if only one item is matched. You should use .get() instead, which will return a single item, and then you can access the .rate property on the returned instance.


text:
Q: How can I get previews of open windows using GTK2? I am thinking about maybe creating a tasklist widget using GTK2. This widget should show previews of all open windows. It does not matter whether the previews update in real time or not.
I already have some knowledge of GTK2 and libwnck, and I have created my own widgets before.
How do I get previews of open windows using GTK2? What general methods are available for doing this kind of thing, and what might I need to research? Please note that I do not want to use anything that depends on OpenGL.


text:
Q: Accessing SharePoint from another domain I have following scenario:
SharePoint 2013 standalone installation, server is in xyz.local domain so users can simply access SharePoint Sites if they are in the domain. No host names were configured.
Now I need to add users from other office to SharePoint, but the other office is in different domain. How can I provide the users from other office access to SharePoint and what authentication method I shall use?

A: Using Forms Authentication which uses the "other domain" will be an option to consider.
However you will need

*

*port 389 (LDAP) or 636 (LDAPS) to be opened on any of the DCs in the "other domain"

*service account on "other domain" whose password does not expire

Then follow the guide at http://www.microsoft.com/en-us/download/details.aspx?id=34684
One additional step to the above guide is to include connectionUsername and connectionPassword in all the web.config section identified in the link above (see http://blogs.msdn.com/b/ronalg/archive/2014/04/14/sharepoint-2013-and-forms-based-authentication-configuration-for-open-ldap.aspx for example of these two key value pairs).

A: The domains need to have trust relationships. If they do, then you can just configure the people picker in SharePoint 2010 to query from the additional domains so you can add user access:
Here are steps to configure SharePoint to authenticate cross domain users.

*

*Open Internal Firewall.

*configure a One way trust. SharePoint Domain trust the other domain.

*Run People picker command switch.

*Configure your Browser for authentication.

http://www.quantumofgeek.com/2010/09/configure-sharepoint-to-authenticate-cross-forest-ad-users/
http://technet.microsoft.com/en-us/library/gg602068.aspx#forests


text:
Q: Cannot resolve string supplied to vararg parameter in extension function strings.xml
<string name="my_string">Showing your number: %1$s</string>

ActivityExt.kt
fun Activity.showToast(textResId: Int, vararg formatArgs: String) {
    val text = getString(textResId, formatArgs)
    Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
}

MainActivity.kt
val number = 11
showToast(R.string.my_string, number.toString())

Toast with following text is showing:
Showing your number: [Ljava.lang.String;@2cfa3b]

Why this happens?

A: Use the spread operator:
fun Activity.showToast(textResId: Int, vararg formatArgs: String) {
    val text = getString(textResId, *formatArgs)
    Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
}

Currently, you're passing an array as the format argument. By using the spread operator you pass the contents of the array as the format argument.

A: You should use the spread operator to pass in the varargs to the getString function:
val text = getString(textResId, *formatArgs)

This is because the type of formatArgs inside the showToast function is Array<String> (there's no vararg type or anything like that), and if you pass that in without the *, you'll only pass a single parameter, which will be the array instead of its contents.


text:
Q: 1 page WebRTC - not getting any audio at the remote peer I'm trying to build a one-page webRTC app in order to learn this topic. I have 2 audio tags :
<audio id="local"></audio>
<audio id="remote"></audio>

One represents the local peer and the other represents the remote peer. I've successfully "sent" the local video to the remote peer - the descriptions were set as the local and the remote descriptions of the 2 peers and the stream was successfully "arrived" to the remote peer - I can inspect the 2 audio elements and see that they both have a blob url of the stream. But, only when I play the local video I can hear the audio - when I'm turning it off and playing the remote audio, I don't hear anything.
Why is it happening? Here is the JS code:
var local = document.querySelector("#local"); //The local audio tag
var remote = document.querySelector("#remote"); //The remote audio tag
var pc1; //The local peer
var pc2; //The remote peer

//Autoplay
//local.play();
remote.play();

navigator.webkitGetUserMedia({audio:true},function(stream){ //Get the audio
    local.src = window.URL.createObjectURL(stream);
    pc1 = new webkitRTCPeerConnection(null); //Initialize the local peer
    pc2 = new webkitRTCPeerConnection(null); //Initialize the remote peer
    pc1.addStream(stream); //Add the local stream to the connection => pass it to the remote peer

    pc1.createOffer(gotDescription1); //Create an offer and when you get the description call gotDescription1
    pc2.createAnswer(gotDescription2); //Create an answer acoording to the description you get from the local peer
    pc1.onicecandidate = gotLocalIceCandidate;
    pc2.onicecandidate = gotRemoteIceCandidate;
    pc2.onaddstream = gotRemoteStream; //When you get stream, call gotRemoteStream

},function(e){ //If there is an error
    console.error("ERROR: "+e);
});

function gotDescription1(desc){
    console.log("Offer from pc1 \n" + desc.sdp);
    pc1.setLocalDescription(desc); //set the description as the local description of the local peer
    //(Send the description to the remote peer)
    pc2.setRemoteDescription(desc); //set the description as the remote description of the remote peer
}

function gotDescription2(desc){
    console.log("Set the description in pc2");
    pc2.setLocalDescription(desc); //Set the description as the local description of the remote peer
    //(Send the description to the local peer)
    pc1.setRemoteDescription(desc); //set the description as the remote description of the local peer
}

function gotRemoteStream(e){
    remote.src = window.URL.createObjectURL(e.stream); //Play the stream you get
}

function gotLocalIceCandidate(event) {
    if (event.candidate) {
        pc2.addIceCandidate(new RTCIceCandidate(event.candidate));
    }
}

function gotRemoteIceCandidate(event) {
    if (event.candidate) {
        pc1.addIceCandidate(new RTCIceCandidate(event.candidate));
    }
}

A: You order of execution in your javascript is slightly off
You have not set the onaddstream event handler until already getting the remote stream(getting the remote stream can happen as early as setting the remote description).
It is also better for you to handle creating the answer inside the gotDescription1 callback as the callbacks are asynchronous and could be called out of order. I also set both audio html5 elements to autoplay instead of having to set them to play(you may want to do this as well)
Get user media changes:
 navigator.webkitGetUserMedia({ audio: true }, function (stream) { //Get the audio
        local.src = window.URL.createObjectURL(stream);
        pc1 = new webkitRTCPeerConnection(null); //Initialize the local peer
        pc2 = new webkitRTCPeerConnection(null); //Initialize the remote peer
        pc1.addStream(stream); //Add the local stream to the connection => pass it to the remote peer
        pc1.onicecandidate = gotLocalIceCandidate;
        pc2.onicecandidate = gotRemoteIceCandidate;
        pc2.onaddstream = gotRemoteStream; //When you get stream, call gotRemoteStream
        pc1.createOffer(gotDescription1); //Create an offer and when you get the description call gotDescription1
    }, function (e) { //If there is an error
        console.error("ERROR: " + e);
    });

And the gotDescription1 callback:
function gotDescription1(desc) {
    console.log("Offer from pc1 \n" + desc.sdp);
    pc1.setLocalDescription(desc); //set the description as the local description of the local peer
    //(Send the description to the remote peer)
    pc2.setRemoteDescription(desc); //set the description as the remote description of the remote peer
    pc2.createAnswer(gotDescription2); //Create an answer acoording to the description you get from the local peer
}


text:
Q: Poor monitor contrast for certain colors I recently bought a monitor (LG W1930S). Everything went out smooth until I discovered certain colors are.. invisible. For instance on this monitor #EEEEEE and #FFFFFF look the same to me. On the old monitor there is a clear distinction between them. I am using the same (really old) graphic card: nvidia mx 440.
Is this the monitor's fault (do low-end monitors usually fail in this way?) or the graphic card is too old? Thank you in advance.
EDIT:
The thing is I have seen the exact same model at someone else and it showed #EEEEEE perfectly. Does this mean I have to return my monitor ?

A: personally i would blame the monitor. different monitors (especially between manufacturers) will display the same image differently, whether because of different programming in the controller or because of different components.
i have a dual monitor setup at home (two different brands) and while one looks OK the other usually looks slightly too green. and no matter how much i fiddle with the controls (either through the graphics drivers or on the monitor itself) i can not get them to look the same.


text:
Q: NetBeans - How to stop annoying "insert button" popup from showing? If I hit tab multiple times to indent something, then I always get an anoying window showing up:

This is extremly annoying, how can I stop this?
UPDATE: I use Netbeans 8.2.
It seems to happen in .html files and also in blade templates but not in pure .php files.

I have to write something, if I then press tab a dropdown will appear sometimes if I then press tab again, then the Insert Button window shows.

A: I can't replicate your problem with NetBeans 8.2, but I can make that Insert Button window appear by doing the following:

*

*Edit an HTML file.

*Press control/space to open the autocomplete menu as shown in the OP.

*Hit enter, which selects the first entry on the dropdown menu, which happens to be Button.

*The Insert Button window opens.

A second way of making that happen is:

*

*Edit an HTML file.

*Type < to open the drop down menu of all HTML tags.

*Press backspace to switch to the menu in the OP screenshot.

*Hit enter, which selects the first entry on the dropdown menu, which happens to be Button.

*The Insert Button window opens.

In the second scenario the initial display of that drop down menu can be prevented:

*

*Tools > Options > Editor > Code Completion

*Select HTML as the Language.

*Uncheck Auto Popup Completion Window.

*Click Apply then click OK.

The change is immediately effective, so typing < no longer triggers the display of the drop down menu. Since I can't replicate your problem it may not fix your issue, but it's worth trying. You can still request the drop down menu by pressing control/space.

A: Here is the right answer:

Simply go to Tools/Palette/Code Clips and remove everything from
  Palette (all folders and items).


text:
Q: Cassandra: How long does a page exist? I paginate through a large collection of data (circa 500 000 000 rows) using PagingState, and do some business intelligence during this process. To be able to resume the process I created this table...
/**
 * This table stores temporary paging state
 */
 CREATE TABLE IF NOT EXISTS lp_operations.paging_state (
     id text,          // ID of process
     pos bigint,       // current position
     page text,        // paging state
     info text,        // info json
     finished tinyint, // finished
     PRIMARY KEY (id)
 ) WITH default_time_to_live = 28800; // 8 hours

..in which i store current page (string representation of PagingState) and JSON meta data associated with calculation.
Questions

*

*Can 'page' index expire in Cassandra?

*How long does it exist (by default)?

A: No, Cassandra Driver's Paging State will not Expire.
Because Every time you query with paging state, cassandra actually execute your query every time. It don't store your result. Paging State just tell cassandra from which index the driver want the data .

Due to internal implementation details, PagingState instances are not portable across native protocol versions. This could become a problem in the following scenario:

*

*you're using the driver 2.0.x and Cassandra 2.0.x, and therefore native protocol v2;

*a user bookmarks a link to your web service that contains a serialized paging state;

*you upgrade your server stack to use the driver 2.1.x and Cassandra 2.1.x, so you're now using protocol v3;

*the user tries to reload their bookmark, but the paging state was serialized with protocol v2, so trying to reuse it will fail.
Source : http://docs.datastax.com/en/developer/java-driver/3.2/manual/paging/


text:
Q: What is a convenient way to write OSM data to a .shp file in python I wish grab OSM data that is within a specified bounding box and matches specific key/value combinations. I then want to write this to a .shp file for further processing using, probably, the QGIS api.
I have successfully acquired OSM data within the bounding box using overpy and have it within an overpy.Result object. I just can't find a way to write it to a .shp file?
Can anyone direct me to a suitable fragment, preferably one that uses fiona?

A: If I use the first example of overpy
import overpy
api = overpy.Overpass()
# fetch all ways and nodes
result = api.query("""
way(50.746,7.154,50.748,7.157) ["highway"];
(._;>;);
out body;
""")

The resulting script give the names and the nodes of the ways. which are actualy the nodes of a LineString:
for way in result.ways:
    print("Name: %s" % way.tags.get("name", "n/a"))
    print("  Highway: %s" % way.tags.get("highway", "n/a"))
    print("  Nodes:")
    for node in way.nodes:
        print("    Lat: %f, Lon: %f" % (node.lat, node.lon))
    Name: Rhedenstraße
    Highway: residential
    Nodes:
        Lat: 50.746874, Lon: 7.156307
        Lat: 50.746598, Lon: 7.156237
        Lat: 50.746477, Lon: 7.156199
        ....

Therefore with Fiona:
import fiona
from fiona.crs import from_epsg
schema = {'geometry': 'LineString', 'properties': {'Name':'str:80'}}
shapeout = "test.shp"
with fiona.open(shapeout, 'w',crs=from_epsg(4326),driver='ESRI Shapefile', schema=schema) as output:
    for way in result.ways:
        # the shapefile geometry use (lon,lat)
        line = {'type': 'LineString', 'coordinates':[(node.lon, node.lat) for node in way.nodes]}
        prop = {'Name': way.tags.get("name", "n/a")}
        output.write({'geometry': line, 'properties':prop})

Control of the resulting shapefile
 c = fiona.open("test.shp")
 # first
 c.next()
 {'geometry': {'type': 'LineString', 'coordinates': [(7.1563067, 50.7468739), (7.1562371, 50.7465981), (7.1561995, 50.746477), (7.1561245, 50.7463604), (7.1560233, 50.746263), (7.1559261, 50.7461938), (7.155843, 50.7461387)]}, 'type': 'Feature', 'id': '0', 'properties': OrderedDict([(u'name', u'Rhedenstra\xdfe')])}

Control with QGIS (in red):

You can add