text:
Q: Why is my Orchard installation looking for d:\TeamCity\Projects\Orchard-1.x\....? I am recieving an error message what appears to be permission related. I can't workout which file needs permissions changing on. What I was also curious about was why the error is looking at paths like

d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\Repository.cs

Is it trying to call upon an external library elsewhere?
Any help would be great

Server Error in '/' Application.

Access is denied. (Exception from
  HRESULT: 0x80070005 (E_ACCESSDENIED))
Description: An unhandled exception
  occurred during the execution of the
  current web request. Please review the
  stack trace for more information about
  the error and where it originated in
  the code.
Exception Details:
  System.UnauthorizedAccessException:
  Access is denied. (Exception from
  HRESULT: 0x80070005 (E_ACCESSDENIED))
ASP.NET is not authorized to access
  the requested resource. Consider
  granting access rights to the resource
  to the ASP.NET request identity.
  ASP.NET has a base process identity
  (typically {MACHINE}\ASPNET on IIS 5
  or Network Service on IIS 6 and IIS 7,
  and the configured application pool
  identity on IIS 7.5) that is used if
  the application is not impersonating.
  If the application is impersonating
  via ,
  the identity will be the anonymous
  user (typically IUSR_MACHINENAME) or
  the authenticated request user.
To grant ASP.NET access to a file,
  right-click the file in Explorer,
  choose "Properties" and select the
  Security tab. Click "Add" to add the
  appropriate user or group. Highlight
  the ASP.NET account, and check the
  boxes for the desired access.
Source Error:
An unhandled exception was generated
  during the execution of the current
  web request. Information regarding the
  origin and location of the exception
  can be identified using the exception
  stack trace below.
Stack Trace:
[UnauthorizedAccessException: Access
  is denied. (Exception from HRESULT:
  0x80070005 (E_ACCESSDENIED))]
  System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
  errorCode, IntPtr errorInfo) +0
  System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32
  errorCode) +49
  System.Data.SqlServerCe.UnmanagedLibraryHelper..ctor(String
  fileName) +76
  System.Data.SqlServerCe.NativeMethodsHelper..ctor(String
  modulePath) +27
  System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String
  modulePath) +281
  System.Data.SqlServerCe.NativeMethods.LoadNativeBinariesFromPrivateFolder(String
  privateInstall) +76
  System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
  +225    System.Data.SqlServerCe.SqlCeCommand..ctor()
  +65
[TargetInvocationException: Exception
  has been thrown by the target of an
  invocation.]
  System.RuntimeTypeHandle.CreateInstance(RuntimeType
  type, Boolean publicOnly, Boolean
  noCheck, Boolean& canBeCached,
  RuntimeMethodHandleInternal& ctor,
  Boolean& bNeedSecurityCheck) +0
  System.RuntimeType.CreateInstanceSlow(Boolean
  publicOnly, Boolean skipCheckThis,
  Boolean fillCache) +98
  System.RuntimeType.CreateInstanceDefaultCtor(Boolean
  publicOnly, Boolean
  skipVisibilityChecks, Boolean
  skipCheckThis, Boolean fillCache) +241
  System.Activator.CreateInstance(Type
  type, Boolean nonPublic) +69
  NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type
  type) +8
  NHibernate.Driver.ReflectionBasedDriver.CreateCommand()
  +28    NHibernate.Driver.SqlServerCeDriver.Configure(IDictionary2
  settings) +99
  Orchard.Data.Providers.OrchardSqlServerCeDriver.Configure(IDictionary2
  settings) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\Providers\SqlCeDataServicesProvider.cs:77
  NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2
  settings) +158
[HibernateException: Could not create
  the driver from
  Orchard.Data.Providers.SqlCeDataServicesProvider+OrchardSqlServerCeDriver,
  Orchard.Framework, Version=1.0.20.0,
  Culture=neutral, PublicKeyToken=null.]
  NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary2
  settings) +241
  NHibernate.Connection.ConnectionProvider.Configure(IDictionary2
  settings) +86
  NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary2
  settings) +351
  NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary2
  properties) +953
  NHibernate.Cfg.Configuration.BuildSettings()
  +17    NHibernate.Cfg.Configuration.BuildSessionFactory()
  +44    Orchard.Data.SessionFactoryHolder.BuildSessionFactory()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\SessionFactoryHolder.cs:74
  Orchard.Data.SessionFactoryHolder.GetSessionFactory()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\SessionFactoryHolder.cs:52
  Orchard.Data.SessionLocator.For(Type
  entityType) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\SessionLocator.cs:29
  Orchard.Data.Repository1.get_Session()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\Repository.cs:26    Orchard.Data.Repository1.get_Table()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\Repository.cs:30    Orchard.Data.Repository1.Fetch(Expression1
  predicate) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\Repository.cs:126    Orchard.Data.Repository1.Get(Expression1
  predicate) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\Repository.cs:91    Orchard.Data.Repository1.Orchard.Data.IRepository<T>.Get(Expression1
  predicate) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Data\Repository.cs:60    Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetDescriptorRecord()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:52
  Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetShellDescriptor()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:25
  Orchard.Environment.ShellBuilders.ShellContextFactory.CreateShellContext(ShellSettings
  settings) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs:66
  Orchard.Environment.DefaultOrchardHost.CreateShellContext(ShellSettings
  settings) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\DefaultOrchardHost.cs:128
  Orchard.Environment.DefaultOrchardHost.b__1(ShellSettings
  settings) in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\DefaultOrchardHost.cs:100
  System.Linq.WhereSelectArrayIterator2.MoveNext()
  +85    System.Linq.Buffer1..ctor(IEnumerable1
  source) +217
  System.Linq.Enumerable.ToArray(IEnumerable1
  source) +78
  Orchard.Environment.DefaultOrchardHost.BuildCurrent()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\DefaultOrchardHost.cs:87
  Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.Initialize()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\DefaultOrchardHost.cs:56
  Orchard.Web.MvcApplication.Application_Start()
  in
  d:\TeamCity\Projects\Orchard-1.x\src\Orchard.Web\Global.asax.cs:22
[HttpException (0x80004005): Could not
  create the driver from
  Orchard.Data.Providers.SqlCeDataServicesProvider+OrchardSqlServerCeDriver,
  Orchard.Framework, Version=1.0.20.0,
  Culture=neutral, PublicKeyToken=null.]
  System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
  context, HttpApplication app) +9028953
  System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
  appContext, HttpContext context,
  MethodInfo[] handlers) +131
  System.Web.HttpApplication.InitSpecial(HttpApplicationState
  state, MethodInfo[] handlers, IntPtr
  appContext, HttpContext context) +194
  System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
  appContext, HttpContext context) +339
  System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
  appContext) +253
[HttpException (0x80004005): Could not
  create the driver from
  Orchard.Data.Providers.SqlCeDataServicesProvider+OrchardSqlServerCeDriver,
  Orchard.Framework, Version=1.0.20.0,
  Culture=neutral, PublicKeyToken=null.]
  System.Web.HttpRuntime.FirstRequestInit(HttpContext
  context) +8950644
  System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext
  context) +97
  System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
  wr, HttpContext context) +256
Version Information: Microsoft .NET
  Framework Version:4.0.30319; ASP.NET
  Version:4.0.30319.1

A: The paths to D:\TeamCity\Projects\Orchard-1.x are a bit of a misdirection, they appear within the stack trace and more specifically refer to where the project was originally built, not where Orchard is looking for resources.
TeamCity is a Continuous Integration System used quite widely in the .NET World.
I can't give you a concrete solution to your problem, you do appear to be correct in your assumption that it is a permissions issue. I would recommend using process monitor to track down origin of the error.

A: I had a similar problem (an MVC 3 site using Sql Server Compact 4.0) with a hoster that runs the Plesk control panel, and I fixed it by giving "Read/Execute" rights to the the "Plesk IIS WP User" for the \bin folder and all its child objects.


text:
Q: How to move a map using Map press easy Google plugins I'm currently building a website using wordpress. I used Map press easy Google plugins for include a map in my contact tab. However, I want to put for example the map to the left and a form to the right. But I don't find any features which can allow me to move it. I tried to use the .css file but I don't have any html take to select.
Here is my website with my map:
http://hernehillintersport.co.uk/contact/
and here's the code provide by the plugin that I insert into my contact page:

[mappress mapid="1"]

Does who is using this plugin can help me ? Thank's

A: Input this code into your css file:
    input {
        width: 100% !important;
    }

    #mapp0_layout{
        width: 43%;
        float: left;
        margin-right: 5%;
    }

    div.wpcf7 {
        margin: 0;
        padding: 0;
        width: 51%;
        float: right;
    }

    textarea {
    width: 100% !important;
    }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Not able to create a package in db2 sql Hello I was trying to learn db2 sql and I was having some problems.
I want to bind a package, but I don't have any packages to bind.
So when I try to create a package it obviously gives me an error. I know that a package is created when we create a database. But then why doesn't it list any packages when i do
db2 list packages
I have seen a lot of links but no help. I would really appreciate if someone actually explained it to me.
Thank you very much

A: In order to understand a package, you first need to understand dynamic and static queries.
Dynamic queries are created at execution time. Everything from PHP, Perl, Python, Ruby or Java (JDBC) are Dynamic queries. For example, when using Java, you get a Prepared statement, and you assign values (setXXX) to the parameter markers (?).
However, there are other programming languages, such as C, Java (sqlj), cobol, where you create the program, with embedded SQL. For example, when using SQLj, you write a class in a .sql file, and the queries are written in specific tags (not java, but started with #sql { }), then you do a precompilation, that is a process where the SQL are taken out from the code, and translated to natural programming language (ie. from sqlj to Java). The SQL in then inserted into a file that is called a bind file. Once you have that, you need to compile the code (javac to create the .class) and bind the file in the database. In this last step is where the packages are created.
A package is a set of data access plans. However, they were calculated at the bind time, not at the execution time, like in the dynamic queries. They are difference between them.
Finally, in order to create a package, you need to change the bind properties, and eventually the bind file itself.


text:
Q: Where is Wolverine's healing factor "based"? I was just watching The Wolverine and I was wondering about that little electronic probe wrapped around his heart. Now we all know that that's what caused his healing factor to stumble... But why? Does he get his healing factor exclusively from his heart? Is that canon in all of the comics? And if not then where does he get his healing factor from?

A: If damage to his heart means his regenerative abilities are stunted, it means one of two things: either the factor originates in his heart, or his blood carries the factor and the heart is necessary to pump it around the body.
The latter makes more sense.  After all, even if the factor did originate in his heart, how would it get to all the other organs?  It still needs to be in the blood.
So, something which produces chemicals that end up in the blood is probably a factor-production candidate.  Which, by the way, isn't the heart.  The heart doesn't produce anything, it's just a pump.
Bone marrow produces almost all the blood.  However, that isn't too good a candidate, as his own bones got removed.  So it has to be an organ that produces something that ends up in the blood, but not necessarily the main components of blood itself.
For instance, the adrenal glands.  Top of the kidneys.  He still has those, right?  They pump adrenaline into your blood, and they often kick in during great stress and/or body damage.  I'm putting my money on the adrenal glands.


text:
Q: Oracle SQL Developer - Error: "FROM keyword not found where expected" Sorry for my noob question but I'm trying to figure out why my Oracle-SQL indicates the error
"FROM keyword not found where expected" as the picture below:

The code I'm trying to run is the following:
select
   PCKCOO AS 'COMPANHIA_DO_PEDIDO_NUMERO_DO_PEDIDO',
   PCDOCO AS 'DOCUMENTO_NUMERO_DA_OS_FATURA',
   PCDCTO AS 'TIPO_DE_ORDEM',
   PCSFXO AS 'SUFIXO_DO_PEDIDO',
   rpad(HORDT,'0',6) AS 'HORARIO_DE_LIBERACAO',
   FX_PARA_GREGORIANA(HORDJ, 'DD/MM/YYYY')||' '||rpad(HORDT,6,'0') "APROVACAO",
   rank() over (partition by pckcoo, pcdoco, pcdcto, pclnid order by FX_PARA_GREGORIANA(HORDJ, 'DD/MM/YYYY')||' '||rpad(HORDT,6,'0') desc) as rank,
   FROM PRODDTA.F5543170 a,
        proddta.f4209 b,
        proddta.f4301 c,
   WHERE
   PCKCOO = '52171' AND
   PCDCTO In ('OP','C1','C2','FZ','OF') AND
                   ((PCTRDJ >= '117060' AND PCTRDJ <= '117090')
                   or (PCTRDJ >= '116061' AND PCTRDJ <= '116091')
                    ) and
                    ( b.hokcoo = a.pckcoo  and
                      b.hodoco = a.pcdoco and
                      b.hodcto = a.pcdcto and
                      B.HOASTS = '2A') and
                      (c.phkcoo (+)= a.pckcoo and
                       c.phdoco (+)= COALESCE(TO_NUMBER(REGEXP_SUBSTR(PCOORN, '^(-|+)?d+(.|,)?(d+)?$')), 0)  AND
                       c.phdcto (+)= 'OR')

The code was a lot bigger but I cut it into pieces in order to find out why this is happening (specially regarding the
Line: 3
and
Column: 25
as the error message indicated, which for me makes no sense).
Additionally, when I erase some lines in order to get closer towards the error, the red line (as indicated in the picture) keeps in the first line.

Do you have a guess of why this is happening? (sorry for the basic question again).

A: You have a trailing comma in the last table (proddta.f4301 c) of FROM clause and should become
...
FROM PRODDTA.F5543170 a,
     proddta.f4209 b,
     proddta.f4301 c
...

which should be removed.
You also have a trailing comma in your select statement that should also be removed.
...
rank() over (partition by pckcoo, pcdoco, pcdcto, pclnid order by FX_PARA_GREGORIANA(HORDJ, 'DD/MM/YYYY')||' '||rpad(HORDT,6,'0') desc) as rank
...

Finally, for table alias you need to use double instead of single quotes:
select
   PCKCOO AS "COMPANHIA_DO_PEDIDO_NUMERO_DO_PEDIDO",
   PCDOCO AS "DOCUMENTO_NUMERO_DA_OS_FATURA",
   PCDCTO AS "TIPO_DE_ORDEM",
   PCSFXO AS "SUFIXO_DO_PEDIDO",
   rpad(HORDT,'0',6) AS "HORARIO_DE_LIBERACAO",
...

A: You have some trailing commas after AS RANK and after proddta.f4301 c.
Also, you can not use single quotes for column aliases, but you need double quotes;
this should work:
SELECT PCKCOO AS "COMPANHIA_DO_PEDIDO_NUMERO_DO_PEDIDO",
       PCDOCO AS "DOCUMENTO_NUMERO_DA_OS_FATURA",
       PCDCTO AS "TIPO_DE_ORDEM",
       PCSFXO AS "SUFIXO_DO_PEDIDO",
       RPAD(
            HORDT,
            '0',
            6
           )
           AS "HORARIO_DE_LIBERACAO",
          FX_PARA_GREGORIANA(HORDJ, 'DD/MM/YYYY')
       || ' '
       || RPAD(
               HORDT,
               6,
               '0'
              )
           "APROVACAO",
       RANK()
           OVER(
                PARTITION BY pckcoo,
                             pcdoco,
                             pcdcto,
                             pclnid
                ORDER BY
                       FX_PARA_GREGORIANA(HORDJ, 'DD/MM/YYYY')
                    || ' '
                    || RPAD(
                            HORDT,
                            6,
                            '0'
                           ) DESC
               )
           AS RANK
  FROM PRODDTA.F5543170 a,
       proddta.f4209 b,
       proddta.f4301 c
 WHERE     PCKCOO = '52171'
       AND PCDCTO IN ('OP',
                      'C1',
                      'C2',
                      'FZ',
                      'OF')
       AND (   (    PCTRDJ >= '117060'
                AND PCTRDJ <= '117090')
            OR (    PCTRDJ >= '116061'
                AND PCTRDJ <= '116091'))
       AND (    b.hokcoo = a.pckcoo
            AND b.hodoco = a.pcdoco
            AND b.hodcto = a.pcdcto
            AND B.HOASTS = '2A')
       AND (    c.phkcoo(+) = a.pckcoo
            AND c.phdoco(+) = COALESCE(TO_NUMBER(REGEXP_SUBSTR(PCOORN, '^(-|+)?d+(.|,)?(d+)?$')), 0)
            AND c.phdcto(+) = 'OR')

As an aside, you should better switch to ANSI JOIN syntax.


text:
Q: Angular changes to HTML don't apply once the browser is refreshed (ASP.Net Core 2.0 API) I have tried both running the project through VS and VS Code but none worked. The Development environment's already been set. I have tried with multiple browsers but no luck. If I change anything in the HTML, it doesn't get reflected in the browser.

Any ideas?


text:
Q: Exception handling strategy Imagine you have some code that could potentially throw an exception. For example, you try
to send an e-mail message to a mail server, or write a file to disk while you're not sure if you have the right permissions to do so. What kind of exception handling strategy would you use to avoid the exception from being displayed in the browser? What code would you need?

A: All languages that can throw exceptions have some manner by which to catch them.
They often look something like this:
try
{
   some_risky_thing();
}
catch(Exception e)
{
   handle_the_exception();
}

By catching the exception you stop it's propagation up the call stack (where it will eventually find the user).
In order to stop all exceptions getting to the user put one of these at the very top level you have available. Then you can catch any stray exceptions you've missed and do something more appropriate than throw them at the user (like log them somewhere discretely).

A: It depends.
For those cases, I would probably wrap the code that can throw the exception in a try/catch block. Different languages call this construct something different - sometimes it's try/catch/finally, others it's try/except.
However, it's easy to abuse exceptions and exception handling. A few things that you need to avoid are using exception handling for flow control, handling exceptions too soon (keep passing them up the call stack until they can be appropriately handled), and treating non-exceptional conditions as exceptional.


text:
Q: Infinite space or finite space? I have been reading about the nature of space (Brian Greene's and Max Tegmark's recent books) and have a question on the size of space. Both references acknowledge  that general relativity equations allow for a finite and infinite spatial extent. Also, since actual density equals critical density within 1%, space is basically flat. Thus, the two primary options for  flat finite space "shapes" are 3-D torus or video-game-screen. I do not understand why finite space is not considered in the inflation framework, why always an infinite space?

A:
Thus, the two primary options for flat finite space "shapes" are 3-D torus or video-game-screen.

Not true. It's possible that the universe has a nontrivial topology, but there is no evidence for it, and it's not the most common assumption. The most common assumption is that if the universe is closed, it has the topology of a 3-sphere.

I do not understand why finite space is not considered in the inflation framework, why always an infinite space?

We observe that the universe is nearly flat. General relativity predicts that if the universe is not exactly flat at one time, then as it expands it should get less and less flat. This produces a fine-tuning problem: it's surprising that the early universe could have been so incredibly fine-tuned for flatness that the near-flatness would survive until today. This is called the flatness problem.
One of the main selling points of inflation is that it's supposed to solve the flatness problem. Inflation is compatible with a universe that isn't perfectly flat, but it does predict that the universe should be nearly flat. A flat universe is infinite.


text:
Q: How to create a custom, static library in SharePoint? I want to create a static library of documents like the one below.

I'm working on a Mac, so if it is possible to not use SharePoint Designer, that would be great.

A: If you want to show library content like picture above, you can add Content Query Tool WP, select source "/site", list type "Document Library", choose content type if neccessary or apply some filters, group style Default, Item style Image on left and so on and your library may look like list with bullets I think.

A: Create a list
http://office.microsoft.com/en-gb/windows-sharepoint-services-help/create-a-list-HA010099248.aspx

A: On the Site home page click
All Site Content -> Create -> Document Library.

A: Procedure for library creation with additional info is here


text:
Q: Get value from list and show to a label I'm creating a search engine based on SQL database.
Is it possible to get sql data on a List and then show data on labels?
This is my code:
protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=SHKELQIM\SQLEXPRESS;Initial Catalog=Dictionary;Integrated Security=True");
        try
        {
            con.Open();

            SqlDataAdapter da = new SqlDataAdapter("SELECT Word FROM Dictionary WHERE Word like'%" + lblsearch.Text + "%'", con);
            DataSet ds = new DataSet();
            da.Fill(ds, "Dictionary");

            List<string> word = new List<string>();

            foreach (DataRow row in ds.Tables["Dictionary"].Rows)
            {
                word.Add(row["Word"].ToString());
            }
            Label1.Text = word[0].ToString();
       }
        catch (SqlException ex)
        {
            Label1.Text = ex.Message;
        }

        finally
        {
            con.Close();
        }
    }
}
}

I get an ArgumentOutOfRangeException at line - Label1.Text = word[0].ToString();
I don't know why, because that column contains data.
Also how can I position labels where I want, if I need to create new labels for every word?


text:
Q: Does Java make use of SSH config file? I am currently trying to access an Apache Kafka broker using Flink. Within my code, I configured the host IP to be 10.0.x.x which is an EC2 instance within a private subnet and can only be accessed through a bastion host. There is a working setup in ~/.ssh/config which tunnels all my SSH requests through the bastion, so I can access the machine by directly addressing the local IP. However, I am not sure, whether Eclipse or Java makes use of that, nor am I even sure who exactly would be responsible for that, the JVM or my IDE.
Do I have to go an extra mile and configure an explicit SSH tunnel in my Java application, e.g. with JSch, or should this already work and I messed something completely else up?

A: Java can't see your existing tunnel.
For example in IntelliJ you can open an SSH Tunnel, but this is only temporary.
You have to create a connection to localhost.
In Java you are able to load config files into your program, which is fairly easy to do. Depending on your use-case you can use JSch for that.
Before you start you should use the search on this site. There are some very different methods and libraries you can chose from.
Maybe this helps : SSH connection using Java
or this SSH connection with Java
You should consider which one suits best for you.
EDIT:
What Marged said basically answers your question.


text:
Q: How do I keep the selection in ListBox when reloading ItemsSource I am experimenting with WPF and MVVM in our system. However iam having a problem with keeping things selected in lists using only MVVM ( without doing extra CollectionViews ).
What i currently have is the list
ObservableCollection<ReservationCustomerList> Customers;

And then a property storing the selected Customer
ReservationCustomerList SelectedCustomer;

In my opinion now, when the list reloads (actually from another thread async), the selection should be able to be kept, however this does not happen.
Does someone have a nice clean way of achieving this ?

A: The way we did it was that we did not replace the collection. We added/removed the entries and updated existing entries if required. This maintains the selection.
You can use LINQ methods like Except to identify items that are new or removed.

A: In case the reloaded list still contains the last selected item and you want that item to be selected, then you can raise the PropertyChange event for the property SelectedCustomer after your collection gets reloaded.
Please make your sure your viewmodel class implements INotifyPropertyChanged interface.

A: you can use the ICollectionView to select the entity you want.
ICollectionview view = (ICollectionView)CollectionViewSource.GetDefaultView(this.Customers);

view.MoveCurrentTo(SelectedCustomer);

in your Xaml the itemsControl must have IsSynchronizedWithCurrentItem=true
or if the ItemsControl has a SelectedItem property you can simply bind it to your SelectedCustomer Property.

A: When you "reload" your collection you basically replace all values in it with new values. Even those that look and feel identical are in fact new items. So how do you want to reference the same item in the list when it is gone? You could certainly use a hack where you determine the item that was selected by its properties and reselect it (i.e. do a LINQ search through the list and return the ID of the matching item, then reselect it). But that would certainly not be using best practices.
You should really only update your collection, that is remove invalid entried and add new entries. If you have a view connected to your collection all the sorting and selecting and whatnot will be done automagically behind the scenes again.
Edit:
        var tmp = this.listBox1.SelectedValue;
        this._customers.Clear();

        this._customers.Add(item1); this._customers.Add(item2);
        this._customers.Add(item3); this._customers.Add(item4);
        this.listBox1.SelectedValue = tmp;

in the method that does the reset/clear works for me. I.e. that is the code I put into the event handling method called when pressing the refresh button in my sample app. That way you dont even need to keep references to the customer objects as long as you make sure that whatever your ID is is consistent. Other things I have tried, like overwriting the collections ´ClearItems()´ method and overwriting ´Equals()´ and ´GetHashCode()´ didn't work - as I expected.


text:
Q: Alternate color with Angular Material mat-table with parent child rows I have an Angular Material mat-table which I used CSS styling for alternate row colors. Here is the CSS styling:
.mat-row:nth-child(even){
    background-color: #e4f0ec;
}

.mat-row:nth-child(odd){
    background-color:#ffffff;
}

This works when my mat-table does not have defined child rows. When I added another ng-container which is specified with "expandedDetail", this does not work anymore. All the rows is white but the expanded child rows are colored.
I followed the example from material.angular.io
I see other example for row styling but they use tr tags. In the example and my code, I used an ng-container, th and td tags for each column.
Any help is appreciated.
I added the project to stackblitz
https://stackblitz.com/edit/angular-4bcxtv
Here is the HTML code I used

  <ng-container matColumnDef="{{column}}" *ngFor="let column of columnsToDisplay">
     {{column}}
     {{element[column]}}
  </ng-container>

  <ng-container matColumnDef="expandedDetail">

 {{element.position}}

 {{element.symbol}}

 {{element.name}}

 {{element.weight}}

          {{element.description}}
           -- Wikipedia

  </ng-container>

A: When using mat-table with multiTemplateDataRows, the rows are indexed by dataIndex.

See https://github.com/angular/components/issues/12793

A: You can use below css for table row and multiTemplateDataRows. This will strip group of table row + multiTemplateDataRows.
.mat-row:nth-child(4n-1), .mat-row:nth-child(4n) {
    background-color: #e4f0ec;
}

A: Thought I would follow up on this issue as I recently faced it and found pieces of useful information that lead to the following elegant approach:
In your table html we can utilize the built in "odd" or "even" properties, depending on which color you want first.

Then in your CSS add the following:
.striped-row {
    background-color: #ececec;
}

A: dang it - this took me too long to find out and the worse.. I don't know excatly why it's working..
.mat-row:nth-child(2n+1){
  background-color: #e4f0ec;
}
.mat-row:not(:nth-child(4n+1)){
  background-color:#ffffff;
}

I hope I could help you :)

A: You could set your own class on the row and then target it, so as to not mess around with n-depth and complex selectors that break as your html changes.
.my-row {
    background-color: #e4f0ec;
}

.my-row__alternate {
    background-color:#ffffff;
}

A: I hope you might need this.
   .mat-row:nth-child(2n+1) {
        background-color: #FFFFFF;
    }

    .mat-row:nth-child(2n) {
        background-color: #F2F5F7;
    }

    .mat-row:nth-child(4n) {
        background-color: #FFFFFF;
    }

    .mat-row:nth-child(4n+1) {
        background-color: #F2F5F7;
    }

A: I had issue with mat-option css, it had to have alternating background. Solved it with this:
.mat-option {
    &:nth-child(2n+1) {
        background-color: #f0efff;
    }
    &:not(:nth-child(2n+1)) {
        background-color: #fff;
    }
}

Note that second nth-child has ":not" in front


text:
Q: Kendo Jquery Grid - Need to hide Delete button Based on row wise hidden value We have a kendo jquery grid, we need to hide the Delete button row wise based on hidden column value. It is working fine, but after click on Edit and click on Cancel, Delete button appears again. In Grid Databound i am doing this :
 dataBound: function (e) {
                //Selects all delete buttons
                $("#grid tbody tr .k-grid-Delete").each(function () {
                    var currentDataItem = $("#grid").data("kendoGrid").dataItem($(this).closest("tr"));
                    //Check in the current dataItem if the row is deletable
                    if (currentDataItem && currentDataItem.source == '2') {
                        $(this).remove();
                    }
                })
            },

Please suggest.

A: Instead of using the dataBound event, use visible property in the command column. So that it will not display the delete button even you update/cancel the value.
Example:
{ command: [{name: "edit"},{ name: "destroy", visible: function(dataItem) { return dataItem.ProductName!="Chai" } }] }],

Below is the excutable example:
Using visible for destroy command
API Reference:
API Reference


text:
Q: "A sight for sore eyes": with sounds? You have this somewhat informal idiom: "a sight for sore eyes":

: a person or thing that you are very glad to see
   - After being away from home for so long, my friends and family were a sight for sore eyes.
(Merriam-Webster Learner's)

There are examples which don't involve human beings. Possibly used more often with people, but sometimes used to describe something beautiful and heart-warming, as in a scenery or with nature.
Is there an equivalent or similar idiom for sounds? As in related to the feeling of hearing voice of those people you were away from, the sound of a long forgotten engine, or sounds in nature?

A: The phrase you're looking for is
Music to my ears.

a welcome sound to someone; news that someone is pleased to hear.
A: Here's your paycheck for this month. B: Ah, that's music to my ears!

You could also say something like:

Being back at home and hearing the children laughing was music to my ears.
The purring of my Mustang's engine was music to my ears.
I went camping for the first time in years and hearing the sounds of the forest was music to my ears.

You can also turn it into a simile by adding like.

It was like music to my ears.


text:
Q: PIVOT in SQL gives error - ORA-00933: SQL command not properly ended The below query in Oracle SQL gives me a table which consists of ID, Key , Value. I want to convert the Keys to columns and Values as column values while keeping ID as the ID of the row. I tried a PIVOT query. But I get an error - ORA-00933: SQL command not properly ended.

Initial SQL

SELECT * FROM API.publisher_message_queue_detail
WHERE message_seq_id
IN (SELECT message_seq_id FROM API.publisher_message_queue WHERE status='N' AND MESSAGE_TYPE='RetailerNewConnection') ;

Result Table

I want to convert this table to

The PIVOT query I tried

SELECT * FROM API.publisher_message_queue_detail
WHERE message_seq_id IN
    (SELECT message_seq_id FROM API.publisher_message_queue WHERE status='N' AND MESSAGE_TYPE='RetailerNewConnection')
    PIVOT(
    COUNT(message_seq_id)
    FOR MSG_KEY
    IN (
        'MobileNo',
        'ActivatedDate',
        'ActSimNo',
        'ActActdevice',
        'PmsProfileID',
        'PaymentMode',
        'AgentCode',
        'ActPrePost',
        'Sbu',
        'Channel',
        'SalesPath',
        'OrderId'
    )
  )
;

However, I get the below error. What is my mistake here?
ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"
*Cause:
*Action:
Error at Line: 10 Column: 5

A: I am not a fan of using invented syntax for something that is pretty easy to write without it.  Just use conditional aggregation:
SELECT mq.AgentCode, . . . ,  -- whatever columns define each row
       MAX(CASE WHEN mqd.msg_key = 'MobileNo' THEN mqd.msg_value END) as MobileNo,
       MAX(CASE WHEN mqd.msg_key = 'ActivatedDate' THEN mqd.msg_value END) as ActivatedDate,
       . . .
FROM API.publisher_message_queue JOIN
     API.publisher_message_queue_detail mqd
     ON mqd.message_seq_id = mq.message_seq_id
WHERE mq.status = 'N' AND mq.MESSAGE_TYPE = 'RetailerNewConnection'
GROUP BY mq.AgentCode, . . . ;

Or if you want all columns from the parent table:
SELECT *
FROM API.publisher_message_queue JOIN
     (SELECT mqd.message_seq_id,
             MAX(CASE WHEN mqd.msg_key = 'MobileNo' THEN mqd.msg_value END) as MobileNo,
             MAX(CASE WHEN mqd.msg_key = 'ActivatedDate' THEN mqd.msg_value END) as ActivatedDate,
             . . .
      FROM API.publisher_message_queue_detail mqd
      GROUP BY mqd.message_seq_id
     ) mqd
     USING (message_seq_id)
WHERE mq.status = 'N' AND mq.MESSAGE_TYPE = 'RetailerNewConnection';


text:
Q: How does Authorize.net work and how to integrate it? I am a bit confused on how does Authorize.net work and how to integrate it, in my project I am using Angular as frontend and node.js as backend and I have installed Authorize.net via npm install authorizenet also cloned the Node.js sample code and I would like to set Authorize.net like so.
Let's say I have a form on my website where the customer needs to enter their details including the credit card details, my question is when submitting (using HTTP Request Method: POST) does my website need to redirect to Authorize or is there a widget that Authorize uses that I can implement in my website or are the details send directly to Authorize and handled there.
On submitting the details from the website do I simply call let's say the function from the sample codes (modified for my site) charge-credit-card.js ?
After that where do I receive the response, do I need to somehow capture it ?
Do I simply use the Production API Endpoint: https://api.authorize.net/xml/v1/request.apiand use my Api login and transaction key to use Authorize, at least that's the way in the documentation from my understanding - After building the XML object for an API request, submit it to the Authorize.net payment gateway as a standard HTTPS POST to an Authorize.net API endpoint. The exact process for doing this will depend upon the development language that you use.
Thank you in advance.

A: Your server will never know the customer's credit card details.
when user first time registers in your site then you will create one customer for authorize.net using this code and you will save the customer id returned to your db for future reference.
To Update customer's credit card details:
create one API controller from your node server which will return authenticating token from authorize.net to your frontend. Get token code
Your front end will make call to above created controller's API and get the authorize.net token.
Now, your front end will use this token to get the update details form from authorize.
Then you will use authorize webhook facility to know if user has updated theit payment details or not.
Webhooks to be tracked:

*

*net.authorize.customer.paymentProfile.updated

*net.authorize.customer.paymentProfile.created

On receiving below notifications, your node server will perform the whatever task required.
Refer this doc for more details.


text:
Q: How to change screens from python code in Kivy So I'm working on making a fully functional login screen for my first serious kivy app and I want to be able to change windows/screens when the user presses on a button. I know normally in the KV file i'd just use on release but I want the on release to call to a method to verify the users credentials, and if those credentials are correct then change screens. So how in python itself would I be able to call to screen manager to change the screen?
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.uix.screenmanager import Screen, ScreenManager

class LoginLayout(Screen):
    def login(self, **kwargs):
        print("Login function working")
        userEmail = self.ids.username.text
        userPassword = self.ids.password.text
        print(userEmail)
        print(userPassword)
        ScreenManager.current('emailWindow')

class EmailWindow(Screen):
    pass

class WindowManager(ScreenManager):
    pass

kv = Builder.load_file('loginScreen.kv')

class LoginScreen(App):

    def build(self):
        return kv

app = LoginScreen()
app.run()

KV
ScreenManager:
    LoginLayout:
    EmailWindow:

<LoginLayout>:
    name: 'loginWindow'

    canvas.before:
        Color:
            rgba: (28/255, 102/255, 137/255, 1)
        Rectangle:
            pos: self.pos
            size: self.size

    BoxLayout:
        orientation: 'vertical'
        size: root.width, root.height

        Label:
            text: 'Username'
            font_name: 'Framd.ttf'
            font_size: 20

        TextInput:
            id: username
            multiline: False
            size_hint: (.5, .3)
            pos_hint: {'center_x' : .5}

        Label:
            text: 'Password'
            font_name: 'Framd.ttf'
            font_size: 20

        TextInput:
            id: password
            multiline: False
            size_hint: (.5, .3)
            pos_hint: {'center_x' : .5}

        Button:
            text: 'Login'
            size_hint: (.2, .8)
            pos_hint: {'center_x' : 0.5}
            font_name: 'Framd.ttf'
            on_release: root.login()

        Button:
            text: 'Create Account'
            size_hint: (.2, .8)
            pos_hint: {'center_x' : 0.5}
            font_name: 'Framd.ttf'

        Button:
            text: 'Forgot login Info'
            size_hint: (.2, .8)
            pos_hint: {'center_x' : 0.5}
            font_name: 'Framd.ttf'

<EmailWindow>:
    name: 'emailWindow'

    canvas.before:
        Color:
            rgba:  (28/255, 102/255, 137/255, 1)
        Rectangle:
            pos: self.pos
            size: self.size

    BoxLayout:
        orientation: 'vertical'
        size: root.width, root.height

        Label:
            text: 'To:'
            font_name: 'Framd.ttf'

        TextInput:
            multiline: False
            pos_hint: {'center_x': 0.5}
            size_hint: (.5, .3)
            font_name: 'Framd.ttf'

        Label:
            text: 'Subject'

        TextInput:
            multiline: False
            pos_hint: {'center_x': 0.5}
            size_hint: (.5, .3)
            font_name: 'Framd.ttf'

        Label:
            text: 'Body'
            font_name: 'Framd.ttf'

        TextInput:
            size_hint: (.5, .7)
            pos_hint: {'center_x': 0.5}
            multiline: True

        Button:
            text: 'send'
            size_hint: (.2, .8)
            pos_hint: {'center_x' : 0.5}
            font_name: 'Framd.ttf'

A: When a Screen gets added to a ScreenManager, it gets a manager attribute set to the ScreenManager. So in your login() method you can do:
self.manager.current = 'emailWindow'

instead of:
ScreenManager.current('emailWindow')

Note that using ScreenManager, as you do above, references the ScreenManager class, not the ScreenManager instance that is in your App.


text:
Q: Multiple attachment field in sitecore I am using sitecore 8.2.
I need to add two fields of attachment type in one template. But when I attach file in one field, same value is getting copied in another field of attachment type. How can I fix this?

A: The attachment field must be named "Blob" and if that still holds true, you can can only have 1 attachment field per template.  If you have multiple then they will all need to be named "Blob" and therefore will all be hydrated with the same value.
I found the name restriction in this article about the field in Siteocre 6.6
http://blogs.perficient.com/digitaltransformation/2012/12/05/working-with-the-sitecore-attachment-field-type/


text:
Q: ExecuteScalar returns value is not suitable I use Enterprise Library and I have one problem:
string sql = "
               UPDATE StackOverflow SET UserName = @UserName
               WHERE Id = @Id
             ";

DbCommand cmd = base.Database.GetSqlStringCommand(sql);

base.Database.AddInParameter(cmd, "Id", DbType.Int32, StackOverflow.Id);
base.Database.AddInParameter(cmd, "UserName", DbType.Int32, StackOverflow.UserName);

int val = Convert.ToInt32(base.Database.ExecuteScalar(cmd));

Convert.ToInt32(base.Database.ExecuteScalar(cmd)) //returns 0.

I've read this article http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar.aspx
The article says:
The function returns the new Identity column value if a new row was inserted, 0 on failure.
but I did not insert into that table - I only want to update and return updated row Id.

A: You should use ExecuteNonQuery in your case.
ExecuteScalar

Executes the query, and returns the first column of the first row in the result set returned by the query

ExecuteNonQuery

Executes a Transact-SQL statement against the connection and returns the number of rows affected

Your query doesn't return anything, so ExecuteScalar is not the right method to work with.
ExecuteNonQuery on the other side will give the correct information if your query has updated anything.

A: If you modify your SQL statement to the following, I think this will give you the result your expecting:
string sql = "
           UPDATE StackOverflow SET UserName = @UserName
           WHERE Id = @Id

           RETURN @Id
         ";


text:
Q: Can we set ValidatInput(false) for only one element? It's easy to set our action not to validate the input just hooking up the attribute like
[HttpPost, ValidateInput(false)]
public ActionResult Signup(SignupModel model)
{
    ...
}

But I was wondering, is there a way to only do this in just one form field? and not all of them in the actual <form>
or, I have to use this and then worry about encoding properly all other fields?

A: You should not rely on ValidateInput to 'encode' your values. It doesn't encode values - it just rejects some values outright. And even if you use it, you still must encode all your values that are user-entered and displayed on the site in any way.
In fact, because of that - I've never used that validation myself. For example, if all I did was rely on that validation, people would not be able to enter some very basic things in forms like this one, such as trying to show example HTML.
But even the MSDN documentation and every book I've read said that the ASP.NET validation there does not protect you against every possible malicious input. So essentially, you can not rely on it to protect your users. You still must encode values you are displaying (and you should encode them only as you are displaying them, otherwise you'll end up with all sorts of display bugs where you've double-encoded things)

A: Using MVC3 , the attribute can be applied to Model by specifying SkipRequestValidation.


text:
Q: How to initialize all threads of a fixed thread pool before submitting any tasks? (JAVA) I am trying to speed up a program that uses ExecutorService to run tasks in parallel. It basically works like this:

*

*Initialize a fixed size thread pool of size n

*Read a bunch (about 2500 files) of XML files containing input for the tasks

*Process the XML files using the worker threads from the pool
Everything works as expected, but the problem I have is that each worker thread has an instance of a class that does calculations on the input data. This instance is stored in a ThreadLocal. Now, all these thread local instances are created when the correspondig worker thread is started, that means after all XML input files are read.
Since initialization of the calculation objects takes quite some time, I'd rather have the thread pool initialize all worker threads right from the start, so that the initializations of the calculation objects can run parallel to the reading of the input files.
Here is some code to help you get an idea about how it currently works (I stripped code not related to the problem).
Initializing the thread pool and the thread local:
  private final ExecutorService executor = Executors.newFixedThreadPool(Math.max(1, Runtime
      .getRuntime().availableProcessors() - 1));

  private ThreadLocal<Calculator> calculator = new ThreadLocal<Calculator>() {
    @Override
    protected Calculator initialValue() {
      try {
        Calculator instance = createCalculator();
        return instance;
      } catch (Throwable e) {
        throw new RuntimeException(e);
      }
    }
  };

Submitting a new calculation:
  @Override
  public FutureTask<Output> calc(Input input) {
    FutureTask<Output> task = new FutureTask<>(
        new Callable<Rueckgabe>() {
          @Override
          public Output call() throws Exception {
            try {
              return calculator.get().calc(input);
            } catch (Throwable e) {
              System.err.println("Exception: " + e.getMessage());
              e.printStackTrace(System.err);
              return null;
            }
          }
        });
    executor.execute(task);
    return task;
  }

What is the right way to have the ExecutorService start all worker threads for the pool right from the start? Or do I have to something like n dummy tasks to force initialization?
PS: I have to use Java 7 for the foreseeable future due to IT restrictions.

A: Add a Threadfactory to the Executor which would do the initialization.
executor = Executors.newFixedThreadPool(numprocrssors, new ThreadFactory ( ){
    public Thread newThread(Runnable r) {
        return new Thread(r){
            {calculator.get();} // this is an initialization statement, added to all constructors.
        };
    }});


text:
Q: How to add several new columns to a dataframe acording to some rules I have a daframe with several columns but some of them starts with test_
Below a sample with ONLY these test_ columns:
c = pd.DataFrame({'test_pierce':[10,30,40,50],'test_failure':[30,10,20,10] })

What I need to do:
For every column in my dataframe that starts with test_ I want to create another column just after to classify it's value like this:
if test_ > 30.0:
   Y
else:
   N

To get this output:
d = pd.DataFrame({'test_pierce':[10,30,40,50],'class_test_pierce':['N','N','Y','Y'],'test_failure':[30,10,20,10], 'class_test_failure':['N','N','N','N'] })

What I did:
I have the columns I need to classify:
cols = [c for c in c.columns if c.startswith('test_')]

I couldn't proceed from here tho

A: Code with the suggested order:
The code is a little ugly because you asked to be the columns after its test_ column. Otherwise, the code is simpler than that.
cols = [(i,c) for i,c in enumerate(c.columns) if c.startswith('test_')]

count = 1
for index,col in cols:
    value = np.where(c[col] > 30.0,'Y','N')
    c.insert(index+count, 'class_'+col, value)
    count +=1

Code without the suggested order:
cols = [c for c in c.columns if c.startswith('test_')]

for col in cols:
    c[f'class_{col}'] = np.where(c[col] > 30.0,'Y','N')

A: A format that may help you get started is:
cols = [c for c in c.columns if c.startswith('test_')]

for col in cols:
    df[f'class_{col}'] = df.apply(lambda x: 'Y' if x[col] > 30.0 else 'N', axis=1)

Output:
   test_pierce  test_failure class_test_pierce class_test_failure
0           10            30                 N                  N
1           30            10                 N                  N
2           40            20                 Y                  N
3           50            10                 Y                  N


text:
Q: Android java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png" We released an App in the market yesterday and i see that it doesn't install on HTC/Sony Ericsson phones. i could finally get my hands on a HTC phone and got the following logcat but am not able to debug and retify the issue
Device Info
build.board: montblanc
build.bootloader: s1
build.brand: SEMC
build.cpu_abi: armeabi-v7a
build.cpu_abi2: armeabi
build.device: LT22i
build.display: 6.1.1.B.1.54
build.fingerprint: SEMC/LT22i_1261-6006/LT22i:4.0.4/6.1.1.B.1.54/ybt3zw:user/release-keys
build.hardware: st-ericsson
build.host: BuildHost
build.id: 6.1.1.B.1.54
build.manufacturer: Sony
build.model: LT22i
build.product: LT22i_1261-6006
build.radio: unknown
build.serial: CB5121XDB7
build.tags: release-keys
build.time: 1350305827000
build.type: user
build.user: BuildUser
version.codename: REL
version.incremental: ybt3zw
version.release: 4.0.4
version.sdk_int: 15

Log Cat
01-23 00:09:35.735 E/AndroidRuntime(29152): FATAL EXCEPTION: main
01-23 00:09:35.735 E/AndroidRuntime(29152): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.os.Looper.loop(Looper.java:137)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:35.735 E/AndroidRuntime(29152):     ... 11 more
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:35.735 E/AndroidRuntime(29152):     ... 25 more
01-23 00:09:35.735 E/AndroidRuntime(29152): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.View.<init>(View.java:2969)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:35.735 E/AndroidRuntime(29152):     at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:35.735 E/AndroidRuntime(29152):     ... 28 more
01-23 00:09:36.246 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:36.246 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL
01-23 00:09:39.239 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:39.239 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL
01-23 00:09:41.161 E/AndroidRuntime(29212): FATAL EXCEPTION: main
01-23 00:09:41.161 E/AndroidRuntime(29212): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.os.Looper.loop(Looper.java:137)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:41.161 E/AndroidRuntime(29212):     ... 11 more
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:41.161 E/AndroidRuntime(29212):     ... 25 more
01-23 00:09:41.161 E/AndroidRuntime(29212): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.View.<init>(View.java:2969)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:41.161 E/AndroidRuntime(29212):     at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:41.161 E/AndroidRuntime(29212):     ... 28 more
01-23 00:09:42.252 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:42.252 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL
01-23 00:09:45.255 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:45.255 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL
01-23 00:09:48.268 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:48.268 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL
01-23 00:09:51.261 E/wpa_supplicant(11724): RX ctrl_iface - hexdump_ascii(len=11):
01-23 00:09:51.261 E/wpa_supplicant(11724):      53 49 47 4e 41 4c 5f 50 4f 4c 4c                  SIGNAL_POLL
01-23 00:09:52.061 E/AndroidRuntime(29272): FATAL EXCEPTION: main
01-23 00:09:52.061 E/AndroidRuntime(29272): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m7.nomad/com.m7.nomad.SplashActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.os.Looper.loop(Looper.java:137)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.main(ActivityThread.java:4448)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Method.invokeNative(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Method.invoke(Method.java:511)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at dalvik.system.NativeStart.main(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget.LinearLayout
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2712)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2772)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.Activity.setContentView(Activity.java:1835)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.m7.nomad.SplashActivity.onCreate(SplashActivity.java:46)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.Activity.performCreate(Activity.java:4465)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-23 00:09:52.061 E/AndroidRuntime(29272):     ... 11 more
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: java.lang.reflect.InvocationTargetException
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
01-23 00:09:52.061 E/AndroidRuntime(29272):     ... 25 more
01-23 00:09:52.061 E/AndroidRuntime(29272): Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable-hdpi/ic_menu_share.png"
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.Integer.invalidInt(Integer.java:138)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.Integer.parse(Integer.java:375)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at java.lang.Integer.parseInt(Integer.java:366)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.content.res.TypedArray.getInt(TypedArray.java:254)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.View.<init>(View.java:2969)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.view.ViewGroup.<init>(ViewGroup.java:418)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.widget.LinearLayout.<init>(LinearLayout.java:178)
01-23 00:09:52.061 E/AndroidRuntime(29272):     at android.widget.LinearLayout.<init>(LinearLayout.java:174)
01-23 00:09:52.061 E/AndroidRuntime(29272):     ... 28 more

XML File (after making Changes)

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:contentDescription="Splash Screen"
    android:gravity="center"
    android:src="@drawable/splash_logo" />

XML before making changes
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/primary_color"
    android:gravity="center"
    android:orientation="vertical"
    android:textAlignment="center" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:contentDescription="Splash Screen"
        android:gravity="center"
        android:src="@drawable/splash_logo" />

</RelativeLayout>

A: Please post your xml code here.
"Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.widget. LinearLayout". This line says there is something wrong at line 24.


text:
Q: Getting black screen when running IOS simulator on virtual machine I am using MacOS version 10.15 Beta with Xcode version 11.3.1

A: The issue turned out to be that xcode was too new for the Macos version, and was solved by downgrading xcode to 10.3


text: Q: Do all (most) frequencies of UV cause sunburn? I recently read in a book called "The universe in your hand" that the reason you can get hurt by ionizing radiation is that the photons carry enough energy to ionize an atom, which can cause chemical reactions to happen, thus causing reactions to the radiation in different ways. But to my knowledge only higher frequencies of UV light are ionizing. Does this mean that only these frequencies cause sunburn, or that the other causes sunburn in some other way?


text:
Q: how to compile CUDA to llvm IR? I've been trying for three days to compile a CUDA kernel into llvm IR and I couldn't do it. I've changed  langoptions.cpp and added CUDA=1; in the constructor , but still the clang give me Error messages for cuda syntax (like _synchthreads() call).
I've done the following:

*

*downloaded llvm (including clang) modified langoptions.cpp (CUDA=1;
in the constructor), and installed it.

*installed CUDA toolkit 4.1 and CUDA SDK.

*compiled a CUDA example using clang using:
clang -I${CUDA_HOME}/include -I${CUDA_SDK_INC}
~/workspace/cuda_example/mis_kernel.cu -S -emit-llvm -o
~/workspace/cuda_example/a.ll

and as I said it doesn't work.

A: clang –x=CUDA in the public LLVM trunk is something experimental done outside of NVIDIA; you should contact the llvm-dev alias with questions.
NVCC doesn't support emitting LLVM IR.


text:
Q: From Python to Database or CSV Quite new to Python and scraping but have so far got this code together to get the artist and title of the song off the site.
When I run the code I get first a list of the artists  followed by a list of the titles.
My question is: how do I get these results into a database or a csv file?
I have notebook++ working for python, plus pycharm and idle and this bit of code works OK with all three.  Any suggestions most welcome.
from urllib import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://www.officialcharts.com/charts/singles-chart/19800203/7501/" )

bsObj = BeautifulSoup(html)
nameList = bsObj. findAll("div" , {"class" : "artist",})
for name in nameList:
print(name. get_text())

html = urlopen("http://www.officialcharts.com/charts/singles-chart/19800203/7501/" )
bsObj = BeautifulSoup(html)
nameList = bsObj. findAll("div" , {"class" : "title"})
for name in nameList:
print(name. get_text())

A: This should write to a two-column csv file where the first column is the artist and the second column is the song title.
import csv
from urllib import urlopen
from bs4 import BeautifulSoup

html = urlopen("http://www.officialcharts.com/charts/singles-chart/19800203/7501/" )

bsObj = BeautifulSoup(html)
artistList = bsObj.findAll("div", {"class": "artist"})
songList = bsObj.findAll("div", {"class": "title"})
artists = [ a.getText().strip() for a in artistList ]
songs = [ s.getText().strip() for s in songList ]

with open('csvfile.csv', 'wb') as csvfile:
    writer = csv.writer(csvfile, delimiter=",")
    for c in zip(artists, songs):
        writer.writerow(c)

A: Or you could simply use pandas to_csv function:
import pandas as pd
from pandas import DataFrame as df
from urllib.request import urlopen
from bs4 import BeautifulSoup

html = urlopen("http://www.officialcharts.com/charts/singles-chart/19800203/7501/" )

bsObj = BeautifulSoup(html)
DB = df(columns = ['artists','songs'])
artistList = bsObj.findAll("div", {"class": "artist"})
songList = bsObj.findAll("div", {"class": "title"})
DB['artists'] = [ a.getText().strip() for a in artistList ]
DB['songs'] = [ s.getText().strip() for s in songList ]

DB.to_csv('csvfile.csv')


text:
Q: thread safe data structure for get and set I find myself in need of a data structure which only needs the ability to enter objects, retrieve and delete them (I have no interest in its size and etc..).
This data structure will be accessed from multiple threads both adding and getting specific objects.
Currently I am using in my program a concurrent HashMap:
key = object.hashCode()
data = object

The question: I was wondering this is the best way to go ?
Note:

*

*I do not add any object twice

*the only hashMap methods i use are get, put, remove.
Thanks alot!

A: Have a look at java.util.concurrent.atomic package.

A small toolkit of classes that support lock-free thread-safe programming on single variables.

AtomicReference is one solution.
Refer to related SE question:
When to use AtomicReference in Java?

A: You could use a HashTable what is a thread safe version of HashMap. https://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html


text:
Q: How to use blowfish in C++ as an external dll in C# It seems there's no blowfish in C# that would do the same as this one.So I decided to use it as an external and if it doesnt work again then translate the whole blowfish in C#.
But first I'll try to use as an external.
Could you take a look at the C++ blowfish and tell me if I have to change the function parameters(some of them are LPBYTE,which is not included in C#).
Also,I'd be thankful if you tell me how to use them as an external dll(I have it compiled as a dll already),but the function parameters in C++ are frustrating me.
Edit:
I need to call only Initialize,Encode and Decode.
Thanks in advance!

A: I've had a similar problem to this on a previous project.
Having looked at the C++ code, it is using ECB as you suspected in your previous post.
I think I see the reason why you get different results using Blowfish.NET (Arkain's suggestion). The C++ code casts the inputs into two DWORDs as it enciphers. I believe Blowfish.NET will be doing the right thing by preserving the byte order in the DWORDs it uses internally to encipher.
For example:
In the C++ code, the bytes 0102030405060708 become 0x04030201 and 0x08070605.
The .NET implementation will be becoming 0x01020304 and 0x05060708.


text:
Q: Caps lock to change input language disabled by Spotify.app I use caps lock to change input language, but when Spotify.app is ON caps lock behaves like normal caps lock.
Any ideas how to get def macOS functionality back? I looked through Spotify.app settings and couldn't find key mapping options.


text:
Q: big int compiler implementations? i am building a compiler similar to c , but i want it to parse integers bigger than 2^32 . hows it possible?how has been big integers been implemented in python and ruby like languages ..!!

A: There are libraries to do this sort of thing.
Check out gmplib.

A: There are lots of big number libraries, see this wikipedia article for a complete list.
GMP(GNU Multiple Precision Arithmetic Library) is sufficient for everything I have encountered. NTL is more of the same but is object orientated.
Generally these libraries represent the numbers with arrays with each digit of a number as a character if you want to roll your own but it is a lot of work.

A: If you want to write it yourself, follow my trip through memory lane ;-).
In the old days, when computers used 8 bits. We often needed to calculate with big numbers (like > 255). And we all had to write the routines. For example the addition.
If we needed to add numbers of two bytes to each other we used the following algorithm:

*

*Add the least significant bytes.

*If the result exceeded 8 bits, the carry bit was set.

*Add the most significant bytes and the carry flag (if set).

*If the result exceeded 8 bits you produced an overflow error (but you don't need to do this if you want more that 2 bytes.

You can extend this to more bytes/words/dwords/qwords and to other operators.

A: I believe you'll need some sort of bigint library, which are available on the net, just do a bit of searching and you may find one that's suitable for your project.
Because, simply parsing the integers, I believe, will not be enough. Your users will want not only to store, but also, probably, perform operation with such numbers.

A: There is a slide by Felix von Leitner that covers some bignum basics. Personally i think it is quite informative and technical.

A: C++ Big Integer Library from Matt McCutchen
https://mattmccutchen.net/bigint/
C++ source code only. Very simple to use.

A: You would have to use some sort of struct in c to achieve this. You will find this is difficult if you are on and x86 platform and not x64 as well. If you're on x86, prepare to get very familiar with assembly and the carry flag.
Good luck!


text:
Q: How can i get the duplicate value in oracle Hi I have selected the following columns from various tables using left join and i am getting the following result.
Box_ID    BOX_NAME  VALUE  PROM_EFFDATE       PROM_CLOSEDATE

11      JE 1        115    2/27/2014
11      JE 2        80     2/27/2014              3/6/2014
11      JE 4        60     2/17/2014
11      JE 3

If the PROM_CLOSEDATE have some value, then the equivalent BOX_NAME(JE2) should be shown once again with null value and null effdate. We can enter any other different value for different periodic time.
This is the actual requirement. the result should be:
Box_ID    BOX_NAME  VALUE  PROM_EFFDATE       PROM_CLOSEDATE

    11      JE 1        115    2/27/2014
    11      JE 2        80     2/27/2014              3/6/2014
    11      JE 2
    11      JE 4        60     2/17/2014
    11      JE 3

like that i have to get the value.
Here I have used as per san's guidance,
SELECT Box_ID,BOX_NAME, VALUE, PROM_EFFDATE, PROM_CLOSEDATE
  FROM tab
UNION
SELECT Box_ID,BOX_NAME, NULL, NULL, NULL
 FROM tab
WHERE PROM_CLOSEDATE IS NOT NULL
order by 2

But i want the result with more precise. when i enter the value and effective date (without giving CLOSE_DATE) for JE2(2nd ) Occurance, that time i am getting the following output.
Box_ID    BOX_NAME  VALUE  PROM_EFFDATE       PROM_CLOSEDATE

        11      JE 1        115    2/27/2014
        11      JE 2        80     2/27/2014              3/6/2014
        11      JE 2        90     4/6/2014
        11      JE 2
        11      JE 4        60     2/17/2014
        11      JE 3

But actually, i dont need the record with NULL value, NULL effective date, NULL closedate when the BOX_NAME(here JE2) has record with no Closedate.
I need only when it has record with closedate is NOT NULL case. Even it has record with value, effective date and no closedate, the null record should not come.
This is my requirement. Please Help me to get the answer.

A: The simplest way is by using union all
WITH tab(Box_ID,BOX_NAME, VALUE, PROM_EFFDATE, PROM_CLOSEDATE) AS (
SELECT 11,'JE 1',115,'2/27/2014', NULL FROM dual UNION ALL
SELECT 11,'JE 2', 80,'2/27/2014','3/6/2014' FROM dual UNION ALL
SELECT 11,'JE 2', 90,'2/28/2014','3/7/2014' FROM dual UNION ALL
SELECT 11,'JE 4', 60,'2/17/2014', NULL  FROM dual UNION ALL
SELECT 11,'JE 3', NULL, NULL, NULL  FROM dual)
----------
--End of data preparation
----------
SELECT Box_ID,BOX_NAME, VALUE, PROM_EFFDATE, PROM_CLOSEDATE
  FROM tab
UNION
SELECT Box_ID,BOX_NAME, NULL, NULL, NULL
 FROM tab
WHERE PROM_CLOSEDATE IS NOT NULL
order by 2

Output:
| BOX_ID | BOX_NAME |  VALUE | PROM_EFFDATE | PROM_CLOSEDATE |
|--------|----------|--------|--------------|----------------|
|     11 |     JE 1 |    115 |    2/27/2014 |         (null) |
|     11 |     JE 2 |     80 |    2/27/2014 |       3/6/2014 |
|     11 |     JE 2 | (null) |       (null) |         (null) |
|     11 |     JE 3 | (null) |       (null) |         (null) |
|     11 |     JE 4 |     60 |    2/17/2014 |         (null) |

A: SELECT Box_ID,BOX_NAME, VALUE, PROM_EFFDATE, PROM_CLOSEDATE
  FROM tab
UNION
SELECT Box_ID,BOX_NAME, NULL, NULL, NULL
 FROM tab
WHERE (PROM_CLOSEDATE IS NOT NULL
AND PROM_EFFDATE IS NOT NULL) AND
(PROM_CLOSEDATE IS NULL
AND PROM_EFFDATE IS NOT NULL)
order by 2

This code will work


text:
Q: Check Printer Status in PHP7 I'm testing below code to print labels with custom text
    $outputString='^XA
^FO100, 200
^AD,50,25
^FH_^FD Hello world _7E ^FS
^XZ';
     $Ip='xxx.xxx.x.xx';
     $port='xxxx'
        $fp = fsockopen($Ip, $port, $errno, $errstr);
    if (!$fp) {
        echo "$errstr ($errno)<br />\n";
    } else {
        try {
            $kk=fwrite($fp, $outputString, strlen($outputString));
            fclose($fp);
            echo 'Successfully Printed';
        } catch (Exception $e) {
            echo 'Caught exception: ', $e->getMessage(), "\n";
        }
    }

It is working fine but I am looking for way to find out any method or way to find out if the printer has printed the data successfully i.e if there is no paper it still prints Successfully Printed

A: What you want is the ZPL command ~HS (Host Status).  It returns a three line response with lots of useful information about the current state of the printer.  The first two lines provide flags for label present, paper out, head up, over/under temperature, etc.
See https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf for more details


text:
Q: Magento: Overriding Contacts controller does not work I am trying to override the Mage_Contacts_IndexController in my module. This is my config.xml file:
<config>
<modules>
    <Magex_Corecontrollerextend>
        <version>0.1.0</version>
    </Magex_Corecontrollerextend>
</modules>
<frontend>
    <routers>
        <contacts>
            <args>
                <modules>
                    <magex_corecontrollerextend before="Mage_Contacts">Magex_Corecontrollerextend</magex_corecontrollerextend>
                </modules>
            </args>
        </contacts>
    </routers>
</frontend>
</config>

I also added the controller, this is the code:
require_once Mage::getModuleDir('controllers', 'Mage_Contacts') . DS . 'IndexController.php';

class Magex_Corecontrollerextend_IndexController extends Mage_Contacts_IndexController {
    public function postAction() {
        echo 'override working!';
        die();
    }
}

It is placed in Magex/Corecontrollerextend/controllers/IndexController.php. The module is enabled but the override is just not working, it always calls the controller in the core. I also cleared the cache. What could be the problem? Its Magento 1.9.
Thanks!


text:
Q: CategoryComponent.html:53 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed I have angular 8 frontends and node js is a backend
I fetched multiple table results in a single function with sequelize package.
below I mention the result JSON from the backend...
{
"filtergroups": [
    {
        "id": 1,
        "name": "Ram",
        "subcatId": "1",
        "childcatId": 1,
        "createdAt": "2019-11-13T00:00:00.000Z",
        "updatedAt": "2019-11-13T00:00:00.000Z",
        "filters": [
            {
                "id": 1,
                "name": "2 GB",
                "filterGroupId": "1",
                "productId": "1",
                "createdAt": "2019-11-19T00:00:00.000Z",
                "updatedAt": "2019-11-27T00:00:00.000Z"
            }
        ]
    },
    {
        "id": 2,
        "name": "Internal Storage",
        "subcatId": "1",
        "childcatId": 1,
        "createdAt": "2019-11-05T00:00:00.000Z",
        "updatedAt": "2019-11-24T00:00:00.000Z",
        "filters": [
            {
                "id": 2,
                "name": "8 GB",
                "filterGroupId": "2",
                "productId": "1",
                "createdAt": "2019-11-20T00:00:00.000Z",
                "updatedAt": "2019-11-20T00:00:00.000Z"
            }
        ]
    }
],
"products": [
    {
        "id": 1,
        "name": "A7",
        "childcatId": "1",
        "subcatId": "1",
        "price": 18000,
        "mrp": 21000,
        "discription": "sfhshsfhsf",
        "image": "http://bestjquery.com/tutorial/product-grid/demo3/images/img-7.jpeg",
        "createdAt": "2019-11-13T00:00:00.000Z",
        "updatedAt": "2019-11-14T02:00:00.000Z"
    },
    {
        "id": 2,
        "name": "A8",
        "childcatId": "1",
        "subcatId": "1",
        "price": 22000,
        "mrp": 25000,
        "discription": "7578",
        "image": "http://bestjquery.com/tutorial/product-grid/demo3/images/img-8.jpeg",
        "createdAt": "2019-11-20T00:00:00.000Z",
        "updatedAt": "2019-11-21T00:00:00.000Z"
    },
    {
        "id": 3,
        "name": "Woodland",
        "childcatId": "2",
        "subcatId": "1",
        "price": 2500,
        "mrp": 2800,
        "discription": "7575",
        "image": "http://bestjquery.com/tutorial/product-grid/demo3/images/img-7.jpeg",
        "createdAt": "2019-11-20T00:00:00.000Z",
        "updatedAt": "2019-11-13T00:00:00.000Z"
    }
]

}
This JSON I am getting an error in display section like

CategoryComponent.html:53 ERROR Error: Error trying to diff '[object
  Object]'. Only arrays and iterables are allowed

service.ts
getAllProduct(): Observable<Filter_group[]>{
let params_url = new HttpParams().set('fil_outlet',this.name);
console.log('new my ss--',this.name);
return this.http.get<Filter_group[]>("http://localhost:4500/mobile_store");

};
my component.ts
   this.route.queryParams.subscribe(params => {
   this.subcat = params ['=='];
   this.childcat = params ['fil_outlet'];

if (this.subcat){

    this.categoryService.getAllProduct().subscribe((filter_groups: Filter_group[]) => {
      this.filter_groups = filter_groups;
      console.log('new Query Params:', filter_groups);
    });

   }
});

Error its

component.html
 <mat-accordion multi="true" *ngFor="let filter_group of filter_groups">
      <mat-expansion-panel>
        <mat-expansion-panel-header  >
          {{filter_group.name}}
        </mat-expansion-panel-header>

name

      </mat-expansion-panel>
    </mat-accordion>

              40%
              Add to cart

{{product.name}}

                {{product.price}}
                {{product.mrp}}

A: You are taking up the full object which has both filter_groups and products and trying to loop it. Angular loops through arrays not objects.
You need to change your code in your subscription
 this.categoryService.getAllProduct().subscribe((data: Filter_group) => {
      this.filter_groups = data.filtergroups;
      this.products = data.products;
      console.log('filter group:', filter_groups );
      console.log('products:', products);
    });


text:
Q: How to apply text-align left in the first column and text-align right in the others I have a Table to style, how can I apply text-align:left; just for the first column and text-align:right; for the other columns?
Here my Table example:
http://jsfiddle.net/gianlucaguarini/hAv7P/
At the moment the text-align is left for all the columns.

A: You might want to look at the :first-child pseudo-class (W3C definition) - this is exactly the kind of thing it was designed for.  You could use it like this:
.table td {
    text-align: right;
}

.table td:first-child {
    text-align: left;
}

The :first-child pseudo-class means the selector only matches the first <td> in each <tr>.
Example here: http://jsfiddle.net/xv5Cn/1/

A: You need to specify the following CSS:
.table td,
.table th
{
    text-align:left;
}

#right,
.table td + td,
.table th + th
{
    text-align:right;
}

Example here: http://jsfiddle.net/mWeYM/
You can read more about adjacent siblings CSS selector here: http://www.w3.org/TR/CSS2/selector.html#adjacent-selectors

A: Hey Manna i have updated your fiddle just follow this link:
http://jsfiddle.net/hAv7P/9/
All you need to do is add a class to the  which yu want aligned and then add css as in the fiddle


text:
Q: how to change username at cpanel? I rented a host with Cpanel service.
But the company I created them from has put an inappropriate username for Cpanel.
I want to change the username.
Thank you for helping me.

A: As you mentioned, I think you use Cpanel users to host your website.
you can not change your username with user accessibility.
So you have to ask your hosting provider to do it for you but keep it in your mind that changing the username of Cpanel has some consequences. as your database will not work anymore.

At the moment you change the username of any cPanel account automatically all the things related to the username will be messed up. As we all know the WordPress database, MySQL Database has a default prefix username which is generated at the time of creating a database.
So I will recommend that if you are using a MySQL database in your website then MySQL configuration should also be changed to the new account username accordingly and everywhere the things get changed.

Also take a look at this: changing Cpanel username


text:
Q: Changing a column type to longer strings in rails At the first migration, I declared on a column content to be string
Activerecord made it to be string(255) according to annotate gem.
After I push the app to heroku, which uses postgres, if I enter in the form in content a string longer than 255 I get the error
PGError: ERROR: value too long for type character varying(255)

Problem is I need that content to contain a string that is extremely long perhaps (free text, could be thousands of chars)

*

*What variable (is string is not appropriate for this) would pg accept?

*How do I create a migration to replace the type of that column

thanks

A: You should use text with Rails if you want a string with no length limit. A migration like this:
def up
  change_column :your_table, :your_column, :text
end
def down
  # This might cause trouble if you have strings longer
  # than 255 characters.
  change_column :your_table, :your_column, :string
end

should sort things out. You might want :null => false or some other options on the end of that too.
When you use a string column without an explicit limit, Rails will add an implicit :limit => 255. But if you use text, you'll get whatever arbitrary length string type the database supports. PostgreSQL allows you to use a varchar column without a length but most databases use a separate type for that and Rails doesn't know about varchar without a length. You have to use text in Rails to get a text column in PostgreSQL. There's no difference in PostgreSQL between a column of type text and one of type varchar (but varchar(n) is different). Furthermore, if you're deploying on top of PostgreSQL, there's no reason to use :string (AKA varchar) at all, the database treats text and varchar(n) the same internally except for the extra length constraints for varchar(n); you should only use varchar(n) (AKA :string) if you have an external constraint (such as a government form that says that field 432 on form 897/B will be 23 characters long) on the column size.
As an aside, if you are using a string column anywhere, you should always specify the :limit as a reminder to yourself that there is a limit and you should have a validation in the model to ensure that the limit is not exceeded. If you exceed the limit, PostgreSQL will complain and raise an exception, MySQL will quietly truncate the string or complain (depending on the server configuration), SQLite will let it pass as-is, and other databases will do something else (probably complain).
Also, you should also be developing, testing, and deploying on top of the same database (which will usually be PostgreSQL at Heroku), you should even use the same versions of the database server. There are other differences between databases (such as the behavior of GROUP BY) that ActiveRecord won't insulate you from. You might be doing this already but I thought I'd mention it anyway.

Update: Newer versions of ActiveRecord do understand varchar without a limit so, with PostgreSQL at least, you can say:
change_column :your_table, :your_column, :string, limit: nil

to change a varchar(n) column to varchar. text and varchar are still the same thing as far as PostgreSQL is concerned but some form builders will treat them differently: varchar gets an <input type="text"> whereas text gets a multi-line <textarea>.

A: While the accepted answer is excellent, I wanted to add an answer here that hopefully better deals with the original posters question part 2, for non experts like myself.

*How do I create a migration to replace the type of that column

generating scaffold migration
You can generate a migration to hold your change by typing in your console (just replace the table for your tables name, and column for you column name)
rails generate migration change_table_column

This will generate skeleton migration inside you Rails application /db/migrate/ folder. This migration is a placeholder for your migration code.
For example I want to create a migration to change the type of a column from string to text, in a table called TodoItems:
class ChangeTodoItemsDescription < ActiveRecord::Migration
  def change
     # enter code here
     change_column :todo_items, :description, :text
  end
end

Running your migration
Once you've entered the code to change the column just run:
rake db:migrate

To apply your migration. If you make an error you can always revert the change with:
rake db:rollack

Up and Down methods
The accepted answer references Up and Down methods, instead of the newer Change method. Since rails 3.2 old style Up and Down Methods presented a few advantages over the newer Change method. 'Up and Down' avoid ActiveRecord::IrreversibleMigration exception. Since the release of Rails 4 you can use reversible to avoid this error:
class ChangeProductsPrice < ActiveRecord::Migration
  def change
    reversible do |dir|
      change_table :products do |t|
        dir.up   { t.change :price, :string }
        dir.down { t.change :price, :integer }
      end
    end
  end
end

Enjoy Rails :)


text:
Q: reading a wav file using scipy.io.wavfile and then writing doesn't reproduce the original file I am trying to work with wav files in Python.
I downloaded the SciPy library which supposedly can do the job.
To see that it works I'm trying to read a wav file and then write it again to disk.
For some reason the new wav file that is created is not similar to the old one.
import scipy.io.wavfile as wav
(rate,sample) = wav.read("/vocal.wav")
wav.write("/temp.wav", rate, sample)

A:
scipy.io.wavfile.write(filename, rate, data) : Writes a simple
  uncompressed WAV file.
  (From here)

I suspect that your input file has some kind of compression.

A: I do not have much experience with SciPy, but according to the documentation of scipy.io.wavfile.write the array do be written is expected to be an array of int type values. While scipy.io.wavfile.read tells that type of the array is determined by the type of data in the file. They may not be the same.
It would be good, to read the written file once again and check if the array read from original contains the same date after conversion to int.


text:
Q: How to get Google Indexed pages count i have to modify some tool for a company, for an SEO Audit.
My problem : I can't find the solution of number of google indexed page count. This is the actual code :
function get_indexed_page_count($url)
{
    $ip = $_SERVER["SERVER_ADDR"];
    $url = get_domain($url);
    $result = json_decode(@file_get_contents("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:$url&filter=0&gl=fr&userip=$ip"));
    return (int)$result->responseData->cursor->estimatedResultCount;
}

with this code :
 $indexed_pages = get_indexed_page_count($url);
print_info("Nombre de pages indéxées dans Google.fr", get_status($indexed_pages, 1.1, 0.9, "Il y a " . $indexed_pages . " pages indéxées pour ce site sur Google.fr"));

However, since 2016, ajax googleapis is deprecated, so i try to modify this line, but no matter, i can't solve it.
Anyone have an idea to solve my problem, and show how many pages are indexed (maybe with the "Google Custom Search" ?)  ?
Thank you.
Sincerely, Adri.

A: Why to go with so much complexity when Google has provided a much better option for us. Just verify the website through Google Webmasters:
https://www.google.com/webmasters
Add your website there, it will ask you to place a meta code on your website, I suggest to put it just above your  tag. Once added, click on verify by navigating to Google Webmasters.
Now, you need to follow the below steps in Google Webmasters:

*

*Navigate to "Crawl" under which you will see "Sitemaps"

*Just submit your sitemap URL which must be in .xml format. For example, if your sitemap is located here: www.xyz.com/sitemap.xml, just submit sitemap.xml there by clicking "Add Sitemap" at upper right corner.
It will then show you how many pages of the website has been indexed in Google.
The other way to find number of pages indexed is:

*

*Goto Google.com

*Search as below:
site:yoursite.com

*Go to the last page of Google search. You will see a number there just below search bar which is the number of indexed pages.
But I strongly recommend to verify your website with Google Webmasters to keep an eye regularly over there.
Let me know if I can be of more help to you.