text:
Q: Loop through Dates vb.net I want to create a datagridview every day. Here is my code so far. It's not displaying any errors but when I run the code it just load the form but the dgv does not appear. What can I do?
   Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim start As Date = Date.Now
        Dim apocap As Date = Date.Parse(#8/22/2050#)
        Dim loopdate As Date = start

        While start < apocap
            Dim dgv As New DataGridView
            With dgv
                .Size = New Size(250, 250)
                .ColumnCount = 2
                .RowCount = 12
                .Location = New Point(12, 9)
                .Visible = True

            End With

            start = start.Date.AddDays(1)
        End While
    End Sub
End Class

A: You have to add them to your form. Additionally, you'll want to change the .Left and/or .Top (.Location) properties so they don't all stack on top of each other:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Dim start As DateTime = DateTime.Today
    Dim apocap As New DateTime(2050, 8, 22)
    Dim i As Integer = 0

    While start < apocap
        Dim dgv As New DataGridView
        With dgv
            .Size = New Size(250, 250)
            .ColumnCount = 2
            .RowCount = 12
            .Location = New Point(12, (9 + (250 * i)))
            .Visible = True
        End With

        Me.Controls.Add(dgv)
        i += 1
        start = start.AddDays(1)
    End While
End Sub

For fun, I like to write it like this:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Dim start As DateTime = DateTime.Today
    Dim apocap As New DateTime(2050, 8, 22)
    Dim count As Integer = CInt((apocap - start).TotalDays)

    Me.Controls.AddRange(Enumerable.Range(0, count).Select(
       Function(i)
           Return New DataGridView With {
             .Size = New Size(250, 250),
            .ColumnCount = 21,
            .RowCount = 12,
            .Location = New Point(12, (9 + (250 * i))),
            .Visible = True
            }
            'start.AddDays(i) is there if you need it
       End Function
    ).ToArray())
End Sub


text:
Q: Compiling existing C# code to WebAssembly Is it possible to compile existing C# code to WebAssembly (.wasm) so that no or nearly no code changes have to be done?
Do I have to use Blazor for it or are their other possibilities?

A: Use .NET 7. This support for compiling C# to wasm is now officially added even outside of the Blazor ecosystem.
https://devblogs.microsoft.com/dotnet/use-net-7-from-any-javascript-app-in-net-7/
Full .NET 7 release notes: https://devblogs.microsoft.com/dotnet/announcing-dotnet-7/
While still slightly raw around the edges, this is supposed to get buttoned up and refactored significantly for .NET 8, according to the first comment here.

A:
Is it possible to compile existing C# code to WebAssembly (.wasm)

No, there is no compiler (yet). But

so that no or nearly no code changes have to be done?

That is easy, you can simply add .net DLLs (packages) to your project.
Just make sure that the code makes sense in a Browser, ie no Threading, no I/O except HttpClient etc.

Do I have to use Blazor for it or are their other possibilities?

For now there is only Blazor.

redpajama_set_name: RedPajamaStackExchange


text:
Q: MS CRM - Getting Wrong date through CRM Webservice When I retrieve an entity through the crm webservice (CRM SDK) I receive on one Server a really strange behavior.
In the CRM (webinterface) the stored date (dateonly) is : 18.02.2019 (UTC+1)
The Database shows : 17.02.2019 23:00:00 (UTC)
At this part, all is correct.
But when I retrieve the record on a console app (=running on the CRM server) the mentioned field is set to 18.02.2019 23:00:00 (so 19.02.2019 in UTC+1).
Running the application localy (on my pc) it returns the correct datetime 17.02.2019 23:00:00.
Is there a serversetting or so which I missed?
The timezone on the server is UTC+1 Amsterdam,Berlin.

A: This may have something to do with the DateTime's Kind property in the console app.
You might be able to resolve this with:
DateTime.SpecifyKind(myDateTime, DateTimeKind.Utc);
Or simply:
myDateTime.ToUniversalTime()

A: There are a number of different Behavior and format of the date and time attribute. Depending on your situation I suspect one of these will explain the behaviour you are seeing.

UserLocal

*

*The retrieve operation returns the UTC value.

*Retrieving the formatted value converts from UTC to the user's current time zone based on the time zone and locale setting of the
  user.

  DateOnly

*

*For the retrieve and update operations, no time zone conversion is performed, and the time value is always 12 AM (00:00:00).

*Retrieving the formatted value displays the date value without any time zone conversion.

  TimeZoneIndependent

*

*For the retrieve and update operations, no time zone conversion is    performed, and actual date and time values are returned and updated
  respectively in the system regardless of the user time zone.

*Retrieving the formatted value displays the date and time value    (without any time zone conversion) based on the format as specified
  by the current user's time zone and locale setting.


text:
Q: Difference between two dates in days Why do I get the following outcomes?
today        = 2014-01-06
selected_day = 2014-01-06

Outcome is 0
today        = 2014-01-06
selected_day = 2014-01-07

Outcome is 0
today        = 2014-01-06
selected_day = 2014-01-08

Outcome is 1
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date d1 = df.parse(today);
Date d2 = df.parse(selected_date);
Calendar c1 = Calendar.getInstance();
c1.setTime(d1);
Calendar c2 = Calendar.getInstance();
c2.setTime(d2);
long diff = c1.getTimeInMillis() - c2.getTimeInMillis();
System.out.println(diff / (24 * 60 * 60 * 1000));

A: Because you are setting both dates to the same calendar instance
Calendar c2 = Calendar.getInstance();
c1.setTime(d2); // this is wrong :)

change the second c1 to c2 ;)

A: you can set like this way
 cal.set(2008, 8, 1);

use like this way
long diff = daysBetween(cal1.getTime(),cal2.getTime());

public int daysBetween(Date d1, Date d2){
            return (int)( (d2.getTime() - d1.getTime()) / (1000 * 60 * 60 * 24));
         }

A: At first instance I misunderstood exact problem. Now when I am clear on that side I thought of putting some info regarding same.
Getting difference considering Date as parameter .. try like this.
public static int getDaysDifference(Date fromDate,Date toDate)
{
if(fromDate==null||toDate==null)
return 0;

return (int)( (toDate.getTime() - fromDate.getTime()) / (1000 * 60 * 60 * 24));
}

Getting difference considering Calendar as parameter .. try like this.
public static int getDaysDifference(Calendar calendar1,Calendar calendar2)
{
if(calendar1==null||calendar2==null)
return 0;

return (int)( (calendar2.getTimeInMillis() - calendar1.getTimeInMillis()) / (1000 * 60 * 60 * 24));
}

Simply pass value to it. :)
Now if you need to check difference with some values and U need to put some condition then U may try using CompareTo function for that ..
Fallow undermentioned ..
Define your variables like this ..
java.util.Date d1;
java.util.Date d2;

Your function like this ..
public long compareTo(Date d1, Date d2) {
        // TODO Auto-generated method stub
        return d1.getTime() - d2.getTime();

    }

Now when you need to use this .. try like this
try{

                        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");

                        try {
                            d1 = sdf.parse(pDisplayDate.getText().toString());
                            d2 = sdf.parse(current_day_validate);
                        } catch (ParseException e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                        }

                        /*System.out.println("1. " + sdf.format(d1).toUpperCase());
                        System.out.println("2. " + sdf.format(d2).toUpperCase());*/

                        if(compareTo(d1, d2) >= 0){
                            sm = new SessionManagement(getApplicationContext());

                            if (service_recog_id == 1) {
                                request_url = StaticVars.service_url;
                                new BussinessOwnerHttpAsyncTask().execute();
                            } else if (recognition_id == 3) {
                                request_url = StaticVars.business_owner_url;
                                new BussinessOwnerHttpAsyncTask().execute();
                            } else if (recognition_id == 4) {
                                request_url = StaticVars.service_provider_url;
                                new BussinessOwnerHttpAsyncTask().execute();
                            } else if (recognition_id == 6) {
                                request_url = StaticVars.service_category_url;
                                new BussinessOwnerHttpAsyncTask().execute();
                            }
                        }else{
// Your other stuff
}
}catch(Exception e){
// Your exception
}


text:
Q: Airflow DAG fails when PythonOperator tries to call API and download data I'm trying to configure Airflow on my laptop for the first time (without using docker, just following documentation). My goal is to set up a simple ETL job.
I've written the simplest possible DAG with one PythonOperator:
from datetime import timedelta
from view import spotify_etl
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.utils.dates import days_ago

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': days_ago(2),
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=1),

}
dag = DAG(
    'airflow_dag_tutorial-new',
    default_args=default_args,
    description='A simple tutorial DAG',
    schedule_interval=timedelta(days=1),
)

run_etl = PythonOperator(
        task_id='main_task',
        python_callable=spotify_etl,
        dag=dag,
    )

run_etl

When I pass a dummy function with a print statement, the DAG runs successfully. But then, when I pass my function spotify_etl that calls Spotify API, the DAG fails. This is the function:
def spotify_etl():
    token = 'xxx'

    headers = {
    'Accept' : "application/json",
    'Content-Type': "application/json",
    'Authorization': 'Bearer {token}'.format(token=token)
    }

    today = datetime.datetime.now()
    yesterday = today - datetime.timedelta(days=100)
    yesterday_unix_timestamp = int(yesterday.timestamp()) *1000

    r = requests.get("https://api.spotify.com/v1/me/player/recently-played?after={time}".format(time=yesterday_unix_timestamp), headers=headers)
    data = r.json()
    print(data)

The error I get is:
[2020-11-08 12:35:23,453] {local_task_job.py:102} INFO - Task exited with return code Negsignal.SIGABRT

Does anyone know how to use PythonOperator correctly for a function that calls API? What is causing this error?
I tried setting: export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES in my venv (as suggested here: Airflow task running tweepy exits with return code -6 and here: https://github.com/ansible/ansible/issues/32499#issuecomment-341578864) but that doesn't seem to have fix it.

A: It turned out that the "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" was not set correctly. It had to be added to .zshrc instead of .bash_profile. That solved it.


text:
Q: Is it possible to connect via ssl to a remote mysql db using php without certificates or keys? Lets say I have a client that gives me db credentials, and they want to connect to the db with a secure/encrypted. They also enabled ssl in their mysql setup. When they give me their db creds, i dont want to ask them for keys and certs. So is it possible to have a encrypted secure connection via ssl when connecting to the clients db with out those items?
update:
so after further tinkering around
$db->ssl_set(NULL, NULL,'/path_to_self_signed_cert/ca.pem',NULL,'');
$db->real_connect('hostname','username','password','dbname',
'port'socket', MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT);`

doing this got me the outcome i wanted after running this
$db->query("SHOW STATUS LIKE 'Ssl_cipher';");

displayed the cipher algorithm instead of being blank
  (
   [0] => Ssl_cipher
   [Variable_name] => Ssl_cipher
   [1] => DHE-RSA-AES128-SHA
   [Value] => DHE-RSA-AES128-SHA
  )

but dont really know why this worked, is a self signed cert the proper way of doing this ?

A: @rickjerrity i connect to my remote db via command line, and check the status by running \s and says SSL: Cipher in use is DHE-RSA-AES256-SHA. But when i connect to the same database using php and using the same credentials it says the cipher is empty. here is the code I used to connect to the remote db
$db = mysqli_init();
    $db->real_connect('hostname','username','password','dbname');
    $res = $db->query("SHOW STATUS LIKE 'Ssl_cipher';");
    while ( $row = $res->fetch_array() ) {
        print_r($row);
    }
    $db->close();

and the response is
[0] => Ssl_cipher
[Variable_name] => Ssl_cipher
[1] =>
[Value] =>

A: No client side certificate or key should be needed for a secure db connection, besides the db credentials. PHP should verify SSL cert integrity upon connection. Any other PHP methods capable of verifying the connection's encryption status would be for sanity sake, like you mentioned. If you show some specific code examples we may be able to assist further.


text:
Q: Gotchas with SQL Server Full-Text Search I want to compile a list of gotchas when using SQL Server full-text search in all versions.
For instance, Here's a SQL Server Full-Text gotcha:

SQL Server 2008 R2 has a new feature
  called Data-Tier Applications - which
  is a way to package a database schema
  meant to be deployed elsewhere.
  Certain objects like Full-Text
  Catalogs can't be packaged and must
  first be remove before a "DAC Pack"
  can be created. So you can't create a
  DAC Pack when there's a Full-Text
  Catalog in the database.

Can anyone else think of any other SQL Server Full-Text gotchas? Thanks.

A: If you detach a database with a full text catalog, the catalog is not a part of the normal database files, it has its own storage in a folder that has to be copied with the database mdf, ldf, and ndf files.  I've seen this be a problem for some people but it is recoverable.


text:
Q: Best practice to organize data on new two drive PC I recently bought a pre-built new desktop PC and have a little question about how to organize data.
The desktop has a 256GB SSD labelled as "Windows" C: drive, and has Windows 10 installed on it. There is also an 7200RPM 1TB HDD, labelled as "DATA" D: drive, and on this same HDD there is a OEM partition labelled as "RECOVERY" of 17.34GB (guessing this is a Windows recovery thing).
When I install new software/program/game, it goes by default on the C: drive(SSD). I already installed a few programs on it, but now I wonder what the best practic(s) is(are) for installation in a two-drive Windows system such as this.
Should I change the default path so all new programs install on the 1TB HDD D: drive instead? Because as of now, everything, including downloads, seem to go to the SSD drive, and since its only 256GB it will end up to be full at some point. Also, I don't see why the D: 1TB drive is there, if nothing will go on it.
What's the best practice to follow?

A: This is somewhat a matter of opinion.
But the way I would choose to do it is to put all programs and system files on C: and all my data on D:.
You want the speed of the SSD for the operating system and related files and for your programs to open quickly. The hard drive is good for your data where you don't particularly need a lot of speed.
To do so, all you really have to do is relocate your user data folders to the D: drive. First, make a folder on the D: drive called something like data then open file explorer to your user profile folder by navigating to C:\users\<your username>. Then drag and drop the data folders (documents, pictures, movies, music, downloads, etc.) to the folder you put on the D: drive. Windows will ask if you want to move your data to the new location and you can answer positively.
Now your data will be on D: and you can continue to install programs on C: without much worry of filling the SSD. The data folders have been "redirected" and the built in links to Documents, Pictures, etc. will continue to function as normal.
And, most importantly, don't forget to back up your data.


text:
Q: Turn off manifest.js generation in Nuxt full static generation How do I turn off the generation of manifest.js which contains the routes for full static generation. I have a Nuxt app with ~150k routes and this manifest.js file takes around ~12 MB in size. This feature was added in this commit (https://github.com/nuxt/nuxt.js/commit/691f21c6832323902d899b56566dd97d63683528#diff-ba07960f44050961fcce0824ffa64cdbf93ef44a64329d5eeea765b616a5e9e7) and may affect versions 2.14.8 and up
code reference:
https://github.com/nuxt/nuxt.js/blob/9681a8937d0c973bc685b757faa686023a4536fc/packages/generator/src/generator.js#L61
https://github.com/nuxt/nuxt.js/blob/9681a8937d0c973bc685b757faa686023a4536fc/packages/generator/src/generator.js#L32

A: In nuxt.config.js, set generate.manifest to false


text:
Q: ProcessStartInfo got error and won't work on IIS / Windows Server 2016 I've found a code snippet from http://codebetter.com/brendantompkins/2004/05/13/run-a-bat-file-from-asp-net/ which one runs a bat file from ASP.NET code. It works in Visual Studio, however I couldn't run it at server. Screenshot is below:

And the code:
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;

Detailed errors:

What would be wrong here?
The code below has also got the error:
 System.Diagnostics.Process proc = new System.Diagnostics.Process();
 proc.StartInfo.FileName = "cmd.exe";
 proc.StartInfo.UseShellExecute = false; // This line won't compile

A: My bad! The line below has been erased:
protected void Page_Load(object sender, EventArgs e)
{


text:
Q: Do Team Attacks and Counter Attacks count toward weapon skill? As per the title, when your character counterattacks, or is part of a Team Attack, do they gain skill in their weapon?
If it makes a difference, I am playing the PC version currently.

A: According to this Gamefaqs Q&A, counterattacks do add to the weapon skill.

Weapon Skill is gained by every attack of the weapon,including skill like skull spliter,don't need to finish the enemy.
The only exeption is staff;it gains weapon skill by Attacks and Magics.


text:
Q: React MSAL: how to logout from all devices? We have an application where we use msal-react for login/logout.
Is there a way to log out of all devices with which a user is logged in when logging out?
Unfortunately, nothing can be found in the official documentation about this.
We also have a problem with login, so that the user has to log in again in a new tab (when opening different micro frontends - which all use the same login session), although the token is stored in local storage.
Hope someone can help here or provide a documentation.

A: When you have to logout of all devices through an application using msal-react, then you can surely configure the required application for signing out of all instances of logged in application as below:

MSAL.js v2 provides a logoutpopup method that clears the cache in browser storage and opens a pop-up window to the Azure Active Directory (Azure AD) sign-out page. After sign-out, Azure AD redirects the pop-up back to your application and MSAL.js will close the pop-up.

In this way, you can ensure that your react application has logged out of Azure Active Directory and all devices reciprocate the information that the user has logged out.
Signing out with a pop-up window:
 import { useMsal, AuthenticatedTemplate, UnauthenticatedTemplate } from "@azure/msal-react";

 function signOutClickHandler(instance) {
 const logoutRequest = {
    account: instance.getAccountByHomeId(homeAccountId),
    mainWindowRedirectUri: "your_app_main_window_redirect_uri",
    postLogoutRedirectUri: "your_app_logout_redirect_uri"
  }
  instance.logoutPopup(logoutRequest);
 }

// SignOutButton Component returns a button that invokes a popup logout when clicked
  function SignOutButton() {
// useMsal hook will return the PublicClientApplication instance you provided to MsalProvider
const { instance } = useMsal();

return <button onClick={() => signOutClickHandler(instance)}>Sign Out</button>
 };

  // Remember that MsalProvider must be rendered somewhere higher up in the component tree
  function App() {
   return (
    <>
        <AuthenticatedTemplate>

This will only render if a user is signed-in.

            <SignOutButton />
        </AuthenticatedTemplate>
        <UnauthenticatedTemplate>

This will only render if a user is not signed-in.

        </UnauthenticatedTemplate>
       </>
      )
    }

Similarly, if you refer to the method for signing out of the application using the redirect method, you will have to configure the URI to which it should redirect after sign-out by setting postLogoutRedirectUri. This URI should be registered as a redirect URI in your application registration.
For more information, kindly refer to the documentation link below:
https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-sign-in?tabs=react#sign-out-with-a-pop-up-window


text:
Q: Ошибка при подключении библиотеки thread Нашёл книгу по параллелизму на С++ и решил опробовать первый же листинг:
#include <iostream>
#include <thread>
void hello()
{
   std::cout<<"Hello Concurrent World\n";
}
int main()
{
   std::thread t(hello);
   t.join();
}

Ну и тут же возникла проблема, компилятор (VS2010) не может открыть заголовочный файл thread. Кто может подсказать, как исправить этот недочёт?

A: Я бы рекомендовал пока пользоваться boost.thread, пока новый стандарт не устоялся.
Кстати, создатель библиотеки boost.thread и есть автор приведенной книги, так что все примеры оттуда должны работать.
A: Похоже, что это новый стандарт C++11. Visual Studio его не полностью поддерживает, там этого файла нет. Попробуй на GCC, там C++11 поддерживается намного лучше, чем в VS. Сюда приделать этот файл не получится. Либо попробуй другие способы для создания многопоточных приложений, их много.
A: Студия пока не поддерживает полностью эту часть стандарта C++11. Основано это все на платной, к сожалению, библиотеке just::thread. Этот пример соберется gcc версии 4.5 и выше.
P.S. Попробуй boost и другие библиотеки.


text:
Q: AWK usage issue while archiving HDFS files in Hortonworks Distribution I am trying to move files in a HDFS directory that are over 3 days old to an archiving folder in HDFS.
AWK Script:
hdfs dfs -ls hdfs://companycluster/data/src/purecloud/current | tail -n+2 | xargs -n 8 |
awk '{
DAY_CONV=(60*60*24);
X ="date +%s";X | getline ED;printf("") > "X";close("X");
Y="date -d \"$6\" +%s";Y | getline SD;printf("") > "Y";close("Y");
DIFF=(ED-SD)/DAY_CONV;
print " SD=",SD" ED=",ED," DIFF=",DIFF," INPUT=",$6;
if ( DIFF -gt 3)
cmd="hdfs dfs -ls " $8;
system(cmd);
}'

Note: cmd variable would have a mv command once this script starts working
Issue:

*

*Value of variable X is constant

*Value of Variable Y is constant

*Unable to get day difference between 2 date , i get fraction value in DIFF

*If statement in AWK is failing due to inaccurate arguments

Input to AWK:
-rw-r--r-- 3 user hdfs 50687424 2017-02-27 17:06 hdfs://companycluster/data/src/purecloud/current/Conversation.json.240220170000
-rw-r--r-- 3 user hdfs 49967359 2017-02-27 17:06 hdfs://companycluster/data/src/purecloud/current/Conversation.json.250220170000
-rw-r--r-- 3 user hdfs 28647041 2017-02-27 17:00 hdfs://companycluster/data/src/purecloud/current/Conversation.json.260220170000
-rw-r--r-- 3 user hdfs 6728724 2017-03-01 13:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1305
-rw-r--r-- 3 user hdfs 7050854 2017-03-01 13:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1325
-rw-r--r-- 3 user hdfs 6630106 2017-03-01 13:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1345
-rw-r--r-- 3 user hdfs 6766650 2017-03-01 14:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1405
-rw-r--r-- 3 user hdfs 6486095 2017-03-01 14:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1425
-rw-r--r-- 3 user hdfs 6350705 2017-03-01 14:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1445
-rw-r--r-- 3 user hdfs 6082589 2017-03-01 15:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1505
-rw-r--r-- 3 user hdfs 6417281 2017-03-01 15:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1525
-rw-r--r-- 3 user hdfs 6519949 2017-03-01 15:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1545
-rw-r--r-- 3 user hdfs 6988534 2017-03-01 16:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1605
-rw-r--r-- 3 user hdfs 6734459 2017-03-01 16:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1625
-rw-r--r-- 3 user hdfs 6842766 2017-03-01 16:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1645
-rw-r--r-- 3 user hdfs 6575513 2017-03-01 17:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1705
-rw-r--r-- 3 user hdfs 6574050 2017-03-01 17:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1725
-rw-r--r-- 3 user hdfs 50215096 2017-02-27 18:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-27_1801
-rw-r--r-- 3 user hdfs 50985760 2017-02-27 18:18 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-27_1818
-rw-r--r-- 3 user hdfs 58206776 2017-02-28 00:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_0001
-rw-r--r-- 3 user hdfs 58823497 2017-02-28 06:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_0601
-rw-r--r-- 3 user hdfs 61591660 2017-02-28 12:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_1201
-rw-r--r-- 3 user hdfs 59703667 2017-03-01 10:40 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_1801
-rw-r--r-- 3 user hdfs 59160075 2017-03-01 10:47 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-03-01_0001
-rw-r--r-- 3 user hdfs 61812121 2017-03-01 10:48 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-03-01_0601
-rw-r--r-- 3 user hdfs 63804772 2017-03-01 12:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-03-01_1201

Output from AWK (Has debugging prints):
  SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-27
-rw-r--r--   3 user hdfs   50687424 2017-02-27 17:06 hdfs://companycluster/data/src/purecloud/current/Conversation.json.240220170000
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-27
-rw-r--r--   3 user hdfs   49967359 2017-02-27 17:06 hdfs://companycluster/data/src/purecloud/current/Conversation.json.250220170000
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-27
-rw-r--r--   3 user hdfs   28647041 2017-02-27 17:00 hdfs://companycluster/data/src/purecloud/current/Conversation.json.260220170000
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6728724 2017-03-01 13:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1305
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    7050854 2017-03-01 13:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1325
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6630106 2017-03-01 13:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1345
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6766650 2017-03-01 14:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1405
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6486095 2017-03-01 14:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1425
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6350705 2017-03-01 14:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1445
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6082589 2017-03-01 15:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1505
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6417281 2017-03-01 15:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1525
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6519949 2017-03-01 15:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1545
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6988534 2017-03-01 16:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1605
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6734459 2017-03-01 16:25 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1625
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6842766 2017-03-01 16:45 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1645
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs    6575513 2017-03-01 17:05 hdfs://companycluster/data/src/purecloud/current/conversation.json.2017-03-01_1705
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-27
-rw-r--r--   3 user hdfs   50215096 2017-02-27 18:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-27_1801
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-27
-rw-r--r--   3 user hdfs   50985760 2017-02-27 18:18 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-27_1818
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-28
-rw-r--r--   3 user hdfs   58206776 2017-02-28 00:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_0001
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-28
-rw-r--r--   3 user hdfs   58823497 2017-02-28 06:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_0601
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-02-28
-rw-r--r--   3 user hdfs   61591660 2017-02-28 12:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_1201
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs   59703667 2017-03-01 10:40 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-02-28_1801
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs   59160075 2017-03-01 10:47 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-03-01_0001
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs   61812121 2017-03-01 10:48 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-03-01_0601
 SD= 1488286800 ED= 1488348518  DIFF= 0.714329  INPUT= 2017-03-01
-rw-r--r--   3 user hdfs   63804772 2017-03-01 12:01 hdfs://companycluster/data/src/purecloud/current/conversation_6hr.json.2017-03-01_1201

Distribution Information:

*

*Hortonworks

*Hadoop 2.7.1.2.4.0.0-169

*Linux dh01 aaaaaaaaaaaaa.x86_64 #1 SMP   Sun Jul 27 15:55:46 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

Any input will be greatly helpfull.

A: hdfs dfs -ls hdfs://companycluster/data/src/purecloud/current | tail -n+2 | xargs -n 8 \
| awk '
      BEGIN {
        # take the time reference (3 days before now)
        R = systime() - 3 * 86400
        }
      # for each line
      {
      # format used by mktime "YYYY MM DD HH MM SS [DST]"
      # create the time in mktime format
      t = $6 " " $7 " 00";gsub( /[-:]/, " ", t)
      # convert in epoch
      T = mktime( t )
      # if lower than reference time
      if( T < R ) {
         print "Included line: " $0

         # do what you want as action
         cmd = "hdfs dfs -ls " $8
         system( cmd )
         }
       else {
         print "Discarted line: $0"
         }
      }'

Comment:

*

*self commented awk

*the input to awk could certainly be optimized (awk do tail very well and xargs is certainly not mandatory here [no hdfs to test from here])


text:
Q: Can't ping Bonjour address can actually connect to it There is something weird going on on my network.
I have a raspberry running Raspbian, with name "Myraspberry" and i am trying to find the IP address from my computer running windows with Bonjour installed on it.
if i ping Myraspberry.local i get nothing, but if i open Bonjour Browser i am actually getting the IP and name correctly. I can connect via SSH with putty using that name which makes me wonder that there is something fishy going on.
So what could be the cause of not being able to ping the device?

A: SO I had installed bonjour itself, by uninstalling it and installing itunes made it to work properly, might be a bug on the stand alone bonjour


text:
Q: Div to only show elements that fit inside it? I have a div #sampledogs that is not of fixed height. It shows records from mysql(dogs needing rehomed).
I use some jquery to make the div the same height as another div on the page. This is the problem i have: depending on the height of #sampledogs it can show part of a record at the bottom(image description)
Is there any way that i cant get it so that if the full record cant be shown then it shouldnt show any of that record?
This is my #sampledogs div that shows the records

<?php
include 'inc/connect.php';
$q = mysqli_query($link, "SELECT filename, name, age, sex  FROM gallery WHERE gallery =
                   1 ORDER BY RAND()") or die (mysql_error());
while($row = mysqli_fetch_array($q)){
   $data = $row['filename'];
   $file = substr($data, strpos($data, "/") + 1);
   echo"
",
   "",
   'NAME: ',$row['name'],"
",'AGE: ',$row['age'],"
",'SEX: ',$row['sex'],
   "
";
}
?>

And this is the css for #sampledogs
#sampledogs{
width:200px;
min-height:900px;
text-align:center;
color:#a3a095;
position:absolute;
top:7%;
right:20px;
overflow:hidden;
}

Rendered html

NAME: ribbbon
AGE: approx 4
SEX: female

NAME: jjjjjjjjjjjjjjjjj
AGE: kkkkkkkkkkkkkk

SEX: kkkkkkkkkkkkkkkk

NAME: webdesign
AGE: 3
SEX: male

NAME: pnglogo
AGE: 9999
SEX: male

NAME: purple
AGE: 8
SEX: male

NAME: dude
AGE: 7
SEX: female

NAME:
hhhhhhhhhhhhhhhhhhhhhhhhhhhhh
AGE: hhhhhhhhhhhhhhhh
SEX:
hhhhhhhhhhhhhhhhhh

NAME:
AGE:
SEX:

NAME: web
AGE: 4
SEX: male

Edit: This is the jquery I'm trying to use
var neededHeight = $("#sampledogs").outerHeight(); //you can also use static value
var totalChildHeight = 0;
$(".homedogs").children.each(function() {
totalChildHeight+= $(this).outerHeight(); //add up to the total height
if(totalChildHeight> neededHeight) {  //compare if the height limit was exceeded
$(this).hide(); // if it did, hide the current element
$(this).nextAll().hide(); //hide all other list also
return false; // break the loop to stop the further iteration
}
});

Is what i want to do possible?


text:
Q: Why is there no WORD_BIT in limits.h on Linux? From the manpage man limits.h:
       {WORD_BIT}
             Number of bits in an object of type int.
             Minimum Acceptable Value: 32

However if I run a simple program:
#include <limits.h>
#include <stdio.h>

int main() {
  printf("%d\n", WORD_BIT);
  return 0;
}

However when trying to compile with gcc (gcc file.c -o file) I get the following:
error: 'WORD_BIT' undeclared (first use in this function)

How come this is not defined on my system, and where else can I find this information (in a C program)?
My system:

*

*Fedora 36 (Silverblue)

*gcc version 12.2.1 20220819 (Red Hat 12.2.1-1) (GCC)

*ldd (GNU libc) 2.35

A: The gcc has a set of builtin defines. The one you looking for is __SIZEOF_INT__
Full list of defines is in the documentation:
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
The pro-con of using these instead of those defined in limits.h is that the defines built into compiler are built into compiler - they are absolutely correct for this particular platform but are tied to this particular brand of compilers.
But for size of the int it is much easier to use sizeof(int).

A: I'm not sure this is documented, but with the GNU C library you need to set _GNU_SOURCE to get WORD_BIT:
$ gcc -include limits.h -E - <<<"WORD_BIT" | tail -n1
WORD_BIT

$ gcc -D_GNU_SOURCE -include limits.h -E - <<<"WORD_BIT" | tail -n1
32

You should really use sysconf:
#include <unistd.h>
#include <stdio.h>

int main(int argc, char **argv) {
  printf("%ld\n", sysconf(_SC_WORD_BIT));
}

or, as recommended in the GNU C library documentation:
#include <limits.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char **argv) {
#ifdef WORD_BIT
  printf("%d\n", WORD_BIT);
#else
  printf("%ld\n", sysconf(_SC_WORD_BIT));
#endif
}

(As for why this appears in man limits.h, this man page is the POSIX reference for limits.h, and doesn't necessarily document the C library on your system exactly. You can see this by looking at the section of the man page — the "P" suffix indicates that it's POSIX documentation.)
You could use sizeof(int) * CHAR_BIT instead; CHAR_BIT is always defined. What's more, POSIX extends the C standard and specifies that CHAR_BIT is 8, so if you assume POSIX, you could use sizeof(int) * 8.


text:
Q: Flutter theme data why this color does not work but the others do I just started to learn flutter, so I was curious about why this color doesn't work but others one do it.
void main() {
  runApp(
    MaterialApp(
      title: 'Hey',
      theme: ThemeData(primarySwatch: Colors.deepPurpleAccent),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Heyyy'),
        ),
        body: Center(
          child: Text('Testing'),
        ),
      ),
    ),
  );
}

Colors.deepPurpleAccent doesn't seem to work but Colors.deepOrange it does. Why? Thanks!
Update:

I just tried as @yahya parvar said. For some reason if I do that it gives this error message.
The constructor returns type 'Color' that isn't of expected type 'MaterialColor'.
So I tried using the color from a const variable, and it doesn't give me any error but the screen is full of white.

However, I was just more curious of why this is happening and why colors like Colors.deepPurpleAccent doesn't seem to work while others like Colors.deepOrange does it than the color itself to work. Thanks!

A: your problem is you want to use a color with type of MaterialAccentColor
but ThemeData class takes MaterialColortype , which has different
if you want to set a background for your entire screen there is several way to do that one of the is the one that you want to use another one is set a background for scaffold try this
Scaffold(background:Colors.deepPurpleAccent)


text:
Q: Adding label on Edges in GraphSharp I'm Using Graph# in VB.net i can easily add nodes and edges in it but how can i add labels on these edges ?? can anybody help ...
here's my codes to add nodes and edges
Dim g = New CompoundGraph(Of Object, IEdge(Of Object))()

Dim vertices = New String(29) {}
   For i As Integer = 0 To 29
      vertices(i) = i.ToString()
      g.AddVertex(vertices(i))
   Next i

And
g.AddEdge(New Edge(Of Object)(vertices(0), vertices(1)))

A: Dim g = New BidirectionalGraph(Of Object, IEdge(Of Object))()

'add the vertices to the graph
Dim vertices As String() = New String(4) {}
For i As Integer = 0 To 4
   vertices(i) = i.ToString()
   g.AddVertex(vertices(i))
Next

'add some edges to the graph
g.AddEdge(New Edge(Of Object)(vertices(0), vertices(1)))
g.AddEdge(New Edge(Of Object)(vertices(1), vertices(2)))
g.AddEdge(New Edge(Of Object)(vertices(2), vertices(3)))
g.AddEdge(New Edge(Of Object)(vertices(3), vertices(1)))
g.AddEdge(New Edge(Of Object)(vertices(1), vertices(4)))

_graphToVisualize = g


text:
Q: UiTableView appearing in wrong place on ViewController ios Im currently working on an app that when a button is pressed, it presents a view controller modally over the one the button is on. This works fine and appears in the correct place, however, the modal view controller contains a UiTableView and this seems to appear in the top left of the view controller, no where near where I placed it in storyboards. I have tried adding all the constraints as the image shows below but with no luck. When I add the constraints, the tableview doesn't appear at all.

Hopefully Someone can help as I have hit a dead end.
Thanks
Jamie

A: Ok, it looks like you made your UI using storyboards. That's alright, but you should be aware that there is another way to create your UI elements (tableViews, buttons, etc.): programmatically.
Because you used storyboards, you may have forgotten to check/uncheck some setting in it that may cause the problem you are experiencing, and I probably won't be able to diagnose your problem easily. So I will show you how to fix this programmatically.
Programmatically
You can set the constraints of your tableView programmatically, within the viewController that you are trying to present.
So if your viewController to be presented is called viewController and your tableView is tableView, you should have the following:
class viewController: UIViewController {
    @IBOutlet weak var tableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()

        /* First, tell XCode that you want to manually set the tableView's constraints using AutoLayout */

        tableView.translatesAutoresizingMaskIntoConstraints = false
        self.addSubview(tableView)

        /* setup constraints for your tableView */
        tableView.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
        tableView.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
    }
}

Another (much easier) way to create a viewController that contains a tableView is to simply have the viewController inherit from UITableViewController instead of UIViewController. This is a neat little inheritance trick that you can use to make your code much more concise and avoid writing code that does not need to be written. If you inherit from UITableViewController, you automatically get a "free" tableView inside you viewController without needing to create a new one:
class viewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

Usually, we have a viewController inherit from UITableViewController if we are only planning to have a single UI element inside it: a tableView. On the other hand, if we want to have a more intricate layout in our viewController (such as a tableView taking only a section of the viewController and the rest of the space being taken up by other UI elements), then we might want to have the viewController inherit from UIViewController and then create a tableView inside it (like in the first example I showed you).
Storyboard
When using storyboards, the first thing you should make sure that you are doing right is that you are using AutoLayout to set your constraints for your tableView. In main.storyboard, go to the view you want to present and click on the tableView. Then, hover your mouse over the "Align" button, right here:

Make sure that you check both "Horizontally in Container" and "Vertically in Container". This centers your tableView within its superView.
Then, also modify the following:

Make sure that the "Constraint to margins" option is checked. This constraints the margins of your tableView to its superView (ideally).


text:
Q: how can i acieve the following code in java this code is in php where there are different type of json objects in an array
function data($text, $number, $user_id, $port = NULL, $encoding = NULL)
    {
    $data = array
    (
        "text" => "#param#",
        "param" => array
        (
            array(
            "number" => $number,
            "text_param" => array($text),
            "user_id" => $user_id,
            ),
        ),
    );
    if ($port != NULL) {
        $data["port"] = array($port);
    }

    if ($encoding != NULL) {
        $data["encoding"] = $encoding;
    }
    return $data;
}

what are the possible ways to write the above code in java

A: Don't look for direct, native support of translating json straight into Java objects, it needs to be done through libraries.
There are a (quite big) number of json libraries - GSON is one that I used, java EE json support is another. Search for others using your preferred search engine.

A: Use Jackson library to parse JSON to Java object.


text:
Q: Javacsript/CSS not working correctly in Safari? Really hoping someone can help me as I've been trying to fix this for weeks! I have some css slide/fade effects that are triggered when user clicks any of the text links on the yellow section of this page, all working fine in Chrome but on Safari the following is happening:
When you click the text link to go to the next page, then you go back to the home page the effects are triggered again when the home page loads, and then if you click another link the effects are not triggered. There must be a simple solution to get this working on Safari?
Sorry I cant post a working snippet here, but its an entire page that is effected and only on Safari so its difficult to replicate it here. I have added the CSS and JS that im using though.

  jQuery(".hometext").click(function() {
    jQuery(this).toggleClass("slide");
    jQuery(".hometext").toggleClass("active");
        jQuery("#header-elementor").toggleClass("active");
  })
})
.hometext.active {

  animation: fadeOutBottomLeft; /* referring directly to the animation's @keyframe declaration */
  animation-duration: 2s;
}

.hometext.slide {

  animation: fadeOutTopRight; /* referring directly to the animation's @keyframe declaration */
  animation-duration: 2s;
}

A: hey try restarting your program and your pc too coz if its working fine on google chrome then it should also work for safari  too sometimes it happens when we work for too long

A: The code you posted is fine. Safari is showing some security issues. It says it can't set up a secure connection to the webserver. Maybe there is an issue with your certificate or other security settings on your server.


text:
Q: Magento Collections (Get Products by Type ID in specific order I want to get a collection of products from magento in a specific order.

*

*Simple Products

*Configurable Products

*Grouped Products

How would I add a filter that will retrieve the products in that order

A: It's not possible directly. I have 2 solutions:
1. Get your products in 3 different collections using addAttributeToFilter where attribute name is type_id. For the condition you can use Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE and  Mage_Catalog_Model_Product_Type::TYPE_GROUPED.
Example:
$simple_products = $model->getCollection()
        ->addAttributeToSelect('*')
        ->addAttributeToFilter('type_id', Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);

2. Add custom attribute from the admin panel (e.g. 1 for simple, 2 for configurable, 3 for grouped products etc.) and use it with addAttributeToSort.


text:
Q: What column type does SQLAlchemy use for "Text" on MySQL? My overall use-case is trying to determine whether I can write a somewhat database agnostic (at least supporting Postgres and MySQL) store for some large data as raw text (think ~500MB as a rough theoretical upper bound).
Based on this answer about MySQL string/text types, it looks like only the LONGTEXT column type can meet my requirements. I'm using SQLAlchemy, which claims for its Text column type that it is for variable length strings, but also that it generally maps to the database's CLOB or TEXT types. MySQL doesn't have a CLOB type (though it does have a BLOB), and its TEXT type would be insufficient for my needs.
So, What column type does SQLAlchemy use for Text on MySQL?

A: Looks like SQLAlchemy supports LONGTEXT:
$ python
Python 2.7.13 (default, Sep 29 2017, 15:31:18)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sqlalchemy.dialects.mysql import LONGTEXT
>>>

See how to use vendor-specific types here:
http://docs.sqlalchemy.org/en/latest/core/type_basics.html#vendor-specific-types
For what it's worth, trying to develop a totally brand-neutral database layer is difficult, and rarely worth the effort. I worked on the Zend Framework 1.0 some years ago, and I tried to create a generic unit testing suite for all the SQL databases supported by that framework. I found that very few data types are supported in the same way across all implementations of SQL, despite them all claiming to support the ANSI/ISO SQL standard.
Ultimately, you have to develop your own class hierarchy for your data layer, and implement the code slightly differently for each database-specific adapter.

Update: I think the news is better than we think. I tried this test:
t2 = Table('t2', metadata,
      Column('id', Integer, primary_key=True),
      Column('t1', String(64000)),
      Column('t2', String(16000000)),
      Column('t3', String(4294000000)),
      Column('t4', Text)
     )

metadata.create_all(engine)

Then I checked to see what it ended up creating in the MySQL database:
mysql> show create table t2;

CREATE TABLE `t2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `t1` mediumtext,
  `t2` longtext,
  `t3` longtext,
  `t4` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

So it does map SQLAlchemy's generic String data type to a more-or-less appropriate MySQL data type.
It's not surprising to me that it used larger data types than we might expect. The MEDIUMTEXT supports 16MB in bytes, not in characters. Because my default character set is the multi-byte utfmb4, the max length of MEDIUMTEXT is actually much fewer than 2^24 characters. So it had to upgrade it to LONGTEXT. Of course, 2^32 characters won't fit in LONGTEXT either, but it appears SQLAlchemy assumes you mean to create a column anyway.
I still think that it's hard to do totally implementation-neutral code. For example, what if you want to use some MySQL features like table options for the storage engine, or specific data types with no generic equivalent (for example, ENUM)?

A: In SQLAlchemy 1.2.7, the Text data type maps to MySQL Type TEXT, or LONGTEXT depending on the length you enter.
body_html = Column(Text())
body_plain = Column(Text(4294000000))

Creates the following in MySQL:
| Field           | Type         |
+-----------------+--------------+
| body_html       | text         |
| body_plain      | longtext     |


text:
Q: where can i download iphone sdk 3.x with xcode I was wondering if there is a place where i could get the earlier version (archives etc) for iphone SDK.There are certain times when one needs to play with the 3.x SDK.Can anyone please guide me for this.Thanks

A: download latest sdk. set deploy target to 3.0 and don't use new features that added after 3.0 so it should runs well on your 3.0 devices.

A: It doesn't look like Apple provides the old tools. I archive all of the developer tools as they are released.


text:
Q: Publish python dev version of package I need to publish a development version of python package without affect current cases where latest version is used.
after testing(for some reason can't test locally), will need to publish the development version as latest version.
for example: current latest version is : 1.0
how should the dev version of package can be named.  1.0.dev or 1.1.dev or something else.
(pip install)
I want my dev version can only be install by "pip install packagename==version", not "pip install packagename"

A: any version with string is okay, for my case, 1.0 is the latest version, I use 1.1.dev for the development version.
pip install packagename will only instal version 1.0


text:
Q: Why can't nativescript-geolocation resolve when building an APK for release? I am using Svelte Native, which is an offshoot of NativeScript.  One of the libraries that I've imported has been nativescript-geolocation.
I've done this like so: import * as geolocation from "nativescript-geolocation";
This works fine when I do a cloud build and test out on my phone using tns preview
When I try and build an APK using tns cloud build android it cannot resolve the nativescript-geolocation dependency.
I get the following error:
ERROR in ./App.svelte
Module not found: Error: Can't resolve 'nativescript-geolocation' in '/home/arthur/todoapp/app'
 @ ./App.svelte 14:0-56 68:1-34 72:1-26
 @ ./app.ts

How can I get native-script geolocation to resolve?

A: Seems like your build is missing the nativescript-geolocation dependency.
Running tns plugin add nativescript-geolocation should add it to package.json and fix the build.
I believe the reason it works in the preview version is that the Preview app has the geolocation plugin pre-installed.


text:
Q: PHP Replace and Remove? I have random Product Links URL.
I want the result Like  >
http://yourdomain.com/index.php?main_page=product_info&products_id=5
Product Id = 5
or
http://yourdomain.com/index.php?main_page=product_info&products_id=3210:cdfa96a858cdde666a79b09207528297
Product Id = 3210
Thanks in Advance

A: $string = "http://yourdomain.com/index.php?main_page=product_info&products_id=5";
$pattern = "/products_id=(\d+)/";
preg_match($pattern, $string, $matches);
$out = "Product Id = ".$matches[1];


text:
Q: Alsa is just not working right or I dont know I've been using linux for 5 years now but this is new for me...
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
python: src/hostapi/alsa/pa_linux_alsa.c:3636: PaAlsaStreamComponent_BeginPolling: Assertion `ret == self->nfds' failed.
Aborted (core dumped)

I can use my mic in the system like recording stuff with it and even talk in voice chat with no problem but when I try to run my speech recognition program its just fails like this...

A: this seems to be a known issue with portaudio where ALSA (Linux's low-level sound API) returns an error in an unexpected place
this seems to be a known issue (e.g. see here) but the authors seem to have issues with the code, and it never got added to the package
I've just stumbled on the same issue and am trying again with code that will hopefully address their issues with the previous patches
not sure if/when it would show up in Ubuntu though


text:
Q: What are the open sets in the quotient space formed when the endpoints of a closed interval are "glued together"? I understand the definition of the quotient topology, but can't intuitively understand how the open sets are formed.

A: The gluing process is made precise by following this procedure, which will be familiar to you, but is worth writing out in detail, to see what the open sets in the quotient topology are:
$1).\ $ if $[a,b]$ is a closed interval, define an equivalence relation $\sim$ by declaring the classes to be: the singleton sets $\{\{x\}:x\in (a,b)\}$ and the set $\{a,b\}.$ All this means is that we have defined a new set $[a,b]/\sim$ which consists of points in the interior of the interval $[a,b]$ and the "point" $\{a,b\}$.
$2).\ $ To topologize  $[a,b]/\sim$, we define a function $q:[a,b]\to [a,b]/\sim$ by sending each $x\in [a,b]$ to its equivalence class. So, for example, if $a<x<b,\ q$ sends $x$ to $\{x\}$, which we may as well just take to be $x$ itself.  But if $x=a$ or $x=b,$ then $q$ sends $x$ to the class $\{a,b\}$ which is a new "point", which we call $[a]\ (\text{or}\ [b])$.
Now, we define a set $V$ in $[a,b]/\sim$  to be open if and only if $q^{-1}(V)$ is open in $[a,b].$
To see what the open sets are, first note that if $V$ is an open interval $(x,y)$ with $x,y\neq a$ or $b$, then $q^{-1}(V)=V$ itself, which is open in $[a,b]$, and so $V$ is open in $[a,b]/\sim$. This is no surprise, since $q$ sends all interior points of $[a,b]$ to themselves (identifying $x$ with $\{x\}$). Now check some other possibilities for $V$:
If $V=[a]$, with then $q^{-1}(V)$ is $\{a,b\}$ which is not open in $[a,b]$ and so the point $[a]$ is not open in $[a,b]/\sim$.
If $V=[a]\cup (a,x),\ x<b$, then $q^{-1}(V)=[a,x)\cup\{b\}$ which is not open in $[a,b]$ so $V$ is not open in $[a,b]/\sim$.
If $a<x<y<b$ and $V=[a]\cup (a,x)\cup (y,b)$, then $q^{-1}(V)=[a,x)\cup (y,b]$, which is open in $[a,b]$ so $V$ is open in $[a,b]/\sim$.
Let $a<x<y<b$. It should be becoming clear that the basic open sets in the quotient are those sets $V$ for which $q^{-1}(V)$ is of the form $(x,y)$ or $[a,x)\cup (y,b]$. And since $a$ and $b$ are identified in the quotient, this latter set may be considered to be a "gluing" of $[a,x)$ and $(y,b]$ into a "single" open set, which after all, is what the quotient was supposed to do.

A: If $q:[a,b]\to [a,b]/\sim$ is the quotient map, then through the inverse image map $q^{-1}[\bullet]:\mathcal P([a,b]/\sim)\to \mathcal P([a,b])$ they are naturally in bijection with the open sets which are either subsets of $]a,b[$, or the whole $[a,b]$, or which may be written as a disjoint union $[a,\delta)\cup U\cup (\varepsilon, b]$ with $U$ open in $]a,b[$.


text:
Q: Web service for converting YouTube videos to MP3 files I need to create a web service that given a YouTube URL will output a MP3 file with the audio of the video, and was wondering how I could host something like this. Amazon EC2, or just normal web hosting?

A: You'll need more than just shared hosting, more like a virtual or dedicated machine considering the amount of customisation you'll be doing to the instance. You could do it on EC2 or any of the other 'cloud' providers (linode etc) or on a "normal" web host who offers virtual/dedicated hosting.

A: There are probably some open source converters in Linux that could pull out the audio for you.
I agree with micmcg you need a virtual host not just an ISP.  And in addition, the choice of which hosting provider may all really boil down to a question of cost and maybe performance.
http://aws.amazon.com/ec2/#pricing  says that inbound traffic to EC2 is free until June 30.  That video file that will need to be download will be inbound traffic, and can get pretty big..., but downloading that into EC2 will be free.
The outbound side of EC2, though, costs $0.15/Gb.  And then there's the instance charge of $0.10/instance per CLOCK hour.  Thats not a cpu hour, thats $0.10 per hour, $2.40 per day, $72 per month.  And the $0.10 instances -- the last time I tried EC2 -- were about as fast as my old Fujitsu P2040 laptop from 2002.
If you were with Linode, you get decent performance by bursting over a multicore cpus at no charge, and you get generous traffic allotments.  The monthly charge for presence could be less or more than $72/month depending on how much RAM you want and how many others you are willing to share with in a shared virtual-hosting environment.  But you will have to count up those videos you are downloading somehow.  The charge for going over a traffic allotment is steeper than renting a new virtual machine, and they have an API that lets you add machines to your account programmatically and deallocate for pro-rate refunds (sounds like an accounting nightmare but would be fun to play with).


text:
Q: Solaris11 second network works fine with virtualbox..but not with vnic I need a second network for testing.
Ok, I can use another mask for enlarge number of hosts,but I don' like
I want a
192.168.0.0/24 home

and
10.2.0.0/24 testing

The testing network is for virtual machines(virtualbox)
running on solaris11 host.
So i create a vnic linked to net0
dladm create-vnic -l net0 vnic1

Create the ip
ipadm create-ip vnic1
ipadm create-addr -T static -a 10.2.0.1 vnic1/v4

And then I simply attach the Virtualbox virtualnetwork
to briged adapter(selecting vnic1) and wow...nothing work.
I cannot ping the vm's from home network even configuring
correctly the route.
So I delete the vnic..and I recreate all using a second(physical)
network adapter,called net1 on server.
 ipadm create-ip net1
 ipadm create-addr -T static -a 10.2.0.1 net1/v4

And then I simply attach the Virtualbox virtualnetwork
to briged adapter(selecting net1) and wow..this times works.
I can ping the vm's from solaris and from my home network.
The simply question is: why with vnic not?Is a limit of Solaris or VirtualBox?

A: Well ... it's neither really a limit of Solaris or a limit of Virtualbox but a consequence how everything in this regards works. A vnic has it's own ARP address but the networking logic of virtualbox doesn't know about it. There is a trick however to get this running as a workaround. Allow promiscous mode for the VM on the interface in Virtualbox and start a tcpdump on the system in that VM ... then the VNIC configuration should work.


text:
Q: using include with a word from database Im having a little problem and cant get it to resolved for some reason. I have built a website  and got it running but i have now passed some of the files over to a folder to build more themes. What i am doing is trying to change themes back end and for this instance i will use the theme "smooth"
this is what i have, if i put this:
<?php
include "config_inc.php";
?>
include "themes/<?=$aset['Theme']?>/index.php]";

it will display on the page as the correct path "themes/smooth/index.php" so i know it is connecting to the database correctly. But now if i put it in this format:
<?php
include "config_inc.php";
?>
<?php
include "themes/<?=$aset['Theme']?>/index.php]";
?>

It just shows a blank page.
I have tested the link as in "my_domain/themes/smooth/index.php" and every is displaying correctly
Hope someone can help. Thanks

A: You shouldn't use php tags inside php tags to insert variable in string. Just use {} to do it:
include "themes/{$aset['Theme']}/index.php";

Or
include 'themes/' . $aset['Theme'] . '/index.php';


text:
Q: NHibernate: How to fetch an object without its child collections? My objects of type Object1 contain List Children1 property.
I would love to get these objects without children.
Seems like detachedCriteria.SetFetchMode ("Children1", FetchMode.Lazy) should be the thing,
but apparently it's not :(
I tried getting the data in using (new SessionScope()) and setting null to .Children1 but it didn't succeed (the data was already fetched).
Any ideas would be appreciated.

A: When you map the collection, are you specifying not to use lazy loading? Try specifying lazy loading at this point.

A: We had the same problem in our current solution and setting Lazy in the mapping didn't work. We had to set default-lazy to true and suddenly it worked.
This would work best if all relations should be lazy by default.

A: When using the ICriteria API to retrieve your entities, you can specify (override) the fetchmode that has to be used for the associations:
ICriteria crit = session.CreateCriteria (typeof(MyEntity));
crit.SetFetchMode ("someAssociationPath", FetchMode.Lazy);

A: It seems to me that you are using one-to-one mapping. In this case lazy loading will not work by design. If it's so please check this article. Otherwise please provide a bit more code and mappings.


text:
Q: Creating minimum binary search tree ( BST ) in Java I'm working on a binary search tree and try to write a method for creating minimum BST from an array values. However, it's not working successfully. Where I'm making mistake ? It should print values in ascending order using inOrderTraverseTree method. I keep some additional methods and can delete if may feel irrelevant.
I updated the code in question, but, I still need to get the root Node to call the inOrderTraversal (Node root) method.
BinaryTree.java
class Node {

    int key;

    Node leftChild;
    Node rightChild;

    Node(int key) {
        this.key = key;
    }
Node (){}

    public String toString() {

        return "\n"+key+" ";
    }
}

public class BinaryTree {

    Node root;

    BinaryTree (){
        root = null;
    }

    public void addNode(int key) {

        Node newNode = new Node(key);

        // If there is no root this becomes root
        if (root == null) {
            root = newNode;
        }

        else {

            // Set root as the Node we will start
            // with as we traverse the tree

            Node focusNode = root;
            Node parent;

            while (true) {

                parent = focusNode;

                if (key < focusNode.key) {

                    focusNode = focusNode.leftChild;

                    if (focusNode == null) {

                        parent.leftChild = newNode;
                        return; // All Done
                    }
                } // end of if

                else {

                    focusNode = focusNode.rightChild;

                    if (focusNode == null) {

                        parent.rightChild = newNode;
                        return;
                    }
                }
            }
        }
    }

    // get the height of binary tree
    public int height(Node root) {

        if (root == null)
            return -1;

        Node focusNode = root;
        int leftHeight = focusNode.leftChild != null ? height( focusNode.leftChild) : 0;
        int rightHeight = focusNode.rightChild != null ? height( focusNode.rightChild) : 0;
        return 1 + Math.max(leftHeight, rightHeight);
    }

    // METHODS FOR THE TREE TRAVERSAL

    // inOrderTraverseTree : i) X.left ii) X iii) X.right
    public void inOrderTraverseTree(Node focusNode) {

        if (focusNode != null) {

            inOrderTraverseTree(focusNode.leftChild);
            // System.out.println(focusNode);
            System.out.print( focusNode );
            inOrderTraverseTree(focusNode.rightChild);
        }
        // System.out.println();
    }

    // preOrderTraverseTree : i) X ii) X.left iii) X.right
    public void preorderTraverseTree(Node focusNode) {

        if (focusNode != null) {

            System.out.println(focusNode);
            preorderTraverseTree(focusNode.leftChild);
            preorderTraverseTree(focusNode.rightChild);

        }
    }

    // postOrderTraverseTree : i) X.left ii) X.right iii) X
    public void postOrderTraverseTree(Node focusNode) {

        if (focusNode != null) {

            preorderTraverseTree(focusNode.leftChild);
            preorderTraverseTree(focusNode.rightChild);
            System.out.println(focusNode);

        }
    }
    // END

    public Node findNode(int key) {

        Node focusNode = root;

        while (focusNode.key != key) {

            if (key < focusNode.key) {

                focusNode = focusNode.leftChild;

            } else {

                focusNode = focusNode.rightChild;
            }

            if (focusNode == null)
                return null;
        }
        return focusNode;

    }

    public boolean remove(int key) {

        Node focusNode = root;
        Node parent = root;
        boolean isItALeftChild = true;

        // we will remove the focusNode
        while (focusNode.key != key) {

            parent = focusNode;

            if (key < focusNode.key) {

                isItALeftChild = true;
                focusNode = focusNode.leftChild;
            }

            else {

                isItALeftChild = false;
                focusNode = focusNode.rightChild;
            }

            if (focusNode == null)
                return false;
        }

        // no child
        if (focusNode.leftChild == null && focusNode.rightChild == null) {

            if (focusNode == root)
                root = null;

            else if (isItALeftChild)
                parent.leftChild = null;

            else
                parent.rightChild = null;
        }

        // one child ( left child )
        else if (focusNode.rightChild == null) {

            if (focusNode == root)
                root = focusNode.leftChild;

            else if (isItALeftChild)
                parent.leftChild = focusNode.leftChild;

            else
                parent.rightChild = focusNode.leftChild;
        }

        else if (focusNode.leftChild == null) {

            if (focusNode == root)
                root = focusNode.rightChild;

            else if (isItALeftChild)
                parent.leftChild = focusNode.rightChild;

            else
                parent.rightChild = focusNode.rightChild;

        }

        // two children exits
        else {

            // replacement is the smallest node in the right subtree
            // we neeed to delete the focusNode
            Node replacement = getReplacementNode(focusNode);

            if (focusNode == root)
                root = replacement;

            else if (isItALeftChild)
                parent.leftChild = replacement;

            else
                parent.rightChild = replacement;

            replacement.leftChild = focusNode.leftChild;
        }

        return true;
    }

    public Node getReplacementNode(Node replacedNode) {

        Node replacementParent = replacedNode;
        Node replacement = replacedNode;
        Node focusNode = replacedNode.rightChild;

        // find the smallest node of the right subtree of the node to be deleted
        while (focusNode != null) {

            replacementParent = replacement;
            replacement = focusNode;
            focusNode = focusNode.leftChild;
        }

        // exit when the focusNode is null
        // the replacement is the smallest of the right subtree

        if (replacement != replacedNode.rightChild) {

            replacementParent.leftChild = replacement.rightChild;
            replacement.rightChild = replacedNode.rightChild;
        }

        return replacement;
    }

private  void createMinimalBST(int arr[], int start, int end, Node newNode){

        if ( end <= start )
            return;
        int mid = (start + end) / 2;
        newNode.key = arr[mid];

        if ( root == null ){
            root = newNode;
        }

        System.out.println("new node = "+ newNode );

        if (start <= mid-1) {
            newNode.leftChild = new Node();
            createMinimalBST(arr, start, mid - 1, newNode.leftChild);
        }
        if (mid+1 <= end) {
            newNode.rightChild = new Node();
            createMinimalBST(arr, mid + 1, end, newNode.rightChild);
        }
        // System.out.println("left child = "+ newNode.leftChild +" "+ " right child = "+ newNode.rightChild);

    }

    public void createMinimalBST(int array[]) {

        Node n = new Node();

        createMinimalBST(array, 0, array.length - 1, n);
    }

            public static void main(String[] args) {

        int[] myArr = { 1,2,3,4,5,6,7,8,9 }; // sortedArrayToBST
        BinaryTree myTr = new BinaryTree();
        // Node n = BinaryTree.createMinimalBST(myArr);
        myTr.createMinimalBST(myArr);

        // System.out.println("The root is = "+myTr.root);
        // myTr.inOrderTraverseTree(myTr.root);
        System.out.println();
        myTr.inOrderTraverseTree(myTr.root);

    }

    }

A: You need to assign the result of createMinimalBST() to a variable.
This method returns a Node:
 public Node createMinimalBST(int array[]) {...}

However, in the main, ...
 myTr.createMinimalBST(myArr);

you calls to the method but no variable try to hold the result.
Also, You may want to make createMinialBST to be public static and call it like this:

myTr = BinaryTree.createMinimalBST(myArr);

Beside, there are 2 more ways to make this work:
1) move createMinimalBST() into Node, so that the recursion can occur while the key will be setting in-place.
private  void createMinimalBST(int arr[], int start, int end){
    int mid = (start + end) / 2;
    this.key = arr[mid];

    System.out.println("new node = "+n);

    if (start <= mid-1) {
        this.leftChild = new Node();
        this.leftChild.createMinimalBST(arr, start, mid - 1);
    }
    if (mid+1 <= end) {
        this.rightChild = new Node();
        this.rightChild.createMinimalBST(arr, mid + 1, end);
    }
    System.out.println("left child = "+ newNode.leftChild +" "+ " right child = "+ newNode.rightChild);
}

2) If you want that method stays in BinaryTree, you can consider to pass in the Node as a parameter into createMinimalBST() ilke createMinimalBST(arr, node);
private  void createMinimalBST(int arr[], int start, int end, Node newNode){
    int mid = (start + end) / 2;
    newNode.key = arr[mid];

    System.out.println("new node = "+n);

    if (start <= mid-1) {
        newNode.leftChild = new Node();
        createMinimalBST(arr, start, mid - 1, newNode.leftChild);
    }
    if (mid+1 <= end) {
        newNode.rightChild = new Node();
        createMinimalBST(arr, mid + 1, end, newNode.leftChild);
    }
    System.out.println("left child = "+ newNode.leftChild +" "+ " right child = "+ newNode.rightChild);
}


text: Q: Editable Table in plotly.graphic_object.FigureWidget(plotly.graphic_object.Table(...)) Trying to create a plotly.graphic_object.FigureWidget(plotly.graphic_object.Table(...)) editable for the user. Is there a way to give user ability to select a subset of the data being displayed and copy it to clipboard ?


text:
Q: How to delete or modify a database table using Flask-SQLAlchemy? Is there a way to delete or modify a table using flask-sqlalchemy?
I am working on a Flask-based web app. I switched to flask-sqlalchemy as my project is on Heroku and I had to connect my table to Heroku PostgreSQL. I made a flask-sqlalchemy table and created it using the db.create_all() command.
Now, for my app to fulfill its purpose, it is of utmost importance to save images, the best way of which I found to be to add them to the database.
Now, I want to change the particular table class to store a column called image as image = db.Column(db.Text, nullable=False) but I cannot. The former schema is unchanged and it gives me an error signifying that the column image does not exist every time I try to access or add something to the table.
How to do this?

A: You can use drop()
from sqlalchemy import create_engine
engine = create_engine("...")
my_table.__table__.drop(engine)


text:
Q: qt creator получения времени Имею вот такой код, который по моему мнению, должен мне выводить время компьютера.
#include <QTextStream>
#include <QDate>
#include <QTime>

int main(void) {

   QTextStream out(stdout);

   QDate dt2;
   dt2.setDate(QDateTime::currentDateTime());
   out << dt2.toString("yyyy/MM/dd") << endl;
}

к сожалению данный код не работает. где моя ошибка?

A: #include <QTextStream>
#include <QDate>
#include <QTime>

int main(void) {

   QTextStream out(stdout);

   QDate dt2 = QDate::currentDate();
   out << dt2.toString("yyyy/MM/dd");
}

На будущее: пишите подробнее вот это Ваше "код не работает". Необходимо уточнять: не компилируется; компилируется, но выводит не то что нужно, уточнить что выводит, а что хотите получить.

A: QDateTime dt2 = QDateTime::currentDateTime();
qDebug() << dt2.toString("yyyy/MM/dd");

Или как более короткий вариант:
qDebug()<<QDateTime::currentDateTime().toString("yyyy/MM/dd");

Добавлю, что приведенный код не скомпилируется, функция QDate::setDate принимает на вход int year, int month, int day, а вы пытаетесь передать объект класса QDateTime. Дата и время в Qt описывается классом QDateTime, так что если вам надо хранить и дату и время в одной сущности, рекомендую использовать именно его.


text:
Q: How to detect if a script exports something when loaded? Assuming I have a script 'helpers.js' in the same directory
as 'main.js', and load the first in the latter, 'helpers.js'
will return an empty object {} when not exporting anything,
no matter what the content is, which is a default value for
the module.exports variable, I guess.
Is there a way to check, if the empty object was intentionally
exported by 'helpers.js'?
Example 1, no export:
// helpers.js

// Any valid Javascript here, just no exports.

// main.js

const help = require('./helpers')

console.log(help)

>>> {}

Example 2, with export:
// helpers.js

let exportMe = require('./you').getNewestMe

module.exports = exportMe()

// main.js

const help = require('./helpers')

console.log(help)

>>> {}

A: I had something different in mind but I realized that my original solution wouldn't work, so let's see...
When a CommonJS module is loaded (i.e. required for the first time), Node.js runs a special function - a loader. The loader function has access to the state of a module before it is actually loaded, so it can inspect and modify the original values of some properties of a module like module.exports. The idea is that if we can somehow mark that original value, we can distinguish it from an empty object assigned later while the module was being loaded.
The loader function can be retrieved and changed with Module._extensions['.js'] where Module is the module constructor, i.e. require('module') or module.constructor.(Module._extensions is not the same as the deprecated require.extensions, but that's another story...).
The loader function is invoked with two arguments: the module object and the filename. Then the original exports object is unsurprisingly, module.exports.
In the code below, I'm going to use a symbol to mark the original empty exports object:
const noExports = Symbol('no exports');
const extensions = module.constructor._extensions;
const jsLoader = extensions['.js'];
extensions['.js'] = (module, filename) => {
    module.exports[noExports] = filename;
    jsLoader(module, filename);
};

const help1 = require('./helpers-without-exports.js');
const help2 = require('./helpers-with-empty-exports.js');

console.log(noExports in help1); // true
console.log(noExports in help2); // false

This method only works for modules that are loaded after the loader function is patched, and it only determines if module.exports is changed after the module is created, so it does not detect values exported with exports.myFunction = ... (in which case the exported object would be non-empty anyway).
Another special case is a module that re-exports another module that does not export anything (e.g. module.exports = require('./foo'); where foo.js is an empty file). To detect those cases too, if necessary, one could compare the value of the symbol property with the module filename assigned to the symbol, and see if they match:
console.log(help1[noExports] === require.resolve('./helpers-without-exports.js')); // true
console.log(help2[noExports] === require.resolve('./helpers-with-empty-exports.js')); // false


text:
Q: Displaying remaining available products when mouse is hovering over the product image As I mentioned in the title, I want to display the remaining available products when the cursor is hovering over the product image.
To be more specific let's say that my product is a nike t-shirt, what I want is when the customer puts the cursor over the product image to appear a text box with the remaining available sizes, for example, sizes left: small, medium, large.
Is something like that possible, with the use of an extension, or doing it manually with code??

A: This isn't fully tested but the idea shuold work. Get all simple products from the config. Loop through and if it is in stock just echo the size. If all of this is in a div you can just show and hide it with js when the user does mouseover on the main image.
<div id="available-size">
<?php
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product);
foreach($childProducts as $child) {

    $model = Mage::getModel('catalog/product');
    $_product = Mage::getModel('catalog/product')->load($child->getId());
    $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
                                    ->loadByProduct($_product)->getQty();
    if($stocklevel){
          echo $_product->getSize();
    }

}
?>
</div>


text:
Q: update data with href link in django and ajax $("#feedlikes").on("click", function(e){
        e.preventDefault();
        $.ajax({
            type: 'get',
            url:'{% url "feedlikes" %}',
            data:{},
            success: function({
                alert("Updated Successfully")
            }),
        }),
    }),

those are my Ajax code help me to get them work.
this is my view:
def feedlikes(request, feed_id):
    feed_update= Feeds.objects.get(pk=feed_id)
    feed_update.likes = feed_update.likes +1
    feed_update.save()

A: your feedlikes function expect feed_id but you are not supplying in the ajax url. Your ajax url should be
url:'{% url "feedlikes" feed_id=1 %}'

The problem: how to get that feed id in ajax?
You can make a hidden html tag  with id equal to #feedlikes-id (eg feedlikes-1) inside #feedlike div or something like that and access just above submitting ajax and store in some variable and set to url then submit.

A: If you need to update the data you need to pass post method in ajax with csrf_token in headers.
$("#feedlikes").on("click", function(e){
        e.preventDefault();
        $.ajax({
            type: 'post',
            url:'{% url "feedlikes" %}',
            data:{},
            headers: {
                'X-CSRF-Token': {{csrf_token}}
            },
            success: function({
                alert("Updated Successfully")
            }),
        }),
    }),


text:
Q: How to install drivers for Samsung printer ml-2955 on Ubuntu 13? I tried to install 2 versions of printer drivers.

*

*specifically for Samsung printer ml-2955.

*the other one generic linux driver.

I do not know how to install neither of them. There is autorun file which opens window with this content>
#! /bin/sh
BASE=`dirname "$0"`
exec sh "$BASE/Linux/install.sh"

Now I have no idea what to do with that :(
The other version is similar (no autorun but similar window content).

A: Open Terminal by pressing ctrl + alt + t and
type :
sh filename
Replace filename with the present filename.
It would install the driver .


text:
Q: UnsafeMutableAudioBufferListPointer allocation before calling AudioObjectGetPropertyData I've been trying to use Apple's CoreAudio from swift.
I found many examples on how to enumerate streams and channels on a device.
However, all of them seem to use incorrect size when calling UnsafeMutablePointer<AudioBufferList>.allocate().
They first request property data size, which returns the number of bytes.
Then they use this number of bytes to allocate an (unsafe) AudioBufferList of that size (using the number of bytes as the size of the list!).
Please see my comments inline below:
var address = AudioObjectPropertyAddress(
    mSelector:AudioObjectPropertySelector(kAudioDevicePropertyStreamConfiguration),
    mScope:AudioObjectPropertyScope(kAudioDevicePropertyScopeInput),
    mElement:0)

var propsize = UInt32(0);
var result:OSStatus = AudioObjectGetPropertyDataSize(self.id, &address, 0, nil, &propsize);
if (result != 0) {
    return false;
}

// ABOVE: propsize is set to number of bytes that property data contains, typical number are 8 (no streams), 24 (1 stream, 2 interleaved channels)
// BELOW: propsize is used for AudioBufferList capacity (in number of buffers!)

let bufferList = UnsafeMutablePointer<AudioBufferList>.allocate(capacity:Int(propsize))
result = AudioObjectGetPropertyData(self.id, &address, 0, nil, &propsize, bufferList);
if (result != 0) {
    return false
}

let buffers = UnsafeMutableAudioBufferListPointer(bufferList)
for bufferNum in 0..<buffers.count {
    if buffers[bufferNum].mNumberChannels > 0 {
        return true
    }
}

This works all of the time, because it allocates much more memory than needed for UnsafeMutablePointer<AudioBufferList>, but this is obviously wrong.
I've been searching for a way to correctly allocate UnsafeMutablePointer<AudioBufferList> from the number of bytes that is returned by AudioObjectGetPropertyDataSize(), but I cannot find anything for the whole day. Please help ;)

A: to correctly allocate UnsafeMutablePointer<AudioBufferList> from the number of bytes that is returned by AudioObjectGetPropertyDataSize()
You should not allocate UnsafeMutablePointer<AudioBufferList>, but allocate raw bytes of the exact size and cast it to UnsafeMutablePointer<AudioBufferList>.
Some thing like this:
        let propData = UnsafeMutableRawPointer.allocate(byteCount: Int(propsize), alignment: MemoryLayout<AudioBufferList>.alignment)
        result = AudioObjectGetPropertyData(self.id, &address, 0, nil, &propsize, propData);
        if (result != 0) {
            return false
        }
        let bufferList = propData.assumingMemoryBound(to: AudioBufferList.self)

A: I fully agree with the accepted answer of using UnsafeMutableRawPointer.allocate(byteCount:alignment:) (though it should also be paired with a call to deallocate() for getting the device stream configuration, but just wanted to share another option for completeness (this shouldn't be upvoted for this question)
If you truly need to calculate the number of buffers from the number of bytes (I'm not sure there is actually any such need), it can be done.
When first converting code to Swift, I used something like :
        let numBuffers = (Int(propsize) - MemoryLayout<AudioBufferList>.offset(of: \AudioBufferList.mBuffers)!) / MemoryLayout<AudioBuffer>.size
        if numBuffers == 0 { // Avoid trying to allocate zero buffers
            return false
        }
        let bufferList = AudioBufferList.allocate(maximumBuffers: numBuffers)
        defer { bufferList.unsafeMutablePointer.deallocate() }
        err = AudioObjectGetPropertyData(id, &address, 0, nil, &propsize, bufferList.unsafeMutablePointer)

Again, I do NOT actually recommend this approach to get the stream configuration - it's unnecessarily complex IMO, and I've since adopted something like the accepted answer.  So this may not have value other than as an academic exercise.


text:
Q: Finding data entry points in a blank, scanned application form I am a relative newcomer to image processing and this is the problem I'm facing - Say I have the image of an application form, like this:
Now I would like to detect the locations of all the locations where data is to be entered. In this case, it would be the rectangles divided into a number of boxes like so(not all fields marked):

I can live with the photograph box also being detected. I've tried running the squares.cpp sample in the OpenCV sources, which does not quite get me what I want. I also tried the modified version here - the results were worse(my use case is definitely very different from the OP's in that question).
Also, Hough transforming to get the lines is not really working with/without blur-threshold as the noise in scanned image is contributing to extraneous lines, and also, thresholding is taking away parts of the combs(the small squares), and hence the line detection is not up to the mark.
Note that this form is not a scanned copy of a printed form, but the real input might very well be a noisy, scanned image of a printed form.
While I'm definitely sure that this is possible(at least with some tolerance allowed) and I'm trying to get at the solution, it would be really helpful if I get insights and ideas from other people who might have tried something like this/enjoy hacking on CV problems. Also, it would be really nice if the answers explain why a particular operation was done (e.g., dilation to try and fill up any holes left by thresholding, etc)

A: Are the forms consistent in any way? Are the "such boxes" the same size on all forms? If you can rely on a consistent size, like the character boxes in the form above, you could use template matching.
Otherwise, the problem seems to be: find any/all rectangles on the image (with a post processing step to filter out any that have a significant amount of markings within, or to merge neighboring rectangles).
The more you can take advantage of the consistencies between the forms, the easier the problem will be. Use any context you can get.
EDIT
Using the gradients (computed by using a Sobel kernel in both the x and the y direction) you can weed out a lot of the noise.
Using both you can find the direction of the gradients (equation can be found here: en.wikipedia.org/wiki/Sobel_operator). Let's say we define a discriminating feature of a box to be a vertical or horizontal gradient. If the pixel's gradient has an orientation that's either straight horizontal or straight vertical, keep it, set all else to white.
To make this more robust to noise, you can use a sliding window (3x3) in which you compute the median orientation. If the median (or mean) orientation of the window is vertical or horizontal, keep the current (middle of the window) pixel, otherwise set it to white.
You can use OpenCV for the gradient computation, and possibly the orientation/phase calculation, but you'll probably need to write the code it do the actual sliding window code. I'm not intimately familiar with OpenCV


text:
Q: AngularJS + Ionic - Append content to another page/view I am new to angularjs and ionic and I can not seem to figure out how to append content to another page/view once I click a button. Right now once I click the "append" button the content appears below the button on the homepage but I want it to appear on the second page. Any suggestions?
tab-home.html
<ion-view view-title="Home">
      <ion-content>

Welcome to Homepage

    <button class="button" ng-click="AppendText()">Append</button>
     // Text 'Hi" only displays on homepage
</ion-content>
</ion-view>

controller.js
.controller('SecondCtrl', function($scope) {
   $scope.AppendText = function() {
     var myEl = angular.element( document.querySelector( '#divID' ) );
     myEl.append('Hi
');
    }
})

tab-second.html
<ion-view view-title="Second Page">
  <ion-content>

</ion-content>
</ion-view>

A: I think the problem here is that your trying to do things in a jQuery style way still. This needs a more Angular approach.
There are a couple ways you could handle this, but the right way is dependant on your app's functionality/layout/style etc.
Option 1:
If your using routing/states in your app, you can simply use an abstract route with a controller. Attaching your variable data in the abstract route's controller will cause nested routes to inherit that $scope.your.variable
(app.js)
.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$stateProvider
.state('exampleState', {
    url: '/example',
    abstract: true,
    templateUrl: 'templates/example/root-view.html',
    controller: 'ParentCtrl'
  })

  .state('stats.games', {
    url: '/games',
    views: {
      'stats-games':{
        templateUrl: 'templates/example/firstpage.html',
        controller: 'PageOneCtrl'
      }
    }
  })
  .state('stats.games', {
    url: '/games',
    views: {
      'stats-games':{
      templateUrl: 'templates/example/secondpage.html',
      controller: 'PageTwoCtrl'
    }
  })
});

(controller.js)
.controller('ParentCtrl', function($scope) {
   $scope.myValues = {
         value1:"some value",
         value2:"some other value"
   }
})
.controller('PageOneCtrl', function($scope) {
     $scope.message = $scope.myValues.value1
})
.controller('PageTwoCtrl', function($scope) {
     $scope.message = $scope.myValues.value2
})

(firstpage.html or seccondpage.html)
<ion-view view-title="First/Second Page">
  <ion-content>

{{message}}

</ion-content>
</ion-view>

Option 2: You could make a custom directive like this and substitute the data to your needs. This example shows two ways to mod your DOM.
    .directive("mydirective", function(){
        return {
            template: "
Hi, ...
", // or use an html file here
            replace: true,
            restrict: 'A',
            scope: false, //default
            link: function(scope, element, attrs){
                console.log([scope],[element],[attrs]);
                console.log(scope.myValues.value1);
                /// use element from here
                // do something...
                // element.append("hello
")
            }
        }
    });

and then in your .html file you include

Option 3: This is my favorite way to share content/data between views... Services or Factories in AngularJS are amazing. Create a service, and inject it into and module controller for instant shared access to data from several controllers:
.service("myDataService", function() {
    var myData = {
        dataSetOne: {
            name: "John Doe",
            message: "hi, John",
            other: "misc info"
        },{
        dataSetTwo: {
            name: "John Doe",
            message: "hi, John",
            other: "misc info"
        }
    }
})

then in your controller just make sure you include the service and a dependency injection:
.controller('yourPageCtrl', function($scope, myDataService) {
    $scope.myData = myDataService;
    $scope.message = "Hi "+$scope.myData.dataSetOne.name;
    // do something here
});

and your DOM would look like this:

{{message}}

Last and worst option, if all else fails, is to use $rootScope. I really don't recommend that approach and thus am going to leave that to you to research if needed.
Hope that helps.

A: You could create your app module with the two state pages that you want:
var app = angular.module('myApp', ['ionic']);
app.config(function($stateProvider) {
  $stateProvider
  .state('index', {
    url: '/',
    templateUrl: 'home.html'
  })
  .state('music', {
    url: '/music',
    templateUrl: 'music.html'
  });
});

Then on app start, $stateProvider will look at the url, see if it matches the index state,
and then try to load home.html into the .
Pages are loaded by the URLs given. One simple way to create templates in Angular is to put
them directly into your HTML file and use the  syntax.
So here is one way to put home.html into our app:

This is good to do because the template will be cached for very fast loading, instead of
having to fetch them from the network.


text:
Q: Keyword arguments in torch.nn.Sequential (pytroch) a question regarding keywords in torch.nn.Sequential, it is possible in some way to forward keywords to specific models in a sequence?
    model = torch.nn.Sequential(model_0, MaxPoolingChannel(1))
    res = model(input_ids_2, keyword_test=mask)

here, keyword_test should be forwarded only to the first model.
Thank a lot and best regards!
my duplicate from - https://discuss.pytorch.org/t/keyword-arguments-in-torch-nn-sequential/53282

A: No; you cannot. This is only possible if all models passed to the nn.Sequential expects the argument you are trying to pass in their forward method (at least at the time of writing this).
Two workarounds could be (I'm not aware of the whole case, but anticipated from the question):

*

*If your value is static, why not initializing your first model with that value, and access it during computation with self.keyword_test.

*In case the value is dynamic, you could have it as an inherent property in the input; hence, you can access it, also, during computation with input_ids_2.keyword_test