text:
Q: How to implement Progressive Disclosure in C++ API Following the article Programmers Are People Too by Ken Arnold, I have been trying to implement the progressive disclosure pattern for an API.
Basically, the idea mentioned in the text is to break the API into categories and only present the user with what he or she needs. The rest is hidden, reducing complexity for someone using the API. In the text, he presents his idea with the JButton class and its 100+ methods:

[...] we could use progressive disclosure to help reduce the
  complexity of that JButton class: put the expert stuff in an object
  returned by a getExpertKnobs() method, and the graphics subsystem
  hooks in an object returned by a getIntegrationHooks() method, and you
  would be left with a button API that had just a handful of methods—the
  basic methods we all need.

I have been trying to implement a minimal example of this using C++. So far, I have not gotten acceptable results. What I want is this behavior and simplicity:
First, the class containing only the basic and widely spread methods:
struct Base
{
    Base()
    {
        // Initialize attributes (possibly many)
    }

    void simpleMethod()
    {
        // Do something simple...
    }

    ExtBase ext()
    {
        // Access to advanced features;
        // this is the tricky part for me...
    }

private:
    // Attributes...
};

Then, the class containing the advanced/expert stuff:
struct ExtBase
{
    ExtBase()
    {
        // Not sure of what goes here...
    }

    void advancedMethod()
    {
        // Do something complicated...
    }
};

Ideally, this "API" could be used simply like this by the user:
int main()
{
    Base aBase;

    aBase.simpleMethod();           // OK
    aBase.advancedMethod();         // Fails. Not available by default.

    aBase.ext().simpleMethod();     // Possibly OK, not sure...
    aBase.ext().advancedMethod();   // OK

    return 0;
}

I have been looking around the web to find examples of this, but so far, nothing really interesting came up. I did find an example in Java from this library but I was not able to replicate it in C++.
Does anyone have any idea on how this could be done?

A: The following is a code example that creates two "twin" objects where the lifetime is closely related to each other.
Technically, Extra is a member of Base, but Extra consists of nothing but a pointer (reference) to the instance of Base that contains it. Think of it as a child node that has a pointer to a parent node.
I have used this pattern with Visual C++ (in particular when programming in Component Object Model environments). However, I do not know whether this pattern is valid in C++ Standard.
I have heard that, in some C++ compiler environments, the taking and storing of the address of *this during constructor execution is illegal, which may in fact return different addresses during and after constructor execution.
Note that this pattern breaks several things: Base is not trivially-copyable, not trivially-moveable, and not trivially-assignable. If you need those things you have to explicitly implement these operations.
class Base
{
public:
    class Extra
    {
        friend class Base;

    public:
        // able to access Base members via m_refBase
        void extraMethod();

        // if Base is const-qualified, the Extra& that is
        // returned from Base::extra() is also const-qualified,
        // therefore the const-qualified Extra::extraMethod()
        // will be selected
        // (and non-const methods on Extra will not be callable)
        void extraMethod() const;

    private:
        // constructor - to be called by Base constructor
        Extra(Base& refBase)
            : m_refBase(refBase)
        {
        }

    private:
        Base& m_refBase;
    };

    friend class Extra;

public:
    void baseMethod();

public:
    Extra& extra() { return m_extra; }
    const Extra& extra() const { return m_extra; }

public:
    Base()
        : m_someOtherData(...)
        , m_extra(*this)
    {
        m_someOtherData.otherInitializations();
    }

private:
    SomeOtherData m_someOtherData;
    Extra m_extra;
};

A: This is fairly simple, all things considered. What you need to do is create a class (nested or not) which is a friend of the main one. It will be created on-demand when you access the "advanced" API. The overall code looks like this:
class Main
{
private:
    class Advanced
    {
    public:
        void AdvancedMethod() {/*directly access Main's internals*/}

    private:
        Advanced(Main &m) :data_(m) {}

        Main &data_;

        friend class Main;
    };

    friend class Advanced;
public:

    Advanced Adv() {return Advanced(*this);}
};

Note that we construct a new Advanced every time you call Adv. We could have it be a member variable, but this permits us to:

*

*Not disturb the size/layout of Main. Advanced takes up some space, so by adding it as a member variable of Main, we make Main take up more space.

*Not disturb the functionality of Main. If we have Advanced store a reference to Main, then Advanced would not be trivially copy/moveable. And therefore, any class that stores it as a member would not be trivially copy/moveable. By returning a constructed object, we allow Main to be trivially copy/moveable regardless of how Advanced is implemented.

Of course, there are downsides:

*

*We lose const-correctness. Notice how Adv has no const version. That's because it really can't have a const version. Since we're returning an object rather than a reference to one, a user can always do this:
Advanced var = some_main.Adv();

This will work even if some_main is const. If Advanced were a member, then the const could propagate correctly.

A: I'm not sure it's the best way to do things, but this might be a place where you could use (or abuse, depending on your viewpoint) multiple inheritance:
class basic_button {
    virtual void basic_func1() = 0;
    virtual void basic_func2() = 0;
};

class graphic_button {
    virtual void graphic_func1() = 0;
    virtual void graphic_func2() = 0;
};

class expert_knobs {
    virtual void expert_func1() = 0;
    virtual void expert_func2() = 0;
};

class button : public basic_button, public graphic_button, public expert_knobs {
// ...
};

This way the button class itself is a fairly simple, straightforward object we've segmented the interface into pieces, and we can (for example) have separate documentation for basic_button, graphic_button, and so on. At the same time, the actual object we create is just a single, simple object so we don't need to try to coordinate lifetimes of multiple objects and such to get correct behavior.
At the same time, I can't help thinking that the basic idea here is largely broken. This strikes me as largely a documentation problem, which should be dealt with via decent documentation that just has a number of sections:
Basic Operations
documentation of basic operations here

Advanced Operations
documentation of advanced operations here

etc.

A: Use interface segregation for this purpose
Create separate interface classes, one with Basic functionality & the other with Advanced functionality. Generally the Advanced might inherit from Basic interface, not mandatory though.
Implement a concrete class which inherits from these two and implements both interfaces. Depending on which interface is provided, the user will be restricted to a specific mode.
As in the below code, different interfaces offer different segments of the functionality to the user.
#include <iostream>
using namespace std;

struct BasicMaths
{
    virtual int Sum(int a, int b) = 0;
    virtual int Difference(int a, int b) = 0;
    virtual int Product(int a, int b) = 0;
    virtual float Division(int a, int b) = 0;
};

struct TrigoMaths
{
    virtual double Sine(double angle) = 0;
    virtual double Cos(double angle) = 0;
    virtual double Tan(double angle) = 0;
};

struct AdvancedMaths: public BasicMaths, public TrigoMaths
{
};

class Math:public AdvancedMaths
{
public:

    int Sum(int a, int b)
    {return a+b;}
    int Difference(int a, int b)
    {return a-b;}
    int Product(int a, int b)
    {return a*b;}
    float Division(int a, int b)
    {return a/b;}
    double Sine(double angle)
    {return angle;}
    double Cos(double angle)
    {return angle;}
    double Tan(double angle)
    {return angle;}
};

int main()
{
    BasicMaths* bm = new Math();

    //// Basic Maths ///////////////////////////////////////////////////////
    //These will work fine
    cout << "Sum : " << bm->Sum(10, 5) << endl;
    cout << "Difference : " << bm->Difference(10,5) << endl;
    cout << "Product : " << bm->Product(10, 5) << endl;
    cout << "Division : " << bm->Division(10, 5) << endl;

    //These won't work as 'bm' doesn't have these interfaces
    //cout << "Sine : " << bm->Sine(90) << endl;
    //cout << "Cos : " << bm->Cos(90) << endl;
    //cout << "Tan : " << bm->Tan(90) << endl;

    ////Trigo Maths  ///////////////////////////////////////////////////////
    //These will work fine
    TrigoMaths* tm = dynamic_cast<TrigoMaths*>(bm);

    cout << "Sine : " << tm->Sine(90) << endl;
    cout << "Cos : " << tm->Cos(90) << endl;
    cout << "Tan : " << tm->Tan(90) << endl;

    //These won't work as 'tm' doesn't have these interfaces
    //cout << "Sum : " << tm->Sum(10, 5) << endl;
    //cout << "Difference : " << tm->Difference(10,5) << endl;
    //cout << "Product : " << tm->Product(10, 5) << endl;
    //cout << "Division : " << tm->Division(10, 5) << endl;

    //// Advanced Maths  ///////////////////////////////////////////////////////
    AdvancedMaths* am = dynamic_cast<AdvancedMaths*>(tm);

    //All interfaces work fine here
    cout << "Sum : " << am->Sum(10, 5) << endl;
    cout << "Sine : " << am->Sine(90) << endl;

    return 0;
}

.
.
.


text:
Q: Reading binary from MySql-Database form C# I am reading a value from a MySql-Database:
Select SomeColumn from SomeTable

The datatype of SomeColumn is set to BINARY.
In C# I receive a string that contains the following:

What exactly do I receive? The database itself shows the value as a hex value: 0x01080001

A: if you are sur that your data is stored as hex ,  you can convert the hex to byte[] using the function bellow :
public static byte[] StringToByteArray(string hex) {
    return Enumerable.Range(0, hex.Length)
                     .Where(x => x % 2 == 0)
                     .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
                     .ToArray();
}

if you are using sql server there is 'FILESTREAM' store  allows  you to access to your binary (blob) using sql or ntfs system .
however , i still don't think storing the binary data to database is a good idea .
if your data smaller then 256K you can store it as blob , however if is bigger then 256k please consider the store it as a file .
UPDATE :

Application designers often face the question of whether to store
  large objects in a filesystem or in a database. Often this decision is
  made for application design simplicity. Sometimes, performance
  measurements are also used. This paper looks at the question of
  fragmentation – one of the operational issues that can affect the
  performance and/or manageability of the system as deployed long term.
  As expected from the common wisdom, objects smaller than 256K are best
  stored in a database while objects larger than 1M are best stored in
  the filesystem. Between 256K and 1M, the read:write ratio and rate of
  object overwrite or replacement are important factors. We used the
  notion of "storage age" or number of object overwrites as way of
  normalizing wall clock time. Storage age allows our results or similar
  such results to be applied across a number of read:write ratios and
  object replacement rates.

https://www.microsoft.com/en-us/research/publication/to-blob-or-not-to-blob-large-object-storage-in-a-database-or-a-filesystem/

A: You can parsed to a string:
StringBuilder sb = new StringBuilder();

foreach(byte b in fileBytes)
{
    sb.Append(Convert.ToString(b, 2).PadLeft(8, '0'));
}

var myValue = sb.ToString();

redpajama_set_name: RedPajamaStackExchange


text:
Q: Does Google support Article Rich Snippets? I have been looking at rich snippets in google. Google lists the following schema.org items as being supported:

*

*Reviews

*People

*List item

*Products

*Businesses and organizations

*Recipes

*Events Music

I have noticed that in search results, Google displays Rich Snippets for Article and BlogPosting. When clicking on the link and using Firebug to check the source code, I can see that the schema.org being used is indeed BlogPosting.
I've tried adding BlogPosting to my sample code and using Google's Rich Snippet tool to check the results but I cant get an image to display. I am using the following code:

 etc etc....

...

Although it doesn't show the image in the Rich Snippet tool, it does recognize that an image has been set and displays the url text in the "Extracted rich snippet data from the page" box. I have tried using the SoftwareApplication schema and then I get an image to show.
My question is: Does the Rich Snippet tool restrict the images it shows based on the schemas listed above, and actually once in the live search results, Rich Snippets for Article and BlogPostings will be shown?

A: Google has introduced Rich Snippet for Articles, so you can now use articles snippet for your article/blog post.
See this official document from Google on implementing rich snippet for your articles: https://developers.google.com/structured-data/rich-snippets/articles
And as far as your image issue is concerned, try to apply the snippet code as per the document above and it should show the image. I tested it and all worked fine.

A: As of now, Google is not going to display product images in SERPS for schema.org/Article or schema.org/BlogPosting item types. It's going to show the Author profile image that it pulls from Google+ using one of two methods:
https://plus.google.com/authorship
... think about it. Everyone would be trying to attach add some (spammy) image next to their blog post in SERPS. Google only wants to show verified authorship by their authentification methods (via G+) -- not just from any "author" tag in microdata.
Yes, the rich snippet tool will not show you what the actual SERP will always look like, because it depends on the query. In fact they say

Note that there is no guarantee that a Rich Snippet will be shown for
  this page on actual search results.


text:
Q: Drupal views: Splitting fields by content type I have a few views in my Drupal site that are getting extremely out of hand... The views show nodes from different content types in the same listing, and are formatted differently depending on the content type... This has so far required a lot of custom PHP-fields, rewriting output, and a bit of black magic. Totally unmaintanable code. :)
So, what I'm looking for is a module, or a technique, or a hack, to more gracefully make different content types and their CCK fields show up in the same listing.
Here's a pseudoexample:
Video node:
Node Title
Embedded video field
Comment count
News article node:
Custom CCK title field
Node body
Comment count but with rewritten output to insert a div class or something
For this example in my current layout, I would add node title to fields but exclude it from output, then outputting it in a php customfield with an if-statement, same with node body (since both node types have titles and bodies but only one of the two types should display it). Comment count would be added twice, then I'd exclude both and output them again through a custom php-field with a switch-statement for content types... Ugly, huh?
Any advice on modules, hacks or better design choices are welcome. :)

A: It sounds like you are trying to do what the theme layer does but in the views admin.
Go back a little, switch to node view and then create a template in the format node-view-VIEWNAME.tpl.php (as explained here)which handles the display logic for all nodes likely to be pulled in by your view.
This will encapsulate all of your display logic for the view in a single template, and save you from having to do hacks in the other display templates or in your view itself.
If you need help getting the template to be picked up then let us know, but it seems like you know what you are doing.


text:
Q: powershell - Variable reference is not valid. ':' was not followed by a valid variable name character what im trying do to, is get radarr to delete the movie requested from the web client after it moves it to the persons folder so if default path is D:\Movies\ then just log it, if it goes any where else other then D:\Movies\ then it will remove it from the Client.
looking for some guidance as i am completely new to powershell.
$movie_path = $env:radarr_moviefile_relativepath
$default_path = "D:\Movies\"

$RADARRIP="localhost"
$RADARRPORT="7878"
$RADARRAPIKEY="******"

$Logfile = "C:\Custom Scripts\Radarr.log"

Function LogWrite
{
   Param ([string]$logstring)

   Add-content $Logfile -value $logstring
}

if ($default_path == $movie_path)
{
LogWrite $movie_path $radarr_movie_id "added to server"
LogWrite " "
}
else
{
Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr_movie_id" -X GET -H "X-Api-Key: $RADARRAPIKEY -k
LogWrite $movie_path $radarr_movie_id "added to server"
LogWrite $radarr_movie_id "selected movie from server"
Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr_movie_id" -X DELETE -H "X-Api-Key: $RADARRAPIKEY -k
LogWrite $radarr_movie_id "movie removed from list"
LogWrite " "
}

Errors
+ Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr ...
+                               ~~~~~~~~~~
Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name.
At \\WIN-TQS12RTGKSQ\Custom Scripts\radarr.ps1:29 char:31
+ Invoke-WebRequest -Uri http://$RADARRIP:$RADARRPORT/api/movie/$radarr ...
+                               ~~~~~~~~~~
Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidVariableReferenceWithDrive

A: tl;dr

*

*Replace $RADARRIP:$RADARRPORT with ${RADARRIP}:$RADARRPORT (or ${RADARRIP}:${RADARRPORT}

*Placing {...} around a variable name disambiguates it from surrounding characters, which is necessary here because : would be considered part of the name.

When you use an unquoted compound string as a command argument, PowerShell implicitly treats it as an expandable string, i.e. as if it had been passed enclosed in double quotes ("...")
This answer provides a comprehensive overview of expandable strings (string interpolation) in PowerShell.
The relevant aspect is that a : following a variable reference such as $RADARRIP is considered part of that variable reference: the part between $ and : is considered the name of a (PowerShell) drive, and what follows the : is expected to be the name or path of an item in that drive; that is, the variable reference is interpreted as an instance of PowerShell's namespace variable notation.
Therefore, PowerShell must explicitly be told that the : following $RADARRIP is not part of the variable reference, for which you have several options:

*

*The most PowerShell-idiomatic option is to use {...} to delineate the variable name:

Invoke-WebRequest -Uri http://${RADARRIP}:$RADARRPORT/api/movie/$radarr_movie_id ...

*

*Alternatively, use `, PowerShell's escape character, to escape the : in order to treat it as a literal:

Invoke-WebRequest -Uri http://$RADARRIP`:$RADARRPORT/api/movie/$radarr_movie_id ...

*

*Finally, quoting : selectively works too; however, note that such compound strings only work if the first component is unquoted (see this answer):

Invoke-WebRequest -Uri http://$RADARRIP':'$RADARRPORT/api/movie/$radarr_movie_id ...

A: If you are using anaconda, this worked for me:
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
python3 -m pip install tensorflow
Verify install:
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
Visit: https://www.tensorflow.org/install/pip#windows-wsl2

A: No errors, Completed had to simplify it
$movie_path = $env:radarr_movie_path
$movie_id = $env:radarr_movie_id
$movie_name = $env:radarr_movie_title

function Get-TimeStamp {

    return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)

}

Function LogWrite
{
   Param ([string]$logstring)

   Add-content $Logfile -value $logstring
}

$Logfile = "C:\Custom Scripts\Radarr.log"

if ($movie_path.contains("D:\Movies\"))
{
LogWrite "$(Get-TimeStamp) | $movie_path | $movie_id | added to server"
}
else
{
Invoke-WebRequest -Uri http://127.0.0.1:7878/api/movie/"$movie_id"?apikey=YourAPIkey -Method Delete
LogWrite "$(Get-TimeStamp) | $movie_path | $movie_id | $movie_name | movie removed from list"
}


text:
Q: Error a function-definition is not allowed here before '{' token : for teensy 3.2 arduino void setup() {
  //
SysEx Config Message Structure:
0xF0 # SysEx message start byte
0x14 # Manufacturer ID; 0x14 is actually Fairlight, but I don't forsee too many conflicts here...
0x01 # Knobber knob channel number
0x01 # Knobber button channel number
0x0E # Knobber knob CC number
0x0F # Knobber button CC number
0x01 # Knobber button behaviour (0 = momentary, 1 = toggle)
0xF7 # SysEx message end byte

*/

#include <Bounce.h>
#include <EEPROM.h>

// Default settings - will be overwritten if EEPROM values are present.
int knobChan = 1; int buttonChan = 1; int knobCC = 14; int buttonCC = 15;
int kPin = 0; int bPin = 0; int behaviour = 1;
int inputAnalog, ccValue, iAlag;
boolean toggled = false;
Bounce button0 = Bounce(0,5);

void setup() {
  //MIDI rate
  Serial.begin(31250);
  pinMode(bPin, INPUT_PULLUP);
  delay(5);
  knobChan =  EEPROM.read(1);
  usbMIDI.sendControlChange(44, knobChan, 2);
  delay(5);
  buttonChan = EEPROM.read(2);
  delay(5);
  knobCC = EEPROM.read(3);
  delay(5);
  buttonCC = EEPROM.read(4);
  delay(5);
  behaviour = EEPROM.read(5);
}

void loop() {
  // put your main code here, to run repeatedly:
  // Check for SysEx config message
  if(usbMIDI.read() && usbMIDI.getType() == 7) {
     if (usbMIDI.getData1() > 1 && usbMIDI.getData1() < 9) {
        // unpack SysEx
        byte * sysbytes = usbMIDI.getSysExArray();
        if (sysbytes[0] == 0xf0 && sysbytes[7] == 0xf7) { // Good length; legit sysex.
          if(sysbytes[1] == 0x14) {  // It's either Knobber or a Fairlight CMI...
              // 2, 3, 4, 5 and 6 can now be written to EEPROM and to global vars
              EEPROM.write(1, sysbytes[2]);
              knobChan = sysbytes[2];
              EEPROM.write(2, sysbytes[3]);
              buttonChan = sysbytes[3];
              EEPROM.write(3, sysbytes[4]);
              knobCC = sysbytes[4];
              EEPROM.write(4, sysbytes[5]);
              buttonCC = sysbytes[5];
              EEPROM.write(5, sysbytes[6]);
              behaviour = sysbytes[6];

          }
        }
     }
 }

  if(behaviour > 0) {
      // Pushbutton - MOMENTARY behaviour
      button0.update();
      if (button0.fallingEdge()) {
          usbMIDI.sendControlChange(buttonCC, 127, buttonChan);
      }
      if (button0.risingEdge()) {
          usbMIDI.sendControlChange(buttonCC, 0, buttonChan);
      }
  } else {
      // Pushbutton - TOGGLE behaviour
      button0.update();
      if(button0.fallingEdge()) {
         if (toggled) {
             usbMIDI.sendControlChange(buttonCC, 0, buttonChan);
             toggled = false;
         } else {
             usbMIDI.sendControlChange(buttonCC, 127, buttonChan);
            toggled = true;
         }
      }
  }

  inputAnalog = analogRead(kPin);
  if(abs(inputAnalog - iAlag) > 7) {
    // calc the CC value based on the raw value
    ccValue = inputAnalog/8;
    // Invert the pot value (because I soldered it backwards...)
    int inverted = map(ccValue, 127, 0, 0, 127);
    // send the MIDI
    usbMIDI.sendControlChange(knobCC, inverted, knobChan);
    iAlag = inputAnalog;
  }

  delay(5); // limits message frequency
}

I'm getting an error in the void loop block of code, I don't know what's exactly wrong and why is it giving me the following error: a function-definition is not allowed here before '{' token
It's my first time attempting this code so I don't know what is wrong
Please help as it is important for my class. I would really really appreciate it! :)
UPDATE: Here are the error messages that I'm getting:

Arduino: 1.8.10 (Mac OS X), Board: "Teensy 3.2 / 3.1, Serial, 96 MHz
  (overclock), Faster, US English"
In file included from
  /Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:28:0:
  /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/EEPROM/EEPROM.h:
  In function 'void setup()':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/EEPROM/EEPROM.h:136:5:
  error: invalid declaration of member template in local class
       template< typename T > T &get( int idx, T &t ){
       ^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/EEPROM/EEPROM.h:143:5:
  error: invalid declaration of member template in local class
       template< typename T > const T &put( int idx, const T &t ){
       ^
Test1KnobberCode:37:14: error: a function-definition is not allowed
  here before '{' token  void setup() {
                ^
Test1KnobberCode:54:13: error: a function-definition is not allowed
  here before '{' token  void loop() {
               ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:31:5:
  warning: unused variable 'knobChan' [-Wunused-variable]  int knobChan
  = 1; int buttonChan = 1; int knobCC = 14; int buttonCC = 15;
       ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:31:23:
  warning: unused variable 'buttonChan' [-Wunused-variable]  int
  knobChan = 1; int buttonChan = 1; int knobCC = 14; int buttonCC = 15;
                         ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:31:43:
  warning: unused variable 'knobCC' [-Wunused-variable]  int knobChan =
  1; int buttonChan = 1; int knobCC = 14; int buttonCC = 15;
                                             ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:31:60:
  warning: unused variable 'buttonCC' [-Wunused-variable]  int knobChan
  = 1; int buttonChan = 1; int knobCC = 14; int buttonCC = 15;
                                                              ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:32:5:
  warning: unused variable 'kPin' [-Wunused-variable]  int kPin = 0; int
  bPin = 0; int behaviour = 1;
       ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:32:19:
  warning: unused variable 'bPin' [-Wunused-variable]  int kPin = 0; int
  bPin = 0; int behaviour = 1;
                     ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:32:33:
  warning: unused variable 'behaviour' [-Wunused-variable]  int kPin =
  0; int bPin = 0; int behaviour = 1;
                                   ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:33:5:
  warning: unused variable 'inputAnalog' [-Wunused-variable]  int
  inputAnalog, ccValue, iAlag;
       ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:33:18:
  warning: unused variable 'ccValue' [-Wunused-variable]  int
  inputAnalog, ccValue, iAlag;
                    ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:33:27:
  warning: unused variable 'iAlag' [-Wunused-variable]  int inputAnalog,
  ccValue, iAlag;
                             ^
/Users/bharatvangani/Documents/Arduino/Test1KnobberCode/Test1KnobberCode.ino:34:9:
  warning: unused variable 'toggled' [-Wunused-variable]  boolean
  toggled = false;
           ^
Test1KnobberCode:116:1: error: expected '}' at end of input  }  ^
Multiple libraries were found for "Bounce.h"  Used:
  /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Bounce
  Multiple libraries were found for "EEPROM.h"  Used:
  /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/EEPROM
  exit status 1 a function-definition is not allowed here before '{'
  token

A: Your problem are the first two lines of your file. In the first line you start defining your setup function, in the second line you start a line comment, followed by some text. This should rather be a block comment.
To fix your issue, remove the void setup() { and change the line comment to the start of a block comment /*.
Update: Your error message output clearly supports my answer. Look at this simplified error:

In file included from Test1KnobberCode.ino: EEPROM.h: In function 'void setup()':

So here the compiler tells us that there is an error in the EEPROM library (which is very unlikely, so this is the first hint that we probably fucked up something ourselfs)

EEPROM.h: error: invalid declaration of member template in local class template< typename T > T &get( int idx, T &t ){

This is the exact error. Looks like somethings wrong with the declaration of a template class. The exact error likely does not matter, because the problem is on our side.

Test1KnobberCode: error: a function-definition is not allowed here before '{' token void setup() {

Another hint that we fucked up. Here the compiler tells us, that we can't define void setup() here (because we are currently in the scope of a function)

Test1KnobberCode: error: a function-definition is not allowed here before '{' token void loop() {

Same hint as before, just with void loop()
So to clarify my anser: Change this (the first 16 lines of your code)
void setup() {
  //
SysEx Config Message Structure:
0xF0 # SysEx message start byte
0x14 # Manufacturer ID; 0x14 is actually Fairlight, but I don't forsee too many conflicts here...
0x01 # Knobber knob channel number
0x01 # Knobber button channel number
0x0E # Knobber knob CC number
0x0F # Knobber button CC number
0x01 # Knobber button behaviour (0 = momentary, 1 = toggle)
0xF7 # SysEx message end byte

*/

#include <Bounce.h>
#include <EEPROM.h>

to this
/*
SysEx Config Message Structure:
0xF0 # SysEx message start byte
0x14 # Manufacturer ID; 0x14 is actually Fairlight, but I don't forsee too many conflicts here...
0x01 # Knobber knob channel number
0x01 # Knobber button channel number
0x0E # Knobber knob CC number
0x0F # Knobber button CC number
0x01 # Knobber button behaviour (0 = momentary, 1 = toggle)
0xF7 # SysEx message end byte
*/

#include <Bounce.h>
#include <EEPROM.h>
#include <usbmidi.h> //see note below

Note: I noticed that you are using usbmidi without actually defining it anywhere. You probaby missed including the library.


text:
Q: CrossThreadMessagingException WPF OpenFileDialog I get this exception:

Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException was unhandled HResult=-2146232832 Message=An exception 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException' occurred
   Source=Microsoft.VisualStudio.Debugger.Runtime
   StackTrace: at Microsoft.VisualStudio.Debugger.Runtime.Main.ThrowCrossThreadMessageException(String formatString)
  InnerException:

When I use this code:
    public string ShowOpenFileDialog(string initialPath, string filter = null)
    {
        var dialog = new OpenFileDialog()
        {
            InitialDirectory = Directory.Exists(initialPath) ? Path.GetDirectoryName(initialPath) : String.Empty,
            FileName = File.Exists(initialPath) ? Path.GetFileName(initialPath) : String.Empty,
            Filter = filter
        };

        if (dialog.ShowDialog() == true)
        {
            return dialog.FileName;
        }

        return String.Empty;
    }

I am not explicitly using multithreading, so what is causing this?  It happens frequently during debugging, but not all the time.  I've changed the method signature about a million times, because I was passing in ref/out parameters and thought they might be the cause.
edit: I'm calling it from the UI Thread. Button in View -> Command in ViewModel -> ShowOpenFileDialog.

A: Although I'm not still sure why this is happening, I've figured out how to fix in my case.  I have multiple projects in my solution, and I've configured two startup projects (client + server).  When I start both projects with debugging, it appears that the debugger has trouble with that.  So I just switch off debugging for the project that matters least at the moment, so there is only one project for the debugger to handle.

A: I have same problems (CrossThreadMessagingException) with multiple startup project in Visual Studio 2012.
This problem can be solved in VS 2012, if you assign one project as "Start without debugging".
What the interest, this problem is not apparent in the Visual Studio 2013.


text:
Q: Markdown to Word/PDF converter for Linux Does anyone know of a good Markdown to Word COnverter?  It would be great if it also converts to PDF.

A: It seems Pandoc can convert Markdown to PDF (via LaTeX). Converting to Word should be possible by converting to ODT or RTF first.

A: It seems like there are no automatic tools to do that without having to use workaround that can result in serious glitches (ex: markdown -> odt -> docx).
I have found that generating a html, then doing a copy/paste into a word document looks surprisingly good.

A: Byword is a mac app that converts to word and PDF. It also has some great features that make writing markdown even easier.
Also if you want to style your documents - I can recommend the Marked app which allows you to apply css to your .md files and export to a range of formats.

A: For Mac OS there is also the free mou app which allows you to edit Markdown. Using the print function you can output the rendered document as pdf.

A: Since you're asking for a Linux solution, here is one:
pandoc README.md -o README.pdf

A: I would suggest using the ReText editor. It is included in Ubuntu Linux and probably other Linux distributions. It gives you a live preview of your markdown. And it has export functionality for PDF, Office(ODT) and HTML. Just open your markdown file and go to File -> Export -> PDF/ODT/HTML. You should be able to open both HTML and ODT in MS Word.


text:
Q: Rails how create a fallback helper? I'm trying to create a fallback helper for a object but on the page just shows the image broken link and the assets url. so, know how?
def display_image(pdata)
    unless pdata.nil?
      image_tag(pdata.image)
    else
      image_tag("/assets/fallback/small_foto.png")
     end
end

A: I think it is an issue with how you're organising and referencing your assets. From the Rails docs:

In regular views you can access images in the app/assets/images
  directory like this:
<%= image_tag "rails.png" %>

And if you want to use the custom fallback folder:

Images can also be organized into subdirectories if required, and then
  can be accessed by specifying the directory's name in the tag:
<%= image_tag "icons/rails.png" %>

So, move your fallback folder into assets/images and reference it with:
<%= image_tag "fallback/small_foto.png" %>


text:
Q: Can I open the contact card from Lync for Business? I have an application running on an internal server that can open Skype chats in Lync for Business using the following:
Chat with Martin

Is it possible to open the contact card with a URL? The contact card is found by right clicking a user in the chat pane and then clicking See Contact Card.


text:
Q: the onDismissed property makes my ListView crash when a method is called I got a red error screen when I get to the view of my ListView. It looks like the problem comes from the "onDismissed" property.
Below is my ListView code and the i'll also include the "deleteRival" method that is called during the onDismissed
ListView(
                                        shrinkWrap: true,
                                        children: snapshot.data!.map((rival){
                                          return Center(
                                            child: Card(
                                              child: Material(
                                                elevation: 10.0,
                                                child: Dismissible(
                                                  direction: DismissDirection.endToStart,
                                                  key: ObjectKey(rival),
                                                  onDismissed: deleteRival(rival.idRival), // <------- THE PROBLEM IS HERE
                                                  background: buildSwipeActionRight(),
                                                  child: ListTile(
                                                    tileColor: Colors.lightBlue,
                                                    title: Text(
                                                      rival.nameRival,
                                                      textAlign: TextAlign.center,
                                                      style: const  TextStyle(color: Colors.white),
                                                    ),
                                                  ),
                                                ),
                                              ),
                                            ),
                                          );
                                        }).toList(),
                                      );

This is my "deleteRival" method:
deleteRival(rivalId) async{
  final statAccess = DatabaseModel();
  await statAccess.deleteRival(rivalId).then((value){
    if (value == 1){
      alertDialog("Suppression réussie", true);
    }else{
      alertDialog("Suppresion échouée", false);
    }

  });

}

A: The type of method deleteRival is Future<dynamic> Function(dynamic) and the expected method type by the onDismissed is void Function(DismissDirection)?, this is why you get this error.
Just replace onDismissed: deleteRival(rival.idRival), with  onDismissed: (_) => deleteRival(rival.idRival),


text:
Q: RequireJS and Angular routes I'm having an issue with the routes of Angular. I don't have any errors, the routes are simply not working.
The following code is the simplest example where I redirect any route to #/reports. I checked the following piece of code without RequireJS and it works. I'm now wondering if I forgot something about the interactions between requireJS and Angular ?
I bootstrap Angular (and I get the bootstrap log), is there a link with my issue ?
Here is the code :
define([
    'jquery',
    "angular",
    "angular-route"
],
function($, angular, AngularRoutes){

    var gameApp = angular.module('gameApp', [
        'ngRoute'
    ]);

    gameApp.config(['$routeProvider',
        function($routeProvider) {
            $routeProvider.
                otherwise({
                    redirectTo: '/reports'
                });
        }
    ]);

    angular.element().ready(function() {
        angular.bootstrap(document, [gameApp['name']]);
        console.log('Angular Bootstrapped');
    });
});

A: I needed to have the <div data-ng-view></div> tag in my HTML, otherwise routing doesn't work.

A: Your bootstrapping is wrong. It should be:
angular.bootstrap(document, ['gameApp']);


text:
Q: How to access a popup menu on CardView I have a recyclerview where there is an image for a popup menu in recylerview item (see the image below), so I created a popup menu with edit and delete option on cardView I have tried the below code but when I click on the popup menu button, nothing's happening
In my NotesAdapter I want to retrieve data

Here is my item.xml file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
    android:layout_margin="5dp"
    app:cardCornerRadius="10dp"
    app:cardBackgroundColor="@android:color/holo_red_dark"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="90dp"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    <RelativeLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_marginTop="5dp"
        android:layout_height="wrap_content">

        <TextView
            android:layout_marginStart="5dp"
            android:textColor="@android:color/white"
            android:textSize="25sp"
            android:text="Title"
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"/>

        <ImageView
            android:id="@+id/menuIcon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_marginEnd="5dp"
            android:layout_marginTop="5dp"
            android:clickable="true"
            app:srcCompat="@drawable/ic_popup_menu" />

    </RelativeLayout>

    <TextView
        android:layout_margin="5dp"
        android:textSize="15sp"
        android:textColor="@android:color/white"
        android:text="Section"
        android:id="@+id/desc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    </LinearLayout>
</androidx.cardview.widget.CardView>

Here is my NotesAdapter.java
public class NotesAdapter extends RecyclerView.Adapter<NotesAdapter.MyHolder>
{

    List<Listdata> noteslist;
    private Context context;
    public  NotesAdapter(List<Listdata> noteslist,Context context)
    {
        this.context=context;
        this.noteslist=noteslist;
    }

    @NonNull
    @Override
    public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item,viewGroup,false);

        MyHolder myHolder=new MyHolder(view);
        return myHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull MyHolder myHolder, int position) {
        final Listdata data=noteslist.get(position);
        myHolder.title.setText(data.getTitle());
        myHolder.desc.setText(data.getDesc());

    }

    @Override
    public int getItemCount() {
        return noteslist.size();
    }

    class  MyHolder extends RecyclerView.ViewHolder  {
        TextView title,desc;

        public MyHolder(@NonNull View itemView) {
            super(itemView);
            title=itemView.findViewById(R.id.title);
            desc=itemView.findViewById(R.id.desc);
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Listdata listdata=noteslist.get(getAdapterPosition());
                    Intent i=new Intent(context, StreamActivity.class);
                    i.putExtra("id",listdata.id);
                    i.putExtra("title",listdata.title);
                    i.putExtra("desc",listdata.desc);
                    context.startActivity(i);
                }
            });

            ImageView menuIcon = itemView.findViewById(R.id.menuIcon);
            menuIcon.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    PopupMenu menu = new PopupMenu(v.getContext(), v);
                    menu.setGravity(Gravity.END);
                    menu.getMenu().add("Edit").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                        @Override
                        public boolean onMenuItemClick(MenuItem item) {

                            Listdata listdata=noteslist.get(getAdapterPosition());
                            Intent i=new Intent(context, EditActivity.class);
                            i.putExtra("id",listdata.id);
                            i.putExtra("title",listdata.title);
                            i.putExtra("desc",listdata.desc);
                            context.startActivity(i);

                            return false;
                        }
                    });

                    menu.getMenu().add("Delete").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                        @Override
                        public boolean onMenuItemClick(MenuItem item) {
                            return false;
                        }
                    });

                }
            });

        }

    }

}

A: Try this
@Override
public void onBindViewHolder(@NonNull final MyHolder myHolder, final int position) {
    final Listdata data=noteslist.get(position);
    myHolder.title.setText(data.getTitle());
    myHolder.desc.setText(data.getDesc());
    myHolder.menuIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            PopupMenu popupMenu = new PopupMenu(context, myHolder.menuIcon);
            popupMenu.inflate(R.menu.popup_menu);
            popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {

                    switch (item.getItemId()) {
                        case R.id.action_edit:
                            Toast.makeText(context, "Edit", Toast.LENGTH_SHORT).show();
                            Intent i=new Intent(context, EditActivity.class);
                            i.putExtra("id",data.id);
                            i.putExtra("title",data.title);
                            i.putExtra("desc",data.desc);
                            context.startActivity(i);
                            break;
                        case R.id.action_delete:
                            noteslist.remove(position);
                            notifyDataSetChanged();
                            Toast.makeText(context, "delete", Toast.LENGTH_SHORT).show();
                            break;
                        default:
                            break;
                    }

                    return false;
                }
            });
            popupMenu.show();
        }
    });

}

@Override
public int getItemCount() {
    return noteslist.size();
}

class  MyHolder extends RecyclerView.ViewHolder  {
    TextView title,desc;
    ImageView menuIcon;

    public MyHolder(@NonNull View itemView) {
        super(itemView);
        menuIcon = itemView.findViewById(R.id.menuIcon);
        title=itemView.findViewById(R.id.title);
        desc=itemView.findViewById(R.id.desc);
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Listdata listdata=noteslist.get(getAdapterPosition());
                Intent i=new Intent(context, StreamActivity.class);
                i.putExtra("id",listdata.id);
                i.putExtra("title",listdata.title);
                i.putExtra("desc",listdata.desc);
                context.startActivity(i);
            }
        });

    }

}

A: Hi i have seen in your code that you are just creating popup menu object but not showing
to show a popup menu follow below code.
private void showPopupMenu(View view) {
    // inflate menu
    PopupMenu popup = new PopupMenu(mContext, view);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.menu_album, popup.getMenu());
    popup.setOnMenuItemClickListener(new MyMenuItemClickListener());
    popup.show();
}


text:
Q: How to take a value and add it to an array once a checkbox is selected angular I am trying to create an Angular application that will simulate a pizza ordering website. I am specifically trying to work on a custom pizza page. I have several checkboxes that allow the user to add toppings to their pizza. How do I add the topping to an array when they click on the checkbox?
Here is the HTML page
<form>

            Crust:

                <input [(ngModel)]="customPizza.crust" type="radio" value="Hand Tossed" name="crust" > Hand Tossed
                <input [(ngModel)]="customPizza.crust" type="radio" value="Pan" name="crust"> Pan

            Cheese (Mozzarella):

                <input [(ngModel)]="customPizza.cheese" type="radio" value="Light" name="cheese"> Light
                <input [(ngModel)]="customPizza.cheese" type="radio" value="Regular" name="cheese"> Regular
                <input [(ngModel)]="customPizza.cheese" type="radio" value="Extra" name="cheese"> Extra

            Sauce:

                <input [(ngModel)]="customPizza.sauce" type="radio" value="None" name="sauce"> None
                <input [(ngModel)]="customPizza.sauce" type="radio" value="Light" name="sauce"> Light
                <input [(ngModel)]="customPizza.sauce" type="radio" value="Regular" name="sauce"> Regular
                <input [(ngModel)]="customPizza.sauce" type="radio" value="Extra" name="sauce"> Extra

            Toppings (Choose up to 5 Toppings)

            Meats:

            <input type="checkbox" value="Pepperoni" name="meats"> Pepperoni
            <input type="checkbox" value="Italian Sausage" name="meats"> Italian Sausage
            <input type="checkbox" value="Bacon" name="meats"> Bacon
            <input type="checkbox" value="Meatball" name="meats"> Meatball

            <input type="checkbox" value="Ham" name="meats"> Ham
            <input type="checkbox" value="Beef" name="meats"> Beef
            <input type="checkbox" value="Pork" name="meats"> Pork
            <input type="checkbox" value="Chicken" name="meats"> Chicken

            Veggies:

            <input type="checkbox" value="Black Olives" name="veggies"> Black Olives
            <input type="checkbox" value="GreenOlives" name="veggies"> Green Olives
            <input type="checkbox" value="Pineapple" name="veggies"> Pineapple
            <input type="checkbox" value="Onions" name="veggies"> Onions

            <input type="checkbox" value="Mushrooms" name="veggies"> Mushrooms
            <input type="checkbox" value="BananaPeppers" name="veggies"> Banana Peppers
            <input type="checkbox" value="GreenPeppers" name="veggies"> Green Peppers
            <input type="checkbox" value="Jalapenos" name="veggies"> Jalapenos

                <button type="submit" (click)="createAddPizza()">Add to Cart</button>

</form>

Here is the typescript page
import { Component, Input, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
import { Pizza } from 'src/app/pizza';
import { CustomPizza } from 'src/app/pizza';
import { FormsModule } from '@angular/forms';
import {ShoppingCartService} from '../../shopping-cart.service'

@Component({
  selector: 'app-pizza-builder',
  templateUrl: './pizza-builder.component.html',
  styleUrls: ['./pizza-builder.component.css'],

})
export class PizzaBuilderComponent implements OnInit {

  constructor(private serShopping: ShoppingCartService) {

  }
  @Input()
    toppings: string[] = [];
    topping: string = "";
    top1: string = "";
    sauce: string = "";
    cheese: string = "";
    crust: string = "";

    custPizza = new CustomPizza();
    customPizza: Pizza = {name: 'Custom Pizza',toppings: [''],sauce:'',
    cheese:'',crust:'',desciption:'',price: 14,img:''}

pushToArray(top: string)
{
  this.toppings.push(top);
}

  ngOnInit(): void {
  }
  createAddPizza(){

    this.serShopping.addPizza(this.customPizza);

  }
}

I have tried to use ngModel like with the radio button but it returns true false values. I want to add the selected toppings to the topping array but I am totally lost.

A: Template:
<input type="checkbox" value="Black Olives" name="veggies" (change)="addVeggies($event, 'Black Olives')">

TS component:
addVeggies(e, value) {
  e.srcElement.checked
    ? this.veggiesArray.push(value)
    : this.veggiesArray.splice(this.veggiesArray.indexOf(value), 1);
}

You can also get value from $event (e.srcElement.defaultValue) to have only one argument.


text:
Q: Write on the line that has been returned I can not solve a small problem, starting from this solution, I have done the table below but now I would like to write a word on each column with the type first and second in italics.
For example the word here for second of type 1. But I don't know how to do it for all columns.
I have done this:
\begin{table}[h]
    \centering
    \begin{tabular}{p{1.5cm}p{0.5cm}p{0.5cm}p{0.5cm}}
    type &  1 & 2 & 3 \\
    \hline
    \textbf{1}
    \newline \small{\textit{first}} & \\
    \newline \small{\textit{second}} &     here\\
    \textbf{2}
    \newline \small{first}} &  \\
    \textbf{3}
    \newline \small{\textit{first}} &  \\
    \end{tabular}
\end{table}

I would like this:

A: Welcome to TeX.SE!
If I understood you correctly, than you like to have the following table:

It can be simple set as follows:
\documentclass{article}
\usepackage{array}

\begin{document}
\begin{table}[h]
    \centering
    \begin{tabular}{>{\small}p{1.5cm} *{3}{>{\sffamily}p{0.5cm}} }
\normalsize{type}   & 1     & 2     & 3     \\
    \hline
\textbf{1}          &       &       &       \\
\emph{first}        & here  & here  & here  \\
\emph{second}       & here  & here  & here  \\
\textbf{2}          &       &       &       \\
first               & here  & here  & here  \\
\textbf{3}          &       &       &       \\
\emph{first}        & here  & here  & here  \\
    \end{tabular}
\end{table}
\end{document}


text:
Q: Apache POI generating corrupted excel xlsx file because of standalone or xmlns? I have a web application (tomcat 8.5.4, java 1.7.0_72) that was previously generating valid xlsx excel files using Apache POI.  I'm working on converting the application to manage the jar dependencies with maven and now the file being generated is considered corrupted (or otherwise invalid) by excel.  I haven't changed the code that generates the file at all and the jars included are mostly the same other than some version changes and removing some jars that were unused and not in the maven dependency tree (removed jars listed below).
Does anyone know what I could be doing to cause POI to generate the files differently or why excel thinks that these changes make it invalid?  I've searched a lot for errors with POI and corrupted excel files and it looked like there were several bugs in POI were it could corrupt existing files or break creating large files, but nothing that looked like it applied in this case.  I saw several questions here that looked like they could be similar but didn't end up applying.
Differences
When I change the xlsx files created before and after to zip files and extract them then compare the directories with windiff the differences are (working -> corrupted).
[content_types].xml
 <?xml version="1.0" encoding="UTF-8" standalone="no"?> -> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> -> <Types>

_rels.rels, _rels\workbook.xml.rels
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 -> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> -> <Relationships>

docprops\core.xml
The time created is different
<?xml version="1.0" encoding="UTF-8" standalone="no"?> -> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

xl\styles.xml
the numFmtId is 1 lower
xl\worksheets\sheet1.xml, docprops\app.xml, xl\sharedstrings.xml, xl\workbook.xml
Identical
Jars
My company is using a local artifactory repository instead of pointing at the official maven repository, so it's been lots of fun loading all the dependencies in.  My assumption is that this is caused by a jar I'm missing or using the wrong version, but I'm not actually generating any errors, just getting a bad file.
I'm including poi-3.1.11.jar, poi-ooxml-3.11.jar, and poi-ooxml-schemas-3.11.jar.  Previously we had commons-codec 1.9 in tomcat/lib and commons-codec 1.3 in WEB-INF/lib.  Under maven I've included 1.9, although I also tried going back to 1.3 and the file was still corrupted.
I tried upgrading to all of the poi versions to 3.1.14, but that didn't solve it.  I tried going back to the exact poi[-ooxml-schemas]-3.11-20141221 jars that were working before but that didn't solve it.  I tried switching the SXSSFWorkbook to a normal XSSFWorkbook but that didn't solve it.
Here is a list of jars that I removed when converting to maven, would any of these have any affect on apache poi?
ecj-4.5.1
el-impl-2.2
itext-2.0.8
jimi-1.0
js
opencsv-1.8
standard (1.1.2)

A: It turned out to be caused by a jar (xalan-2.4.1) that was pulled in as a dependency of fop-0.20.05 that hadn't been included before converting to maven.  Once I excluded that dependency it creates valid files again. I should have been suspicious of all of those really old jars from 2002 & 2003.
In case anyone has a similar problem in the future but not caused by the same jars here was my troubleshooting methods:
I turned on POI logging with
-Dorg.apache.poi.util.POILogger=org.apache.poi.util.SystemOutLogger
-Dpoi.log.level=1

I found a few errors complaining about an outdated XML parser and being unable to setup the SAX Security Manager.  Some internet searches led me to exclude xercesImpl (which our app had not previously included) from fop-0.20.5.  Excluding it fixed the errors in the logger but the file being generated was still considered corrupt by excel and still had the same differences.
Finally I broke down and just made a new simple maven java application that just created a very simple excel file with POI.  I initially tried it with just poi and poi-ooxml as the dependencies and it generated a valid file.  When I added all the dependencies from my full application it generated an invalid file.  Then I removed one dependency at a time until it worked.  The problem dependency was fop which I  still needed so then I tried excluding each of it's dependencies that our app had not previously included until the file worked and identified xalan as the problem.

A: I had exactly the same issue went through the same steps. For me removing xalan dependency which was inherited into my project by another dependency by excluding it,  didn't help. I added the latest version of xalan (xalan 2.7.1) and it saved my day.


text:
Q: CPU Scheduling incredibly slow with large difference between total execution time and actual CPU time - Ubuntu Full-Disk Encryption enabled Admittedly, I am running on a build that is no younger than five years old at this point and the system is not going to be incredibly fast. However, at the same time, the run-times I am observing are so painfully slow it's urged me to create this question to see if there was something I could do to fix this problem.
For example, I was simply unpacking a tarball, albeit quite a large one (~15GB), and the entire process took about 2.5 hours with about 9 minutes of actual CPU time. In contrast, the creation of this tarball took about just a few minutes. Again, the creation was on a fairly adept machine, but 2.5 hours seems far too slow.
As a second example, building a particular project (on the adept machine) took only 19 seconds, with 17 of those seconds being actual CPU time. In contrast, the same process took nearly 9 minutes (on this slower machine) with only about 14 seconds being actual CPU time. As you can see below, the actual CPU time is fairly similar, it's just the total execution time that is the problem.
Adept Machine
real    0m19.245s
user    0m15.809s
sys     0m0.908s

Current Machine
real    8m37.500s
user    0m11.175s
sys     0m3.969s

I include the unfair comparison between the two machines only as a reference point. There is nothing particularly amazing about the adept machine, it's just quite a bit newer. The current machine has 4 GB of RAM; the adept machine has quite a bit more as it is a server, but only 2 GB of RAM is actually being used. There's no disk I/O, the above performance happens when the machine is otherwise idle.
Ubuntu in general tends to be quite a bit more sluggish than it should be, often times freezing for a few moments before resuming. Opening tasks tends to take a lot of time as well - as much as 20-30 seconds for something as simple as Eclipse; browsers can take 5-10 seconds as well.

*

*Ubuntu 14.04 -- Full-disk encryption enabled

*Core i-7 860 @ 2.8Ghz

*WD2500JS 7200RPM SATA 3Gbps 8MB Cache

tldr; Why is there such a huge gap between total execution time and actual CPU time? The disk I am using is not that slow. It's hard to believe the disk being the source of such a huge discrepancy. Perhaps it's the first-gen i7?

Updates based on feedback in comments:

*

*Tried tar -t, but after 6 minutes of waiting I killed it. Total CPU time: 3 seconds in user space.

*taf -tf actually delivers output to the terminal and changes the output of iostat, but only 20-30 Kb/s.

*No error messages in the system log about filesystem corruption or disk timeouts

*Unlike iostat, iotop actually gives results and shows 80-90% IO and 30-40 MB/s when listing contents with tar and redirecting it to /dev/null.


text:
Q: Update retention on existing partitioned table in BigQuery I have a DAY partitioned table on BigQuery which did not have any retention set.
I updated the retention now to 48 hours:
bq update --time_partitioning_expiration=172800 maw.rt_content_secondly_0

And now
bq show --format=prettyjson maw.rt_content_secondly_0

shows:
"timePartitioning": {
"expirationMs": "172800000",
"type": "DAY"
}

But it has been about and hour since I updated and it is still not deleting older data. The count(*) is still the same.
Also, how do you remove the retention later if I want to?

A: Please see the answer here: https://stackoverflow.com/a/38753305/7376017
You can verify the partitions time by looking at:
SELECT MSEC_TO_TIMESTAMP(creation_time) from [project:dataset.table$__PARTITIONS_SUMMARY__]


text:
Q: Advanced Search Java Library I am adding functionality of advanced search to JSF Based CMS product
Search criteria :

If User Searches with keyword Assets then he should be able to get records containing Asset As well as Assets

I found that Lucene and Solr are the best way to do full text search out of which I had implemented Apache Lucene Search which does work fast than normal Query result but does not solve my Search criteria.
Is there any other Java Library which will help me in this criteria ?

A: PorterStemmer is a good choice for supporting this sort of stemming in Lucene.  Particularly, incorporating a PorterStemFilter into your Analyzer would be the typical approach.  There is a simple example of that listed on the PorterStemFilter documentation linked, but may look something like (based on the StandardAnalyzer, in this case):
class MyStemmerAnalyzer extends Analyzer {
    @override
    public TokenStream tokenStream(String fieldName, Reader reader) {
        TokenStream stream = new StandardTokenizer(reader);
        stream = new StandardFilter(stream);
        stream = new LowerCaseFilter(stream);
        stream = new PorterStemFilter(stream);
        stream = new StopFilter(stream, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
        return stream;
    }
}


text:
Q: Building an App that works in Group & Professional Edition? What are the considerations when trying to build an AppExchange Application that works for Group or Professional Edition? I understand that there are a lot of Professional edition org and it would be great to be able to have them as customers too.

A: It is very important to note that when a feature is listed as "Not Supported" in GE/PE, this means there can be NO API references to the feature throughout your Code. For instance, here are some gotchas related to non-supported features in GE/PE:

*

*Record Types: just because your package does not include any Record Types on Standard or Custom Objects does not mean that your package can go in GE/PE. If your Package ever even refers to the RecordType API object, such as in a Utility method that you might use for your EE/UE customers for getting all active/available record types by name/id, your package will be excluded from GE/PE orgs. However, use of the DescribeSObjectResult getRecordTypeInfos() family of methods does not exclude your package from GE/PE. So in summary:

*

*use of Schema.RecordTypeInfo IS allowed

*use of RecordType object is NOT allowed.

*Force.com Sites: again, any hard-coded reference to the Site or SiteDomain objects in Apex will exclude your package from GE/PE orgs. However, Dynamic SOQL, i.e. Database.query('select Id from Site limit 1') is a good way to get around this, as it moves the feature detection from compile-time to run-time. I would assume that, as with RecordTypeInfo, use of the System.Site Apex class methods would not exclude you from GE/PE.
Furthermore, you might think that deprecating a method or part of your code that uses a not-allowed API object would allow successive versions to be allowed in GE/PE. Nope!
Also, a couple of features not supported in either GE or PE orgs not mentioned in Jordan's answer:

*

*Record Types

*Custom Report Types

A: Building for 'Group Edition' and 'Professional Edition' there are some things to keep in mind:

*

*Professional Edition doesn't support web service calls unless the org
is API enabled (although this is possible it's not well documented)

*Permission sets are not available in in PE, and including them in a package can cause issues uninstalling a package from a PE org.

*Use of @RemoteAction calls aren't limited in the same way, so they're advisable for supporting PE.

*Some types of Dashboards aren't supported in GE and can limit the user from installing into their org.

*Sharing rules and Profiles are not supported in the same way in PE

*Some objects such as Campaigns are not included in these editions by default.
You should always attempt to install your app into a PE and GE edition org before releasing it to the AppExchange in order to confirm it's interoperability so that users coming in from the AppExchange don't encounter issues.
I'm giving a presentation at Dreamforce '12 that Includes notes on supporting and testing multiple editions. It's called Team Development on the Force.com Platform for ISVs


text:
Q: OAuth 2.0 authentication error when retrieving Google userinfo in GWT I am not very familiar with programming with requests so I'm going to try to be as concise and I possibly can in describing my problem.
I am trying to get an authentication token which I can use to get a Google account's userinfo.
I succeeded in getting the token in this form: https://oauth2-login-demo.appspot.com/oauthcallback#access_token={accesstoken}&token_type=Bearer&expires_in=3600
Then I followed this tutorial's TODO#11: http://www.sw-engineering-candies.com/blog-1/howtogetuserinformationwithoauth2inagwtandgoogleappenginejavaapplication
@Override
public LoginInfo loginDetails(final String token) {
    String url = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token="
        + token;

    final StringBuffer r = new StringBuffer();
    try {
        final URL u = new URL(url);
        final URLConnection uc = u.openConnection();
        final int end = 1000;
        InputStreamReader isr = null;
        BufferedReader br = null;
        try {
            isr = new InputStreamReader(uc.getInputStream());
            br = new BufferedReader(isr);
            final int chk = 0;
            while ((url = br.readLine()) != null) {
                if ((chk >= 0) && ((chk < end))) {
                    r.append(url).append('\n');
                }
            }
        } catch (final java.net.ConnectException cex) {
            r.append(cex.getMessage());
        } catch (final Exception ex) {
            log.log(Level.SEVERE, ex.getMessage());
        } finally {
            try {
                br.close();
            } catch (final Exception ex) {
                log.log(Level.SEVERE, ex.getMessage());
            }
        }
    } catch (final Exception e) {
        log.log(Level.SEVERE, e.getMessage());
    }

    final LoginInfo loginInfo = new LoginInfo();
    try {
        final JsonFactory f = new JsonFactory();
        JsonParser jp;
        jp = f.createJsonParser(r.toString());
        jp.nextToken();
        while (jp.nextToken() != JsonToken.END_OBJECT) {
            final String fieldname = jp.getCurrentName();
            jp.nextToken();
            if ("picture".equals(fieldname)) {
                loginInfo.setPictureUrl(jp.getText());
            } else if ("name".equals(fieldname)) {
                loginInfo.setName(jp.getText());
            } else if ("email".equals(fieldname)) {
                loginInfo.setEmailAddress(jp.getText());
            }
        }
    } catch (final JsonParseException e) {
        log.log(Level.SEVERE, e.getMessage());
    } catch (final IOException e) {
        log.log(Level.SEVERE, e.getMessage());
    }
    return loginInfo;
}

When that code is run, I am catching an error:
WARNING: Authentication error: Unable to respond to any of these challenges: {googlelogin=WWW-Authenticate: GoogleLogin realm="https://www.google.com/accounts/ClientLogin", service="lso"}
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Login Required",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Login Required"
 }
}

I am running in development mode in GWT. I also tried deploying and running, but it also caught some error.
Some possible causes could be:
1) my token timed out (but I Just got it)
2) I must deploy first?
3) I'm not doing the steps properly? (after i get the token, I have to validate it first? how do i do that?)
I am not quite sure how to proceed from here. Hoping to get some help from the community.

A: It was a string concatenation error. The variable wasn't holding a valid token.


text:
Q: Issue with checking new integer against previous one Im attempting to make something similar to the high low game. So far i can get a new integer between 1-25 to be generated.
Ive tried to write a function that when you press the 'lower' button it checks the new integer against the previous one, and if it is less then text is displayed below saying 'You Were Correct' and updates the users score +1.. and if wrong 'You Were Wrong' displays instead and score is reset to 0.
Whenever i press the lower button it gives me a new int but score is not updated and the message doesn't display. This is my first real attempt at making this so bear with me :)
Lower Button
    @IBAction func lower(sender: AnyObject) {
    var newNumber = randomIntBetween(2, high: 26)
    var oldNumber: Int?

    func lowerNumber() -> Int {
        if newNumber <= oldNumber {
            correctWrong.text = "You Were Correct!"
            score.text = "Score: \(countWin++)"
        } else {
            correctWrong.text = "You Were Wrong!"
            score.text = "Score: \(countLose)"
        }
        return newNumber
    }
     randomNumbers.text = "\(newNumber)"
}

Random Number Function
    func randomIntBetween(low:Int, high:Int) -> Int {
    let range = high - (low - 1)
    return (Int(arc4random()) % range) + (low - 1)
}

Variables/Constants Used
var countWin = 0
let countLose = 0

Thanks

A: As far I can see if your code it's formatted correctly you have a nested function but you aren't calling it inside your function so it's impossible that the function lowerNumber() will be called. You need to call the function like the following code:
@IBAction func lower(sender: AnyObject) {
  var newNumber = randomIntBetween(2, high: 26)
  var oldNumber: Int?

  func lowerNumber() -> Int {
    if newNumber <= oldNumber {
        correctWrong.text = "You Were Correct!"
        score.text = "Score: \(countWin++)"
    } else {
        correctWrong.text = "You Were Wrong!"
        score.text = "Score: \(countLose)"
    }
    return newNumber
  }

  let newValue = lowerNumber()
  randomNumbers.text = "\(newValue)"
}

Nevertheless, nested functions are closures that have a name and can capture values from their enclosing function so you need to be carefully with its use. I recommend this article of @AirSpeedVelocity to learn more about the closures and its capture values A Basic Tutorial on Functions and Closures in Swift
I hope this help you.


text:
Q: Can't connect via RDP to Windows 2008 R2 Server I just installed a Windows 2008 Standard R2 server with RDS.  Whenever I attempt to connect to the server via RDP from a Windows 2003 server, I get the following error.

I am however able to connect from a Windows 7 desktop and using a Linux RDP client.
Anyone know why I'm getting this error and how to resolve the problem?
Thank you in advance.

A: This is probably a Server Fault question, but none the less my guess is the server has the following setting:

Maybe your Linux RDP client doesn't support this functionality?
If not, check your Firewall, it needs to look like this:


text:
Q: perl cgi - change location for temporary uploaded files Having moved an existing script to a new server, a function is not working anymore :
$CGITempFile::TMPDIRECTORY = $TempFile::TMPDIRECTORY = $temp_dir;

I discovered that : "Changes in temporary file handling (v4.05+) : CGI.pm had its temporary file handling significantly refactored, this logic is now all deferred to File::Temp [...]" that you can fully read here : Link to CGI doc
Consequently I search in the documentation of File::Temp (and many forums) but found nothing on how to change the path for temporary files.
Any help would be highly appreciated !
P. S. For the context it looks like this
use CGI::Carp qw(fatalsToBrowser);
use CGI;
[...]
$CGITempFile::TMPDIRECTORY = $TempFile::TMPDIRECTORY = $temp_dir;
[...]
my $cg = new CGI;

A: Thanks a lot, Сухой27, for your comment, the solution is very simple (once you know it) I just replaced the code above with :
$ENV{TMPDIR}=$temp_dir;


text:
Q: Abandoned notions in mathematics? I'm looking for examples of abandoned or demised notions/concepts in mathematics, preferably (but not necessarily) after the age of foundations. To be clear: I'm not looking for abandoned ideas or theories (as opposed to notions or concepts); neither am I looking for revised (as opposed to abandoned) notions -- I'm aware that there is plenty of both kinds. To illustrate what I'm looking for, consider the notion of phlogiston in natural sciences. Do we have anything like that in math?
Thank you very much!

A: How about consulting Euclid's Elements?

The three main classes of irrational magnitudes are the medial, binomial, and apotome. ... It was Euclid who generalized the idea of commensurable and incommensurable to squares, and also ordered the binomial and apotome irrational lines into six distinct classes each (Knorr, 1983).


text:
Q: android with cell size in android gridview Hi first sorry for what my English.
I have an activity that contains a gridview (anything more). Want the same size as on all devices, but that's where I have a problem.
In a galaxy s3 looks like I want, but testing it on a s2 are created rows.Mis spaces between rows contain images and text within the image.
s3 image
https://drive.google.com/file/d/0BwFa2jI8Xt2qcGNqajdsMVVSd2c/edit?usp=sharing
s2 image
https://drive.google.com/file/d/0BwFa2jI8Xt2qbmtmUERCRUVQNWs/edit?usp=sharing
CustomGridViewAdapter-
package com.proonet.camareroporfavor;

import java.util.ArrayList;

import com.proonet.camareroporfavor.R;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CustomGridViewAdapter extends ArrayAdapter<ItemGridView> {
Context context;
int layoutResourceId;
ArrayList<ItemGridView> data = new ArrayList<ItemGridView>();

public CustomGridViewAdapter(Context context, int layoutResourceId,
        ArrayList<ItemGridView> data) {
    super(context, layoutResourceId, data);
    this.layoutResourceId = layoutResourceId;
    this.context = context;
    this.data = data;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    RecordHolder holder = null;

    if (row == null) {
        LayoutInflater inflater = ((Activity) context).getLayoutInflater();
        row = inflater.inflate(layoutResourceId, parent, false);

        holder = new RecordHolder();
        holder.txtTitle = (TextView) row.findViewById(R.id.item_text);
        holder.imageItem = (ImageView) row.findViewById(R.id.item_image);
        row.setTag(holder);
    } else {
        holder = (RecordHolder) row.getTag();
    }

    ItemGridView item = data.get(position);
    holder.txtTitle.setText(item.getTitle());
    holder.imageItem.setImageBitmap(item.getImage());
    return row;

}

static class RecordHolder {
    TextView txtTitle;
    ImageView imageItem;

}
}

ItemGridview
import android.graphics.Bitmap;

public class ItemGridView {
Bitmap image;
String title;

public ItemGridView(Bitmap image, String title) {
    super();
    this.image = image;
    this.title = title;
}
public Bitmap getImage() {
    return image;
}
public void setImage(Bitmap image) {
    this.image = image;
}
public String getTitle() {
    return title;
}
public void setTitle(String title) {
    this.title = title;
}

}

My activity where I show the gridview
public class InicioActivity extends ActionBarActivity {

private String[] opcionesMenu;
private DrawerLayout drawerLayout;
private ListView drawerList;
private ActionBarDrawerToggle drawerToggle;
GridView gv;
ArrayList<ItemGridView> gridArray = new ArrayList<ItemGridView>();
CustomGridViewAdapter customGridAdapter;
private CharSequence tituloSeccion;
private CharSequence tituloApp;

TextView tVciudadDondeEstoy;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_inicio);

    tVciudadDondeEstoy = (TextView)  findViewById(R.id.ImageTextViewCiudadDondeEstoy);
    cambioEnTextViewSegunCiudad ();
    //Gridview
    //set grid view item
            Bitmap imagenVacia = BitmapFactory.decodeResource(this.getResources(), R.drawable.cuadro_vacio);
            gridArray.add(new ItemGridView(imagenVacia,"Ofertas hoy"));

            gridArray.add(new ItemGridView(imagenVacia,"Locales adheridos"));

            gridArray.add(new ItemGridView(imagenVacia,"Mis Locales"));

            gridArray.add(new ItemGridView(imagenVacia,"Locales cercanos"));

            gridArray.add(new ItemGridView(imagenVacia,"Mis ofertas"));

            gridArray.add(new ItemGridView(imagenVacia,"Locales cercanos"));
            gridArray.add(new ItemGridView(imagenVacia,"algo"));
            gridArray.add(new ItemGridView(imagenVacia,"algo2"));
            gv = (GridView) findViewById(R.id.gridview);
            customGridAdapter = new CustomGridViewAdapter(this, R.layout.row_grid, gridArray);
            gv.setAdapter(customGridAdapter);

    gv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            Toast.makeText(InicioActivity.this, "" + position, Toast.LENGTH_SHORT).show() ;
            switch (position) {
            case 0:
                break;
            case 1://boton ultimas ofertas,debe abrir la actividad ultimasOfertas de cada ciudad
                if (CrearPerfil.ciudadSeleccionada.equals( "Alicante" )){
                Intent intent = new Intent(InicioActivity.this, TipoDeLocalesActivity.class);
                startActivity(intent);
                }else{
            Toast.makeText(InicioActivity.this, "No hay   ofertas para  tu localidad" , Toast.LENGTH_SHORT).show() ;}
                break;
            case 2:

                break;
            default:

            }
        }
    });

xml:Where I have the textview and imageview
row_grid

<ImageView
    android:id="@+id/item_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:src="@drawable/cuadro_vacio" >
</ImageView>

<TextView
    android:id="@+id/item_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/item_image"
    android:layout_alignTop="@+id/item_image"
    android:layout_alignRight="@+id/item_image"
    android:layout_alignBottom="@+id/item_image"
    android:layout_marginTop="7dp"
    android:layout_marginLeft="7dp"
    android:gravity="left"
    android:text="¿Donde estoy?"
    android:textSize="20sp"
    android:textStyle="bold"
    android:textColor="#ffffff"
    android:shadowColor="#c7c7c7"
    android:shadowDx="3"
    android:shadowDy="2"
    android:shadowRadius="1.8">
</TextView>

</RelativeLayout>

My activity xml: activity_inicio.xml
<?xml version="1.0" encoding="utf-8"?>

<!-- Contenido Principal -->

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

  <RelativeLayout
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#e3e3e3">

<ImageButton
    android:id="@+id/ibtnCiudad"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:layout_marginLeft="3dp"
    android:layout_marginRight="3dp"
    android:layout_marginTop="3dp"
    android:background="@null"
    android:scaleType="fitXY"
    android:src="@drawable/cuadro_vacio525x450" />

   <!-- Texto que va dentro del imagebutton -->

    <TextView
        android:id="@+id/ImageTextViewCiudadDondeEstoy"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/ibtnCiudad"
        android:layout_alignRight="@+id/ibtnCiudad"
        android:layout_alignTop="@+id/ibtnCiudad"
        android:gravity="center"
        android:shadowColor="#c7c7c7"
        android:shadowDx="3"
        android:shadowDy="2"
        android:shadowRadius="1.8"
        android:text=""
        android:textColor="#ffffff"
        android:textSize="25sp"
        android:textStyle="bold" />

 <GridView
    android:id="@+id/gridview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/ibtnCiudad"
    android:layout_marginLeft="3dp"
    android:layout_marginRight="3dp"
    android:layout_marginTop="3dp"
    android:columnWidth="90dp"
    android:gravity="center"
    android:horizontalSpacing="3dp"
    android:listSelector="#00000000"
    android:numColumns="2"
    android:stretchMode="columnWidth"
    android:verticalSpacing="3dp" />

If anyone has the solution for the rows look at all dispositipos you tell me please.
My intention is that it looks like the flippboard application. Row and text inside
Thank you.


text:
Q: What's the best way to manage reusable classes/libraries separately? When coding, I naturally often come up with classes or a set of classes with a high reusability. I'm looking for an easy, straight-forward way to work on them separately.
I'd like to be able to easily integrate them into any project; it also should be possible to switch to a different version with as few commands as possible.
Am I right with the assumption that git (or another VCS) is best suited for this? I thought of setting up local repositories for each class/project/library/plugin and then just cloning/pulling them. It would be great if I could reference those projects by name, not by the full path. Like git clone someproject.
edit: To clarify, I know what VCS are about and I do use them. I'm just looking for a comfortable way to store and edit some reusable pieces of code (including unit tests) separately and to be able to include them (without the unit tests) in other projects, without having to manually copy files. Apache Maven is a good example, but I'm looking for a language-independent solution, optimally command-line-based.

A: As @jgauffin points out package management really is the way to fly here. But not everything has a package manager. Or other times you just need the sources riding with things.
Specifics are really a function of what platform, thing you want to look at here would be the sorts of features exposed by git submodules or hg subrepos. Both are designed to pull some part of your source repository from an external source. In the case of hg subrepos they don't even need to be HG -- git or svn can be accessed as well.
The real challenge comes in when you want a subrepository but you need to edit some certain files within it.

A: I would keep them in a repos somewhere and then use a package tool to include them in my projects.

*

*.NET has nuget.

*Javascript has npm

*Ruby uses gem
etc.

A: A VCS is the way to go. What you need here is to decide how you are going to store you code/configuration items in your VCS repository. The first question that I would ask is how stable are these reusable components?
If they are not going to change very much, then put then into a repository/database/project/folder/(what ever terminology your VCS uses) of their own and label them according to the product they correspond to. Then when it is time to do some coding, the developer gets the system they are working on from its repository and then the shared stuff, using the appropriate label to get the appropriate versions.
If the shared libraries will only change a little bit over time, then add some branching for the development lines that need it and use labels. Now you can get the required files/versions as per the above using the appropriate labels. You then need a management process to periodically update the trunk with these branches and test it with all the affected applications.
If there is going to be a lot of customization, then you probably need to maintain separate repositories per project as that will be easier/cheaper to manage that over a bunch of repositories with lots of branches/labels/promotion groups and the integration testing that that entails.
To extract them, use some tool if you can be bothered to work out how to configure it. Or, write a quick script to get the files needed per project and create the file structure for the project when you need to start off some development, Something like this psudo code:

required_label = "version 1.1.1"
project        = "funStuff"
destination    = "server/share/folder/"

get from vcs project $project $required_label into $destination
get from vcs "library project" $required_label into $destination/lib/
echo "get to work"

This may not work if you used a IDE inbuilt version management integration. The developers may need to use the VCS's interface to check in/out configuration items that are going to be changed.
The key to making this work is to make sure that the appropriate labeling system is enforced by the VCS - the ones I have used allow you to set up a rule forcing the adding or a label on check-in or have the facility for floating labels. Use as appropriate.


text:
Q: Why is the mouse cursor drawn faster than applications? One of the things that I've noticed (at least on Windows anyway), is that the mouse cursor is drawn with much less latency than even standard Windows elements.
A good example of this would be to start dragging on the desktop. You can easily notice that the drag rectangle is lagging significantly behind the cursor.
My first question is: why is this the case?
I can't imagine drawing a rectangle being so much more expensive than drawing the cursor. Certainly not by a frame or two.
And my second question is, would it ever be possible to match one's application rendering 1:1 with cursor input?
A good use case for this would be either this selection rectangle, or drag previews for draggable items. Both of which lag behind quite significantly from the OS mouse pointer (independent of any framework or library used).

A: Selecting icons on the desktop with the selection rectangle is not that slow on my system (DWM on), it is lagging a little bit but not enough for me to really care.
The "Show Window Contents while Dragging" option has always been rather slow which is why it was not on by default in older Windows versions.
The mouse cursor on the other hand can be rendered directly by your hardware. That is, Windows sends the cursor image to your graphics card and after that Windows only has to tell the graphics card the cursor position and this is much faster than all the messages and user/kernel context switches involved when you resize and paint a window. The mouse driver probably uses hardware interrupts/timers with a higher priority than your normal software as well.
You can try to disable hardware cursors with a registry hack but the HID/mouse driver and the raw input thread in win32k will still have a higher priority than your application.


text:
Q: jQuery SVG Plugin and dynamic added fontawesome not working I'm using jQuery SVG Plugin to work with SVG on client (web browser) side.
At an specific situation, I have to add an FontAwesome icon to the SVG.
FontAwesome icons on SVG works well, normally, if they are part of the origin SVG, which is loaded by the jQuery SVG plugin.
The problem appears by adding icons dynamic with the following line, where mainSVG is the global SVG object.
mainSVG.text(null, x, y, '&#'+iconCode);

Where iconCode is something like "xf007"
...followed by adding some position and style attributes.
Adding the text element to the svg works fine.
The result is a string '&#xf007', which is added insight an text-object which is now part of to the svg.
<text x="49" y="139" style="font-family: FontAwesome;
      font-weight: normal; font-size: 6px;" class="dot">

      &#xf007

</text>

But: it's shown as an string and not as an icon. By the way: the css style definition for the FontAwesome is loaded and known insight the SVG.
The thing is: if I modify the SVG using firebug for an very tiny change (like adding an blank between to SVG elements), the icon become visibly.
For me this is a very strange behaviour an it looks like, the browser simply doesn't notice new added icon. Or: the browser notice the new added icon only after making some tiny change on the svg object using firebug.
So my question is: how can I add dynamic FontAwesome icons to an svg using jQuery or how can I trigger the browser / svg "viewer" plugin to notice the icon in order to display the icon by using the existing css definition?


text:
Q: if possible lazy-draw in canvas renderer in lottie-web I have multi lottie data draw in the same canvas through the context config, when each lottie data loaded, it will draw in the canvas, which cause a flash.
If possible that canvas renderer doesn't draw the first frame when data is ready, the renderer only draw when I call play


text:
Q: Circular dependencies in foreign keys: use it or avoid it? My application loads lots of data from a database into a complex data structure.  The in-memory data structure ressembles the structure of the database, which means that if the database contains the following tables:

*

*table A, key is A1

*table B, key is B1, one of the columns is a foreign key to [the key of] table A

*table C, key is C1, one of the columns is a foreign key to [the key of] table B

Then I have classes A, B and C, and:

*

*a data member of B (B::m_a) is a pointer to A

*a data member of C (C::m_b) is a pointer to B

This implies that if I load the database, that I have to load it in the correct order.  If I first load C, then it will complain that it cannot set the value C::m_b because the instance where it should point to was not loaded.
Problem is when there is also a column in A that is a foreign key to one of the other tables, let's say C.
I could solve the problem by loading all foreign keys as strings, and then perform a lookup after all the data has been loaded, but since I sometimes have to load millions of records, I can't afford to spend memory on these (albeit temporary) strings.
Having read about good design (e.g. the book "Large Scale C++ Software Design") it seems to me that it's a bad idea to have circular references at all.
E.g. if file X.H includes Y.H, but Y.H also includes X.H you probably have a bad design; if class X depends on class Y and vice versa you probably have a bad design, which should be solved by extracting this dependency and introducing a third class Z, which depends on X and Y (X and Y won't depend on eachother anymore).
Is it a good idea to also extend this design-rule to database design?  In other words: preventing circular references in foreign keys.

A: From a data modelling perspective there is nothing fundamentally "wrong" with a circualr dependency. It doesn't mean the model is wrong.
Unfortunately most SQL DBMSs cannot effectively implement such constraints because they don't support multiple table updates. Usually the only way around this is to suspend one or more constraints temporarily (for instance using a "deferrable" foreign key or similar features) or by altering the model to make some part of the constraint optional (putting one of the referencing columns into a new table). This is just a workaround for a nasty limitation of SQL however, it doesn't mean you did anything wrong to start with.

A: You have to model the data you have. If there's a circular relationship in the data (e.g. each photo belongs to a folder; but each folder has one cover photo) then it's correct to model that as a circular relationship in the database.
I only had this situation once when using Oracle, so I didn't get a chance to check out how to implement such a relationship on other databases. But for Oracle you can read my article here:
http://www.databasesandlife.com/circular-dependencies-on-foreign-key-constraints-oracle/

A: Yes, cyclical dependencies in databases are a good excuse to rethink the design.

A: The only time you should need a circular reference is when you are creating a hierarchical structure, such as an organizational tree.
Table Employees
   EmployeeID   <----------|
   SupervisorEmployeeID ---|


text:
Q: User acts as Student and Teacher in my model associations I have a Student, Teacher, and University model. A Teacher has_many Universities and a Student has_one University.
Currently there is no Teacher or Student model but a single model User. In this way what would be relation between User and University? And what would be the correct schema?

A: Firstly,you are lot confused with the associations.It is university has_many teachers not
Teacher has_many Universities and also it is not Student has_one University,it is student belongs_to university.
And your point of giving only one model as User instead of having two models(teacher and Student) should be given like this
class University < ActiveRecord::Base

has_many :teachers, :class_name => "User"
has_many :students, :class_name => "User"

end

class User < ActiveRecord::Base

belongs_to :university

end

And I would recommend to read these Guides before going any further with associations.
Hope it helps!
Update
Well,in that point,you can do like this
class University < ActiveRecord::Base

    belongs_to :teacher, :class_name => "User",:foreign_key => 'user_id'
    has_many :students, :class_name => "User"

end

class User < ActiveRecord::Base

   has_many :universities

 end

A: I believe you are looking for something called single table inheritance. Check out this article:
http://www.alexreisner.com/code/single-table-inheritance-in-rails


text:
Q: SpringBoot - Junit test not Rollingback using JdbcTemplate for H2 I've generated a Spring Boot web application using Spring Initializer, embedded Tomcat, Thymeleaf template engine, and package as an executable JAR file.
Technologies used:
Spring Boot 1.4.2.RELEASE, Spring 4.3.4.RELEASE, Thymeleaf 2.1.5.RELEASE, Tomcat Embed 8.5.6, Maven 3, Java 8
I have this test, that is failing, because Junit test is not rolling back the insert java.lang.AssertionError: expected:<1> but was:<2>
@ContextConfiguration(classes={PersistenceConfig.class})
@RunWith(SpringRunner.class)
public class JdbcGuardianRepositoryTests {

    @Autowired
    private JdbcGuardianRepository repository;

    @Test
    public void testGetAllGuardians() throws DataAccessException, SQLException {
        assertEquals(1, repository.getAllGuardians(null).size());
    }

    @Test
    @Rollback
    public void testInsetGuardian() throws DataAccessException, SQLException {

        Guardian newGuardian = new Guardian();

        newGuardian.setDescription("bob desc");
        newGuardian.setEmail("bob@gmail.com");
        newGuardian.setId(Sequencer.getNextVal());
        newGuardian.setMobile("123456789");
        newGuardian.setName("bob");
        newGuardian.setSurName("bob surname");

        assertNotEquals(-1, repository.insert(newGuardian));
    }
}

A: @Rollback annotation works only if transaction management happens through Jpa/Hibernate/JdbcTemplate (the annotation influence on transaction only if the transaction is managed by some PlatformTransactionManager).
It looks like JdbcGuardianRepository uses plain jdbc access (or something like that) and spring cannot know anything about your transactions.
Consider using JPA to manage transactions and you'll solve the problem.
Alternatively you can annotate your test class with @Sql("/clean-db.sql") and provide some cleanup sql code inside clean-db.sql. Spring will run this script before every test run.
Consider adding more information about JdbcGuardianRepository if this does not solve your problem.