text:
Q: Any program or trick to find the definition of a variable? Many times when I am watching others code I just want to find where and how a variable is defined. Normally what I do now is look for the type of the variable until I find the definition, that is very time consuming. And I guess that there are some tools that can help me in this rutinary situation. Any suggestion in some tools or commands to help me in this task?.
I know that using a GUI and creating a project this is done automatically I am talking of a way to do this without a GUI. I am working with only text mode. I am running under Linux and I am using C/C++, but suggestions for other languages are welcome.
Thanks a lot.
A possible solution
Michel in one of his comments propose a simple an effective solution define again the variable, in that case in compilation time, the compiler will inform where is the previous definiton. Of course to apply this solution we need to think previously in the locality of the variable.

A: Edit: OK, you say you're using C++. I'm editing my response. I would use the C preprocessor and then grep for the variable. It will appear in the first place.
cpp -I...(preprocessor options here) file.cpp | grep variable

The C preprocessor will join all the includes that the program uses, and the definition has to be before any usage of that variable in the file. Not a perfect thing, but without an IDE or a complete language description/managing tool, you only have the text.
Another option would be using ctags. It understands the C and C++ syntaxes (among others), and can be searched for variables and functions using command line tools, emacs and vi, among others.

A: I use cscope and ctags-exuberant religiously. Run it once on my code base and then in Vim, I can use various commands like ^] or [D or [I or similar to find any definitions or declarations for a given word.
This is similar to facilities provided by mega-IDEs like Visual Studio and Eclipse.
Cscope also functions as a stand-alone tool that performs these searches.

A: I use one of three methods:

*

*I will use CTags to process my source tree (nightly) and then can easily use commands in Vim (or other editors) to jump right to the definition.

*I will just use grep (linux) or findstr (windows) to look for all occurrences of the variable name or type.  The definition is usually quite obvious.

*In Vim, you can just search backward in the scope and often find what you are looking for.

A: You've already given the most appropriate tool: an IDE. This is exactly the kind of thing which an IDE excels at. Why would you not want to use an IDE if you're finding development painful without one?
Note that Emacs, Vim etc can work as IDEs - I'm not talking about forcing you the world of GUIs if you want to stay in a text-only situation, e.g. because you're SSHing in.
(I'm really not trying to be rude here. I just think you've discounted the obvious solution without explaining why.)

A: Grep for common patterns for variable declarations. Example: *, &, > or an alphanumeric followed by one or more whitespace characters then the name of the variable. Or variable name followed by zero or more whitespace characters, then a left parenthesis or a semicolon.  Unless it was defined under really weird circumstances (like with some kind of macro), it works every time.

A: In VIM you can use gd to see local variable declarations or gD to see global variable declarations, if they're defined in the current file. Reference Go_to_definition_using_g
You can also use [i to see the definition without jumping to it, or [I to see all occurrences of the variable in all the included files as well, which will naturally show the definition as well.

A: If you work in Microsoft Visual Studio (which I think you could use for C++ as well, but would require working on a Windows workstation) there's an easily accessible right-click menu option for "Go to Definition...", which will take you to the definition of any currently marked variable, type or method.

A: if you insist on staying text mode, you can do this with either emacs or vi with the appropriate plug-ins.
But really, move into the 21st century.
EDIT: You commented that you are doing this over SSH because you need the build speed of the remote server cluster.
In that case, mount the drive on your local machine and use an IDE, and just SSH in to kick off a build.


text:
Q: How to group array items by multiple properties and sum groups? with underscore, I have successfully implemented the logic to group objects by multiple properties and sum the groups, but I haven't found the way to do it with lodash.
Here is the code:
let test = _.chain(response.counterValues)
  .flatten()
  .groupBy(response.counterValues, (item) => {
      return item.duration + '#' + item.timeFrom + '#' + item.timeTo + '#' + item.objectClass;
  })
  .mapValues((value, key) => {
    let sum = _.reduce(value, (memo, val) => {return memo + val.count}, 0);
    let keyItems = key.split('#');
    let duration = keyItems[0];
    let timeFrom = keyItems[1];
    let timeTo = keyItems[2];
    let objectClass = keyItems[3];
    return {duration: duration, timeFrom: timeFrom, timeTo: timeTo, objectClass: objectClass, count: sum};
  }).value();
console.log(test);

and these are example values:
0: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 1}
1: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 3}
2: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 1}
3: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 1}
4: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 3}
5: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 2}
6: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 1}
7: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 2}
8: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 4}
9: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 1}
10: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 2}
11: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 2}
12: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 2}
13: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 3}
14: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 2}
15: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 1}
16: {duration: "h", timeFrom: "1547323200000", timeTo: "1547326800000", objectClass: "car", count: 1}

For these objects, I would like to get the following result:
{duration: "h", timeFrom: 1547323200000, timeTo: 1547326800000, objectClass: "car", count: 32}

Does anyone know how to modify the code above in order to get the desired result?

A: .groupBy(response.counterValues, (item) => { ...

should be
.groupBy((item) => { ...

because you're using _.chain()

redpajama_set_name: RedPajamaStackExchange


text:
Q: How exactly Eclipse Code-Completion works?? What Algorithm they are using? Can Anyone tell me how the code completion(or code assist whatever is preferable) in Eclipse works?? I mean the tricks/algorithms/Data-Structures it is using.. Somewhere I found that "maybe" it uses Trie, but i want a definite answer, Can anyone please answer it??

A: There are different Token-Scanners who search for known tokens like { and ; to colorize the current viewport-scopes and fill a history. If you press Ctrl+Spc it looks backward and search for occourences in the history.


text:
Q: max upload size from iPhone to server Does any one know what is the max file size we can upload to a server from an iPhone app?
I could easily upload a file with size upto 10 MB but app start giving unpredictable results in uploading a video beyond this size.
Any help is much appreciated.

A: In general there would not be any limits on the file size from the iPhones side of view. However you might have limitations imposed on you from the server side, e.g max disk quota, etc.
You will have to implement the upload in chunks or streamed as the iPhone is limited in memory.

A: If you upload end read the file from disk in chucks, the limiting factor will be the server and you internet connection.
I don't think that there is a hard limit to the upload.

A: AFAIK, there's no limit. Just make sure that the server that you're sending the data to is configured to accept it.


text:
Q: URLs not matching when admin page set to root url in django app I building a Django app with DRF, but the API URLs do not match correctly when I set the admin site at the root URL
root URL pattern:
urlpatterns = [
path('', admin.site.urls),
path('api/auth/', include("account.urls")),
path('api/main/', include("main.urls")),

]
main URL pattern:
router = routers.DefaultRouter()

router.register('language', LanguageView)

urlpatterns = [
    path('', include(router.urls)),

]

when I hit the main API URLs it returns the admin login page, can't fix this yet
please help me out.

A: Include the admin as the last entry in your urls, otherwise your api urls will never match because they are "valid" admin paths and will always be handled by the admin
urlpatterns = [
    path('api/auth/', include("account.urls")),
    path('api/main/', include("main.urls")),
    path('', admin.site.urls),
]


text:
Q: Norm Completion of Local Field In J.S. Milne's Class Field Theory notes, the following is claimed:
For finite abelian extension of local fields $L/K$,
\begin{align*}
\widehat {K^\times} :=& \lim_\longleftarrow \frac{K^\times}{\text{Nm}_{L/K}L^\times } \cong \lim_\longleftarrow \frac{K^\times}{(1+ \mathfrak m^n)\langle \pi^m \rangle}\\
\cong &\lim_\longleftarrow \frac{U_K \times \pi^{\mathbb Z}}{(1+ \mathfrak m^n)\langle \pi^m \rangle} \cong \lim_\longleftarrow \frac{U_K}{1+ \mathfrak m^n}
\times \lim_{\longleftarrow} \frac{\pi^{\mathbb Z}}{\langle \pi^{m} \rangle} \cong U_K \times \hat {\mathbb Z}
\end{align*}
($U_K$, $\pi$, $\mathfrak m$ are respectively unit group, uniformizer, and the prime ideal of $K$)
But I don't understand how the first isomorphism arises, because I don't know if every norm group is of the form $(1+\mathfrak m^n) \langle \pi^m \rangle$.
Could anyone explain this to me, or the larger question of isomorphism $\lim_\leftarrow \frac{K^\times}{\text{Nm}_{L/K} L^\times} \cong U_K \times \hat{\mathbb Z}$?

A: Theorem 1.4 of Chapter I of the notes says that the norm groups in $K^{\times}$ are exactly the subgroups of finite index. The two inverse limits are equal because the subgroups $(1+\mathfrak{m}^n)\times \langle\pi^n\rangle$ are cofinal in the set of subgroups of finite index. This is explained in I, 1.10, of the notes.


text:
Q: Entity framework 6, ToListAsync is returned randomized data I'm working with EF6 (using MySQL provider)  and I've found the strange behavior.
I use TakeWhereAsync method from my generic repository.
public async Task<IReadOnlyCollection<T>> TakeWhereAsync(Expression<Func<T, string>> sortExpression,
                                                       Expression<Func<T, bool>> whereExpression,
                                                       bool desc, int pageSize, int pageIndex)
    {
        var skipRows = (pageIndex - 1) * pageSize;

        var query = GetAllQuery().Where(whereExpression);
        query = desc
            ? query.OrderByDescending(sortExpression)
            : query.OrderBy(sortExpression);

        return await query.Skip(skipRows).Take(pageSize).ToListAsync();
    }

It returns absolutely unordered data.

I've tried to get SQL-request from IQueryable

and it's returned ordered data.

Can you please provide options to fix it?

A: From the discussion in comments, we have:
var testData = await _repository.TakeWhereAsync(_ => sortField, ...)

I'm presuming that sortField is a string here - perhaps "Id" - which means that you're sorting all the rows based on a constant: the string literal "Id", which doesn't change per row. What you actually wanted was to sort on the column found by resolving that field. You can do this either by hard-coding a number of expected scenarios, or by building an expression tree based on reflection. A full example of how to do that can be found here. Using the code in this answer, you would have:
string orderByField = "Id";
IQueryable<T> query = ... // from somewhere, your db context etc
query = query.OrderBy(orderByField); // using the code from the linked question


text:
Q: Gson deserializing with changing field types i have an API-Call that returns:
{
  "id": 550,
  "favorite": false,
  "rated": {
    "value": 7.5
  },
  "watchlist": false
}

or
{
  "id": 550,
  "favorite": false,
  "rated": false,
  "watchlist": false
}

so the "rated"-Field is sometimes an object or an boolean.
How do i deserialize something like that with Gson?
my Object so far looks like:
public class Status{
    @Expose public boolean favorite;
    @Expose public Number id;
    @Expose public Rated rated;
    @Expose public boolean watchlist;
}
public class Rated{
    @Expose public Number value;
}

A: In order for this to work, one way is to implement TypeAdapter<Rated> - something like this:
public class RatedAdapter extends TypeAdapter<Rated> {

    public Rated read(JsonReader reader) throws IOException {
        reader.beginObject();
        reader.nextName();

        Rated rated;
        try {
            rated = new Rated(reader.nextDouble());
        } catch (IllegalStateException jse) {
            // We have to consume JSON document fully.
            reader.nextBoolean();
            rated = null;
        }

        reader.endObject();

        return rated;
    }

    public void write(JsonWriter writer, Rated rated) throws IOException {
        if (rated == null) {
            writer.value("false");
        } else {
            writer.value(rated.value);
        }
    }
}

When you have TypeAdapter in place, all you have to do is to register it with GsonBuilder and create new Gson like this:
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Rated.class, new RatedAdapter());
    Gson gson = builder.create();

    //Let's try it
    Status status = gson.fromJson(json, Status.class);

With this type adapter installed, Gson will try to convert all properties named rated to appropriate Rated Java object.


text:
Q: Android SQLite get specific rows using LIKE clause I have a database with 2 tables. In raw_data table I have some columns (latitude, longitude, time, ...) and in results table I want to store results from calculations of raw_data, but I want to calculate them base on time. (= for example I want to get only rows from today at 12:00 to 12:59, calculate them and save in results table).
I wanted to use LIKE clause. So I wrote this code at Locations.java (class, where I'm working with database):
public Cursor getLocationsByHour(String specificHour)
    {
        SQLiteDatabase db = openHelper.getReadableDatabase();
        return db.query(TABLE1_NAME, columns_T1, COLUMN_T1_TIMECEST_RAW + " LIKE '" + specificHour + "%'", null, null, null, null, null);}

Where:
TABLE1_NAME is a protected static final String TABLE1_NAME = "raw_data";
columns_T1 is a public static final String[] columns_T1 = {some columns names};
COLUMN_T1_TIMECEST_RAW is a public static final String COLUMN_T1_TIME_RAW = "time";
specificHour is a i.e. 01. 06. 2013 12

I'm calling getLocationsByHour() from method fillResultsTable() at Locations.java:
    public String fillResultsTable()
        {
            String specificHour = "01. 06. 2013 12";  //hard coded for test purposes
            String message;

            try {

                Cursor dbLocation = getLocationsByHour(specificHour);

                //HERE IS CODE WITH CALLING CALCULATIONS METHODS

                message = "OK";

            } catch (Exception e) {
                message = e.toString();
            }
            return message;
        }

And at ToolsActivity.java I'm calling fillResultsTable() at button1Click() method.
But this code returns ALL rows from raw_data, not specific rows.
What I did wrong?
PS: Sorry about my English.

A: from what you have written, I assume that COLUMN_T1_TIMECEST_RAW is a string. have you checked the data to ensure that it contains what you expected ?

If (as I suspect) the data is actually a long value (time in milliseconds, represented as an integer in sqlite), you need to use ">" and "<" or "between" (and Calendar.getTimeInMillis()) to limit the query to the selected range (LIKE is only for string comparison)
eg:
private static final long DAY= 1000*60*60*24; // milliseconds in a day
Calendar mycal = new GregorianCalendar();
mycal.set(Calendar.HOUR, hour);
/* do day, month, minute, etc*/
 ....
long time = mycal.getTimeInMillis();
SQLiteDatabase db = openHelper.getReadableDatabase();
String[] args = {Long.toString(time), Long.toString(time+DAY-1)}; // 24 hr - 1ms timespan
return db.query(TABLE1_NAME, columns_T1, COLUMN_T1_TIMECEST_RAW + " BETWEEN ? AND ?", args, null, null, null, null);}

OR
return db.query(TABLE1_NAME, columns_T1, COLUMN_T1_TIMECEST_RAW + ">? AND "+COLUMN_T1_TIMECEST_RAW +"<?", args, null, null, null, null);}

if COLUMN_T1_TIMECEST_RAW is actually stored as a string in sqlite and you wish to progress this further, it would be useful if you posted :
a) the actual table definition code
b) some of the data (a few lines)
also, I would recommend :
1) if you want to keep COLUMN_T1_TIMECEST_RAW as a string; convert your tables to FTS3 (documentation) and use MATCH
2) if your timerange >1970 and <2036 store the time as "milliseconds since epoch" and adjust code accordingly
3) store the time as an INTEGER YYYYMMDDHHmm  eg 201306011259 and compare 201306010000 <= time < 201306012359    (m + h*100 + d*10000 + mon*1000000 + year*10000000). use MODULO and integer division to separate out the parts
4) store the time as a REAL   ( YYYYMMDD.frac ) more or less the same as #3 but a bit less efficient IMHO


text:
Q: mongodb: how to search integer in a text index? I am trying to create a text index for a mongo collection to be able to do text search.
While the text search works perfectly for searching through the index using text, I am not able to search integer fields I have added in the index.
I am using mongo v3.0.7
Following are the steps to replicate the problem:
> <!-- added two dummy fields -->;
> db.test.insert({a: 1, b: "apple"});
WriteResult({ "nInserted" : 1 })
>
> db.test.insert({a: 2});
WriteResult({ "nInserted" : 1 })
>
>
> <!-- initially only default index exists -->;
> db.test.getIndexes();
[
    {
        "v" : 1,
        "key" : {
            "_id" : 1
        },
        "name" : "_id_",
        "ns" : "3dphy_dev.test"
    }
]
>
>
> <!-- created new text index -->;
> db.test.createIndex({"a": "text", "b": "text"});
{
    "createdCollectionAutomatically" : false,
    "numIndexesBefore" : 1,
    "numIndexesAfter" : 2,
    "ok" : 1
}
>
>
> db.test.getIndexes();
[
    {
        "v" : 1,
        "key" : {
            "_id" : 1
        },
        "name" : "_id_",
        "ns" : "3dphy_dev.test"
    },
    {
        "v" : 1,
        "key" : {
            "_fts" : "text",
            "_ftsx" : 1
        },
        "name" : "a_text_b_text",
        "ns" : "3dphy_dev.test",
        "weights" : {
            "a" : 1,
            "b" : 1
        },
        "default_language" : "english",
        "language_override" : "language",
        "textIndexVersion" : 2
    }
]
>
>
> <!-- searching for text yields result -->;
> db.test.find({$text: {$search: "apple"}});
{ "_id" : ObjectId("56497f6f96621a852197891b"), "a" : 1, "b" : "apple"}
>
>
> <!-- integer search doesn't works -->;
> db.test.find({$text: {$search: "1"}});
> db.test.find({$text: {$search: "2"}});

The last two search commands yield no results.
I am trying to build a single api endpoint for my search where I can search both text and integer data in a collection.
Plz advice!

A: The second search doesn't work because the type of the $search is not String ( "1" or "2" in this case ). Have you try this:
    db.test.find({a:1});


text:
Q: Making calculations without pressing a button I'm making a program that calculates rules of three, but I don't want the calculations to be started when I press button but when the 3 needed values are added. Here's the image of my program and my code:

private void calculateActionPerformed(java.awt.event.ActionEvent evt) {
    if (field4.getText().isEmpty()) {
        field4.setText(null);
        field1c = Float.parseFloat(field1.getText());
        field2c = Float.parseFloat(field2.getText());
        field3c = Float.parseFloat(field3.getText());
        float result = (field3c * field2c) / field1c;
        String resultfinal = Float.toString(result);
        field4.setText(resultfinal);
        option = 1;
    } else if (field3.getText().isEmpty()) {
        field1c = Float.parseFloat(field1.getText());
        field2c = Float.parseFloat(field2.getText());
        field4c = Float.parseFloat(field4.getText());
        float result = (field4c * field1c) / field2c;
        String resultfinal = Float.toString(result);
        field3.setText(resultfinal);
        option = 2;
    } else if (field1.getText().isEmpty()) {
        field2c = Float.parseFloat(field2.getText());
        field3c = Float.parseFloat(field3.getText());
        field4c = Float.parseFloat(field4.getText());
        float result = (field3c * field2c) / field4c;
        String resultfinal = Float.toString(result);
        field1.setText(resultfinal);
        option = 3;
    } else if (field2.getText().isEmpty()) {
        field1c = Float.parseFloat(field1.getText());
        field3c = Float.parseFloat(field3.getText());
        field4c = Float.parseFloat(field4.getText());
        float result = (field4c * field1c) / field3c;
        String resultfinal = Float.toString(result);
        field2.setText(resultfinal);
        option = 4;
    }

I'm sure that I have to use threads somewhere but I'm not sure how to implement them to my program.

A: First asign to every input a KeyListener so they'll know when you've typed, pressed or released a key on them. Everytime you press or type a key on any input, loop through each one and .getValue(), if more than one has something different than "", then don't calculate.
First create a class that implements KeyListener so your inputs can use it.
class LoopWhenTyped implements KeyListener{

        public void keyTyped(KeyEvent e) {
            for(Component actualComponent : e.getSource().getParent().getComponents){
                 //here's where you're looping
            }
        }

        public void keyPressed(KeyEvent e) {}

        public void keyReleased(KeyEvent e) {}

}

In the class that holds your GUI, create an instance of the class we just created.
private myKeyListener = new LoopWhenTyped();

You must add this listener to every input:
field1.addKeyListener(myKeyListener);
field2.addKeyListener(myKeyListener);
field3.addKeyListener(myKeyListener);
field4.addKeyListener(myKeyListener);

The e variable references a KeyEvent, when you, so e.getSource() returns whatever triggered that event, getParent() will return the component that holds it, and getComponents() returns all the components it holds.
Of course, you must adapt this general solution to your code structure and research a little bit about this classes if you get lost. I hope it helped.


text:
Q: Security concern for LDAP Query Server OS = Windows Server 2008 R2 Std ( Domain Controller )
Client OS = windows XP & 7
Whenever we add Laptop / Desktop in to Domain.
After that if User want to have information of Certain Object / other Department Users information such as Email address, Department, mobile number, Job title etc.. He can easily get by running LDAP query right?
Is there any way to protect such information?
Please correct me if i am wrong?

A: That is correct. That information is available as part of LDAP. You could lock down AD using delegation and modifying security rights, however I wouldn't recommend it.

A: Yes, the default security permissions in Active Directory give all users read access to the majority of attributes on objects in the directory including other users.
If removing that ability is necessary to satisfy your business's security requirements, unfortunately it's not as easy as modifying the permissions on the OU/container where your sensitive users are located.  The permissions that grant read access to those attributes are aren't actually inherited from their container.  They're set directly on the object at creation time.
In order to change that, you need to edit the AD schema and modify the default security ACL on the user class to whatever your security requirements demand.  It's a sensitive operation to be sure. But unlike other schema changes, it's entirely reversible (just change the permissions back).
It also won't retroactively affect users that already exist.  You'll need to go back after the fact and use a tool like dsacls to reset the users to their default security permissions from the schema.
Keep in mind that a lot of applications that access Active Directory will assume the default security permissions exist and may fail in odd ways if they can't read those user attributes.  So make sure any applications that need access are running with credentials that have been given explicit access to read the attributes they care about.


text:
Q: Passing MySQL client config to "rails db" I'm wondering how to pass MySQL client config to the "rails db" command, ie config options that would normally be specified on the "mysql" command line as flags or in my.cnf.
Specifically:

*

*I want to set a flag, sigint-ignore (because accidental ctrl-c exits are all too easy)

*I want to set the DB password from an env variable ("rails db" doesn't seem to look at database.yml)

A: rails db - alias to rails dbconsole - uses the config in config/database.yml and opens the appropriate command line interface.
For connecting to mysql databases, mysql2 is specified as the adapter in config/database.yml with adapter: mysql2.
mysql2 adapter provides for reading from a custom mysql configuration file with the :default_file and :default_group parameters; see https://github.com/brianmario/mysql2#reading-a-mysql-config-file
sigint-ignore can be specified as follows:
In config/database.yml:
development:
  adapter: mysql2
  database: example_dev
  pool: 5
  username: root
  password:
  default_file: /Users/mahemoff/.my.cnf
  default_group: client

In /Users/mahemoff/.my.cnf:
[client]
sigint-ignore

Setting DB password

"rails db" doesn't seem to look at database.yml)

rails db does use the password set in database.yml.


text:
Q: Unable to establish two way SSL connection (Can not find public key for alias) I am trying to establish connection between client and server in my local machine in Jdeveloper 11.1.1.7 and weblogic 10.3
I follow the steps in the following blogs:
One size doesn't fit all: One-Way SSL with JAX-WS using JDeveloper 11gR1 and WLS 10.3.1
Gerard Davison's Blog: Security Policy Worked Example
All steps works fine for me. But the connection is not establish.
I have key store and self-signed certificate for both client and server. I exchange the certificates between the client and server. So, each one of them have the certificate of the other in his keystore file as trusted certificate.
From the client side I am trying to call the server from the auto generated port class by Jdeveloper where every thing is setup, all what I need is to fill the values for username, password, keyStore,...... etc.
But I am getting the following exception in the client side.
java.lang.SecurityException: Can not find public key for alias: "serversidecert"
  at weblogic.wsee.security.util.CertUtils.getCertificate(CertUtils.java:106)
  at testClient.TestWSPortClient.getBSTCredentialProvider(TestWSPortClient.java:97)
  at testClient.TestWSPortClient.setPortCredentialProviderList(TestWSPortClient.java:71)
  at testClient.TestWSPortClient.main(TestWSPortClient.java:41)

Note 1: I am not able to reach the server yet, this exception is happening at the client side.
Note 2: The error indicate that system could not find the public key of the specified alias. What I know that the public key is included in the certificate. So when the certificate is added to the trusted keystore everything should go smoothly(Correct me if I am wrong).
------------------------------- EDIT-------------------------------------
I figure out that I am doing something wrong in the code because the application worked from Http Analyzer in Jdeveloper. But I am not seeing what is wrong in the code.
The following is the auto generated port class from Jdeveloper and the values a fill it in:
Note 3: ClientSideKeyStore.jks is the keystore for the client and it contains the self-signed certificates for the client and the server certificate as trusted certificated
public class TestWSPortClient
{
  @WebServiceRef
  private static TestWSService testWSService;

    public static void main(String[] args) {
        try {
            testWSService = new TestWSService();
            TestWS testWS = testWSService.getTestWSPort();

            Map<String, Object> requestContext = ((BindingProvider) testWS).getRequestContext();
            setPortCredentialProviderList(requestContext);

             Add your code to call the desired methods.
            System.out.println("Client Side: "+testWS.sayhi("Testing Message"));

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    @Generated("Oracle JDeveloper")
    public static void setPortCredentialProviderList(Map<String, Object> requestContext) throws Exception {
        // TODO - Provide the required values
        String username = "weblogic";
        String password = "welcome1";
        String clientKeyStore = "C:\\Client_Server\\ClietSide\\ClientSideKeyStore.jks";
        String clientKeyStorePassword = "changeit";
        String clientKeyAlias = "clientsidecert";
        String clientKeyPassword = "changeit";
        String serverKeyStore = "C:\\Client_Server\\ClietSide\\ClientSideKeyStore.jks";
        String serverKeyStorePassword = "changeit";
        String serverKeyAlias ="serversidecert";
        List<CredentialProvider> credList = new ArrayList<CredentialProvider>();

        // Add the necessary credential providers to the list

        credList.add(getUNTCredentialProvider(username, password));

        credList.add(getBSTCredentialProvider(clientKeyStore, clientKeyStorePassword, clientKeyAlias, clientKeyPassword, serverKeyStore, serverKeyStorePassword, serverKeyAlias, requestContext));

        credList.add(getSAMLTrustCredentialProvider());

        requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credList);
    }

    @Generated("Oracle JDeveloper")
    public static CredentialProvider getSAMLTrustCredentialProvider() {
        return new SAMLTrustCredentialProvider();
    }

    @Generated("Oracle JDeveloper")
    public static CredentialProvider getUNTCredentialProvider(String username,
                                                              String password) {
        return new ClientUNTCredentialProvider(username.getBytes(), password.getBytes());
    }

    @Generated("Oracle JDeveloper")
    public static CredentialProvider getBSTCredentialProvider(String clientKeyStore,
                                                              String clientKeyStorePwd,
                                                              String clientKeyAlias,
                                                              String clientKeyPwd,
                                                              String serverKeyStore,
                                                              String serverKeyStorePwd,
                                                              String serverKeyAlias, Map<String, Object> requestContext) throws Exception {
        List serverCertList =
            CertUtils.getCertificate(serverKeyStore, serverKeyStorePwd, serverKeyAlias, "JKS");

        List clientCertList =
            CertUtils.getCertificate(clientKeyStore, clientKeyStorePwd, clientKeyAlias, "JKS");

        final X509Certificate serverCert =
            (serverCertList != null && serverCertList.size() > 0) ? (X509Certificate) serverCertList.get(0) : null;
        final X509Certificate clientCert =
            (clientCertList != null && clientCertList.size() > 0) ? (X509Certificate) clientCertList.get(0) : null;

        requestContext.put(WSSecurityContext.TRUST_MANAGER, new TrustManager()
       {
          public boolean certificateCallback(X509Certificate[] chain,
                                             int validateErr)
          {
             boolean result = (chain != null && chain.length > 0)
                              && (chain[0].equals(serverCert) || chain[0].equals(clientCert));
             return result;
          }
       });

        return new ClientBSTCredentialProvider(clientKeyStore, clientKeyStorePwd, clientKeyAlias, clientKeyPwd, "JKS", serverCert);
    }
}

A: Verify if the file C:\\Client_Server\\ClietSide\\ClientSideKeyStore.jks is readable by the client and if it really contains the certificate with the alias serversidecert:
keytool -list -v -keystore C:\\Client_Server\\ClietSide\\ClientSideKeyStore.jks -alias serversidecert

That said, are you sure that the client certificate ClientSideKeyStore is the server certificate that's needed here?
On the Weblogic doc, the server side certificates are (usually) initialized differently without the alias parameter. Perhaps you could try this as well:
X509Certificate serverCertInit = (X509Certificate) CertUtils.getCertificate(serverKeyStore);


text:
Q: Cruisecontrol.Net git not seeing modifications I've just set up a Cruisecontrol.Net server under Apache+Mono and pointed the sourcecontrol to my GitHub project. I made a commit and pushed it but CC is not detecting the changes even though it reports them in the output:
[MyProject:INFO] [Git] Calling git log origin/test --date-order --name-status -c "--after=Fri, 29 Jun 2012 12:19:25 GMT" "--before=Fri, 29 Jun 2012 13:12:24 GMT" --pretty=format:"Commit:%H%nTime:%ci%nAuthor:%an%nE-Mail:%ae%nMessage:%s%n%n%b%nChanges:"
[MyProject:DEBUG] Starting process [git] in working directory [/home/ccnet/MyProject/build] with arguments [log origin/test --date-order --name-status -c "--after=Fri, 29 Jun 2012 12:19:25 GMT" "--before=Fri, 29 Jun 2012 13:12:24 GMT" --pretty=format:"Commit:%H%nTime:%ci%nAuthor:%an%nE-Mail:%ae%nMessage:%s%n%n%b%nChanges:"]
[MyProject:DEBUG] Not setting PriorityClass on [/home/ccnet/MyProject/build/git] to default Normal
[511:DEBUG] [MyProject git] process exited event received
[509:DEBUG] [MyProject git] Commit:3d386b1277003c83c63e7e13bde2803bfe952d40
[509:DEBUG] [MyProject git] Time:2012-06-29 14:00:34 +0100
[510:DEBUG] [MyProject git] standard-error stream closed -- null received in event
[509:DEBUG] [MyProject git] Author:Robin Elvin
[509:DEBUG] [MyProject git] E-Mail:rob@-------.com
[509:DEBUG] [MyProject git] Message:Merge branch 'master' into test
[509:DEBUG] [MyProject git]
[509:DEBUG] [MyProject git]
[509:DEBUG] [MyProject git] Changes:
[509:DEBUG] [MyProject git]
[509:DEBUG] [MyProject git] Commit:fc134027f059a1dada0295bbd2d04cbea6eeb57b
[509:DEBUG] [MyProject git] Time:2012-06-29 14:00:24 +0100
[509:DEBUG] [MyProject git] Author:Robin Elvin
[509:DEBUG] [MyProject git] E-Mail:rob@-------.com
[509:DEBUG] [MyProject git] Message:Set complete status on sync and fix tests (issue #2 #3)
[509:DEBUG] [MyProject git]
[509:DEBUG] [MyProject git]
[509:DEBUG] [MyProject git] Changes:
[509:DEBUG] [MyProject git] M       File1
[509:DEBUG] [MyProject git] M       File2
[509:DEBUG] [MyProject git] M       File3
[507:DEBUG] [MyProject git] standard-output stream closed -- null received in event
[MyProject:INFO] No modifications detected.

Here is the relevant block from my config:
<sourcecontrol type="git">
<repository>git@github.com:xxxx/MyProject.git</repository>
<branch>test</branch>
<workingDirectory>/home/ccnet/MyProject/build</workingDirectory>
<autoGetSource>true</autoGetSource>
</sourcecontrol>
<triggers>
<intervalTrigger name="continuous" seconds="30" buildCondition="IfModificationExists"/>
</triggers>

What could be causing this?

A: there was a bug in the git source control provider that prevented ccnet from detecting git merge commits.
Just upgrade to the latest ccnet version (1.8.x) should fix your problem.

A: Well, I made another commit and pushed and this triggered a build.
No idea why it wasn't before. Will keep checking in case it's a bug.


text:
Q: Displaying very large data sets more efficently I have a logic analyser project that records several hundred million 16bit values (~100-500 million) and I need to display anything from a few hundred samples to the entire capture as the user zooms.
When you zoom out the whole system gets a huge performance hit as it's loading a massive chunk from the file.
I just though this morning that it would be more efficient to "stride" through the file at the users screen resolution. You can't physically display anything between pixels anyways. This doesn't solve the massive file size hit in memory though.
Is there away I can take a huge data set and stream chunk it down efficiently?
I was thinking streaming from start to start + view size by horiz resolution. This makes a very choppy zoom though.
Program uses python but I am open to calling something in c if it already exists.

A: Well, I don't know if this is actually question on programming or design overall.
For "zooming" problem with vizualizations I suggest:

*

*Have pre-computed/cached version for some zoom levels. Ideally, gradation should be calculated based on user behaviour.

*When user zooms-in, you simultaneously

*

*calculate "proper" data or load pre-computed aggregated data of deeper zoom layer and crop it by your view frame

*cheat by rendering low-res data from previous layer or smooth it by some approximation (but make sure to somehow tell user that data is not finalized)

Aside of it, think if you can optimize the way you store data. Trees may make your life way easier, both for partial disk read/search and for storing aggregated data.

A: In my opinion, there is no point to display even a few hundred samples unless they form some kind of image/shape. I guess one can look at hundred numbers if they are properly structured (colored). Several hundred - doubt it - here you replace actual data with some visualization (plots, charts, maps, ...).
To approach the problem you may define some rule to stop displaying actual data at all. For instance, if digit height becomes less than, say, 10 pixels you display some kind of message selected numbers are from rows 200...300, columns 400..500 or some graphical alterantive with corner coordinates and amount of numbers.


text:
Q: Getting ostream template to print instance attributes in list of pointers I'm trying to use a template function to print the attributes of the objects that are pointed to in my list.
class SomeClass {
  public:
   double myVal;
   int myID;
}

std::list< boost::shared_ptr< SomeClass > > myListOfPtrs;
for ( int i = 0; i < 10; i++ ) {
  boost::shared_ptr< SomeClass > classPtr( new SomeClass );
  myListOfPtrs.push_back( classPtr );
}

template < typename T > void printList ( const std::list< T > &listRef ) {
  if ( listRef.empty() ) {
    cout << "List empty.";
  } else {
    std::ostream_iterator< T > output( cout, " " ); // How to reference myVal near here?
    std::copy( listRef.begin(), listRef.end(), output );
  }
}

printList( myListOfPtrs );

What's printing instead are the pointer addresses. I know what I'd normally do is something like (*itr)->myVal, but I'm not clear how to adapt the template function.

A: Firstly, don't use shared_ptr here. Your code doesn't give us any reason to use memory management:
std::list<SomeClass> myListofPtrs;

Then you need to provide your own implementation of the stream insertion operator for your class:
std::ostream& operator <<(std::ostream& os, SomeClass const& obj)
{
    return os << obj.myVal;
}

If you must use pointers then you can create your own loop:
for (auto a : myListOfPtrs)
{
    std::cout << (*a).myVal << " ";
}


text:
Q: Chrome browser set interval alert statement I have this below piece of code to check the session. The checksession is called every 15 seconds.
This code works fine in IE browser but in Chrome, the alert statements never pop-ups and it redirects directly to the given url...
setInterval(checksession, 15000)

function checksession() {
    alert('check session')
    $.ajax({
        aynsc: false,
        type: 'POST',
        url: 'CheckSession',
        success: validateresult,
        data: {
            antiCSRF: '{{acsrf}}',
            session_id: '{{session_id}}'
        },
        error: function () {
            alert('Session check failed')
        }
    })
    return false;
}

function validateresult(result) {
    if (result == "N") {
        valid_flag = "N"
        alert("Your session has been timed-out based upon Security Policy. Please click OK to be redirected to the login page to start a new session.");
        window.location.assign('./')
    } else {
        valid_flag = "Y";
        return valid_flag
    }
}


text:
Q: how to delay loading the page in route AngularJS? I would like to before the advent of the home page if the user is not logged in is to move it to the login page.
At this moment Main page appears (half a second) and then loads the login page.
var app = angular.module("app", ["ngRoute", "ngAnimate"])

.constant('ACCESS_LEVELS', {
    guest: 1,
    user: 2,
    admin: 3
});

app.config(["$routeProvider", "$locationProvider", "ACCESS_LEVELS", function($routeProvider, $locationProvider, ACCESS_LEVELS) {

    $routeProvider
        .when("/", {
            template: "",
            access_level: ACCESS_LEVELS.user
        });
}]);

app.run(["$rootScope", "$window", "LoginService", function($rootScope, $window, LoginService) {

    $rootScope.$on('$routeChangeStart', function(evt, next, curr) {

        if(next.access_level !== undefined) {
            LoginService.checkSession().then(function(response) {
                $rootScope.isLoggedIn = response;
                if(!response)  {
                    $window.location.href = '/login.html';
                }
            }, function(error) {
                $rootScope.isLoggedIn = error;
            });
        }
 })
}]);

Is there a way to angular done without flash home page?
regards

A: You can use the 'resolve' property of the routeProvider.
From the docs:

resolve - An optional map of dependencies which should be >injected into the controller. If any of these dependencies are promises, the router will wait >for them all to be resolved or one to be rejected before the controller is instantiated.

https://docs.angularjs.org/api/ngRoute/provider/$routeProvider
So your routeProvider could look as follows, with the session promise specified as a dependency of your home route. You would then need to inject the session into the home controller.
 $routeProvider
   .when("/", {
     template: "",
     access_level: ACCESS_LEVELS.user,
     controller: 'homeCtrl',
     resolve: {
       session: function(LoginService) {
         return LoginService.checkSession();
       }
     }
   });

A good blog post: http://blog.brunoscopelliti.com/show-route-only-after-all-promises-are-resolved

A: My current code:
in main app.js:
var app = angular.module("app", ["ngRoute", "ngAnimate", "ngResource"])

.constant('ACCESS_LEVELS', {
    guest: 1,
    user: 2,
    admin: 3
});

besecure.config(["$routeProvider", "$locationProvider", "ACCESS_LEVELS", function($routeProvider, $locationProvider, ACCESS_LEVELS) {

    $routeProvider
        .when("/", {
            template: "",
            label: "Home",
            access_level: ACCESS_LEVELS.user,
            resolve: {
                session: function(LoginService) {
                    return LoginService.checkSession();
                }
            }

        });
}]);

app.run(["$rootScope", "$window", "$location", "LoginService", function($rootScope, $window, $location, LoginService) {

    $rootScope.loadingView = false;

    $rootScope.$on('$routeChangeStart', function(evt, curr, prev) {
        if(curr.access_level !== undefined) {
            if(curr.$$route && curr.$$route.resolve) {
                $rootScope.loadingView = true;
            } else {
                $window.location.href = '/login.html';
            }
        }
    })
}]);

Service:
app.factory("LoginService", function($resource, $q) {
    var LoginService,
        Login = $resource("/auth/login");
LoginService = {
        checkSession: function() {
            var deferred = $q.defer();

            Login.get().$promise.then(function(response) {
                deferred.resolve(response.result);
            }, function(error) {
                deferred.reject(false);
            });

            return deferred.promise;
        }
};

    return LoginService;
});

Service is OK.
and not work redirecting


text:
Q: lxc Container does not start I am trying to run an lxc container on Ubuntu 16.10 with the following configurations:
lxc.utsname = cont
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = bridge
lxc.network.ipv4 = 10.0.0.10/24

The bridge is already up and running. I create the container using xenial template as following:
lxc-create -f lxc-veth.conf -t download -n cont -- --dist ubuntu --release xenial --arch amd64 --no-validate

Then I start the container:
lxc-start -n cont /bin/bash --logfile log.txt

I get the following errors:
  lxc-start 20161114114122.026 ERROR    lxc_start - start.c:start:1439 - No such file or directory - failed to exec /lib/lxc cont
  lxc-start 20161114124122.026 ERROR    lxc_sync - sync.c:__sync_wait:57 - An error occurred in another process (expected sequence number 5)
  lxc-start 20161114124122.026 ERROR    lxc_start - start.c:__lxc_start:1354 - failed to spawn 'cont'
  lxc-start 20161114124127.568 ERROR    lxc_start_ui - tools/lxc_start.c:main:344 - The container failed to start.
  lxc-start 20161114124127.568 ERROR    lxc_start_ui - tools/lxc_start.c:main:346 - To get more details, run the container in foreground mode.
  lxc-start 20161114124127.568 ERROR    lxc_start_ui - tools/lxc_start.c:main:348 - Additional information can be obtained by setting the --logfile and --logpriority options.

I am not able to find out which file is missing. So what is the source of the problem?

A: The problem exists in the last command lxc-start, the command should be:
lxc-start -n cont --logfile bla.txt -- /bin/bash

Basically there is not need to run /bin/bash since when I attach the container I will have shell access


text:
Q: Counting the number of sets Given two positive integers $n$ and $k$ with the same parity, count the number
of sets $$S = \{0 < s_1 < s_2 < \dots < s_k = n\},$$ such that $s_1, s_3, \dots$ are odd numbers, and $s_2, s_4,\dots$ are even numbers.

A: Hint. The problem is equivalent to count the number of non-negative integer solutions of the equation
$$(2x_1+1)+(2x_2+1)+ \dots+ (2x_k+1)=n$$
that is
$$x_1+x_2+ \dots+ x_k=\frac{n-k}{2}.$$
Then $s_i=\sum_{j=1}^i(2x_j+1)$ for $i=1,2,\dots,k$. To count such solutions use Stars and bars technique.


text:
Q: Can I add an SSIS script block with custom script into the toolbox? I have a common SSIS C# script task block that we use in our company.  It is only a single script block but the script inside is always the same.  We use it in lots of our SSIS packages.  It is kind of a pain to always have to copy the block from another project or copy the script from somewhere into a new script block.
Is there any way I can put a copy of that script block with the prewritten script into the SSIS Toolbox so I can just drag-and-drop it into our projects?
EDIT:
OK, so I have started writing a custom control based on the advice given below.  I've got everything working except for connecting to my SQL Server database.  Using the following code:
SqlConnection SettingsConnection = (SqlConnection)_selectedConnectionManagerSource.AcquireConnection(transaction); // Errors here
SqlCommand sp_GetAllValues = new SqlCommand();
sp_GetAllValues.Connection = SettingsConnection;
sp_GetAllValues.CommandType = CommandType.StoredProcedure;
sp_GetAllValues.CommandText = "Get_My_Data_For_Project";
sp_GetAllValues.Parameters.AddWithValue("@project_name", pkgname);
SettingsConnection.Open();
SqlDataReader SettingsReader = sp_GetAllValues.ExecuteReader();
while (SettingsReader.Read())
{

I get this error message:
[Connection manager "DevServer"] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "Login timeout expired".
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "Named Pipes Provider: Could not open a connection to SQL Server [53]. ".
What am I doing wrong?
ANOTHER EDIT:
If I change the code to:
string myConnectionStr = _selectedConnectionManagerSource.ConnectionString;
SqlConnection SettingsConnection = new SqlConnection(myConnectionStr);
SqlCommand sp_GetAllValues = new SqlCommand();
sp_GetAllValues.Connection = SettingsConnection;
sp_GetAllValues.CommandType = CommandType.StoredProcedure;

I get this error message:
Error: The Execute method on the task returned error code 0x80070057 (Keyword not supported: 'provider'.). The Execute method must succeed, and indicate the result using an "out" parameter.
If I take out the 'provider' section of the connection string (hard code the string):
string myConnectionStr;
myConnectionStr = "Data Source=mydatabase;Initial Catalog=mycatalog;Integrated Security=SSPI;";
SqlConnection SettingsConnection = new SqlConnection(myConnectionStr);
SqlCommand sp_GetAllValues = new SqlCommand();
sp_GetAllValues.Connection = SettingsConnection;
sp_GetAllValues.CommandType = CommandType.StoredProcedure;

I get this error message:
Error: The Execute method on the task returned error code 0x80131904 (A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)). The Execute method must succeed, and indicate the result using an "out" parameter.
This last block is exactly the code I was using in my Script Task block and it is working fine.  I'm just not sure what the difference between the two... :/
FINAL EDIT:
All of these error messages were because my test package was set to run 64-bit instead of 32-bit.  I changed the package to run 32-bit and it started working with an ADO.NET connection. My final code looks like this:
string myConnectionStr = _selectedConnectionManagerSource.ConnectionString;
SqlConnection SettingsConnection = new SqlConnection(myConnectionStr);
SqlCommand sp_GetAllValues = new SqlCommand();
sp_GetAllValues.Connection = SettingsConnection;
sp_GetAllValues.CommandType = CommandType.StoredProcedure;

and it works great as long as it is using an ADO.NET data source.  It still would not work with an OleDb data source even using OleDbConnection, etc.  Not sure why.  But, now that it is working with ADO.NET, I really don't care to solve that one.
Now that the base functionality is working fine, I'm off to write the UI... :)

A: The only way is to create custom task of it: http://microsoft-ssis.blogspot.com/2013/06/create-your-own-custom-task.html

An alternative is to create a custom assembly and reference that in your Script Task: http://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html

A: So I think you ran into a snag involving your connection's provider:

*

*You can't include the provider keyword in a SqlConnection connection string. All of the connections in SSIS are OLE DB connections which include the provider keyword in its connection string.

So in your code you should be using an OleDbConnection instead of a SqlConnection (and OleDbCommand, OleDbDataReader, etc.)
For your hardcoded connection string, does your server instance name happen to have a slash in it, by any chance? This tripped me up once, you have to escape slashes in C# strings, so if your connection string is
Data Source=SERVER\INSTANCE;Initial Catalog=DatabaseName;Integrated Security=SSPI;

Your C# code should look like so:
string ConnStr = "Data Source=SERVER\\INSTANCE;Initial Catalog=DatabaseName;Integrated Security=SSPI;";

or (my preference)
string ConnStr = @"Data Source=SERVER\INSTANCE;Initial Catalog=DatabaseName;Integrated Security=SSPI;";


text:
Q: Libgdx how to fix Missing Asset Catalog in 'IOSLauncher.app'? I get this problem when I upload my app :

Missing Asset Catalog - Your app is missing the asset catalog file in
  'IOSLauncher.app'.

I am using robovm to create the IPA file here is my info.plist
 <key>CFBundleIcons</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon</string>
                <string>Icon-72</string>
            </array>
        </dict>
    </dict>

I am using xCode9

A: here is how I solved it :
Generate Assets.xcassets folder.
Create an empty iOS project with Xcode 9, give it whatever name. Then refer to Assets.xcassets folder in left panel:

Double click to open it. Xcode creates a default asset catalog named "AppIcon". Select "AppIcon", then add all icon size of your app.

Close this windows and save project. Then refer to this project's folder in Finder:

There will be a folder called "Assets.xcassets":

Open your RoboVM project's folder, then go to the folder where you set to save your iOS assets.
This folder will be like "data", "resource". To know which, just open "robovm.xml" file, there will be a node named "resources", and then it will tell you which folder RoboVM will refer to when building iOS app with given assets.

In my case, it will be "data" folder, just under my iOS project's folder:

Copy "Assets.xcassets" folder from the project we just created with Xcode 9 to "data" folder.
Modify your iOS project's "Info.plist.xml" file.
Under "dict" node, add like this:

Then comment out all the icon info in "CFBundleIcons", you will not use this anymore.
<!--key>CFBundleIcons</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon</string>
                <string>Icon-72</string>
            </array>
        </dict>
    </dict-->


text:
Q: aligning two side-by-side divs screws up table below I have two divs side by side.  I want to align the contents of one to the left and the contents of the other to the right.  The left aligns properly but when I align the right, it screws up the input table just below.  (See image)
This

Sadly Becomes
This

I feel like this is probably a really simple question but I just can't figure it out, though I swear I've done it before.
Here's the html (I've removed some php loops in the middle of it because I doubt it's relevant but let me know if you think it is):

What does {$business['name']} aim to achieve within the next three months?

<input type="button" value="Add Goal" onclick="addRow('threemonths')" />

            <input type="button" name="Delete" onClick="newDelete(this);"/>
            <input type="text" name="txt[]" value='{$goal['description']}'/><input type="hidden" name="type[]" value='threemonths'>

And here's the CSS:
.addRow {
    float: right;
    display: inline;
}

div#goals .question {
    float: left;
    margin-left: 40px;
    display: inline;
}

.goals_table {
    display: block;
}

A sample of the element can be found here: https://dl.dropboxusercontent.com/u/11993667/Hosting%20Signup%20%7C%20%7C%20Page%2010.html
Thanks in advance.

A: You are going to need this CSS on the table.
clear: both
clear will prevent items from sitting on left, right or both the sides of an element.


text:
Q: R filter or subset based on list of values in two rows I have a large dataset where I want to filter out rows with matching column values in another dataframe that is of a different length.
As a simple example:
df1
 A  B      date
 1  3 3-10-2022
 1  2 3-10-2022
 2  2  3-5-2022
 3 NA  4-5-2022
 3  2  4-5-2022
 4 NA  4-5-2022

df2
  A     date2
 1 3-10-2022
 2 4-10-2022
 3  4-5-2022

The goal is to exclude rows in df1 where column values both A and date match e.g. df1$A = df2$A AND df1$date = df2$date2 such that my new data frame is:
 Desired results
df3
 A  B      date
 2  2  3-5-2022
 4 NA  4-5-2022

I have tried the following but have found that my results do not appropriately exclude rows. I also get the error message of "longer object length is not a multiple of shorter object length" and am wondering if this is the issue.
df3 <- df1[!(df1$A == df2$A & df1$date == df2$date),]

Incorrect results:
df3
   A  B      date
  1  2 3-10-2022
  2  2  3-5-2022
  3 NA  4-5-2022
  3 2  4-5-2022
  4 NA  4-5-2022

The issue appears to be with rows where A includes duplicated value and/or the row contains an NA value, it is incorrectly retained.
Can you please advise?

A: How about this?
I just removed "!".
A<-c(1,2,3)
B<-c(3,NA,4)
date<-c("3-10-2022","3-5-2022","4-5-2022")
(df1<-data.frame(A,B,date))
date2<-c("3-10-2022","4-10-2022","4-5-2022")
(df2<-data.frame(A,date2))

(df3 <- df1[(df1$A == df2$A & df1$date == df2$date),])

#   A B    date
# 1 1 3 3-10-2022
# 3 3 4  4-5-2022

A: This is a classical case for an anti join:
df1<- data.frame(A= c(1,1,2,3,3,4),
           B= c(3,2,2,NA, 2, NA),
           date= c("2022-10-03",
                   "2022-10-03",
                   "2022-05-03",
                   rep("2022-05-04",3))
           )

df2 <- data.frame(A= 1:3,
                  date= c("2022-10-03",
                          "2022-10-04",
                          "2022-05-04"))

require(dplyr)

df1 %>% anti_join(df2, by= c("A", "date"))

A: OK. Try "%in%" instead of "==".
(df3 <- df1[!(df1$A %in% df2$A & df1$date %in% df2$date),])

  A  B     date
3 2  2 3-5-2022
6 4 NA 4-5-2022

Because df2$A is a vector.


text:
Q: Tikz: Tiling hexagons with varying content With help from answers to TikZ: Drawing regular hexagons with pictures inside, I've created some tiles for a children's game:

To save on costs of printing + card, I'd like to fit 3 more hexes into the gaps in the [a4] paper.
The code that generated that looked like this:
\tile{Lake}{lake.jpg}{1.2}{Starts on Board}{--}{\food}\hfill
\tile{Forest}{forest.jpg}{1.6}{Starts on Board}{--}{\wood}\\

\tile{Forest}{forest.jpg}{1.6}{Starts on Board}{--}{\wood}\hfill
\tile{Forest}{forest.jpg}{1.6}{Starts on Board}{--}{\wood}\\

\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}\hfill
\tile{Butcher}{butcher.jpg}{10}{Build on Clearing}{\wood\wood\person}{\convert{\sheep}{\food}}\\

\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}\hfill
\tile{Butcher}{butcher.jpg}{10}{Build on Clearing}{\wood\wood\person}{\convert{\sheep}{\food}}\\

I could add an extra 'location' argument to \tile and cyclically instantiate it with 11 positions, but that would be a pain to maintain when I changed the number of tiles (e.g. changed 3 forests to 4 forests). So: how can I keep the positional information separate from the specification of the contents of the tiles?
Edit: full code as requested. (Tiles have changed a bit, but not in a way that affects the question.)
\documentclass[a4paper]{article}
\usepackage[margin=2mm]{geometry}
\usepackage{tikz,nopageno}
\usepackage{wasysym}

\usetikzlibrary{fit,backgrounds}

\setlength{\parskip}{0mm}

\newcommand{\highlight}[2]{%
\begin{tikzpicture}[baseline = (text.base)]
  \node[inner sep=0pt] (text) {#2};
  \begin{pgfinterruptboundingbox}
    \begin{pgfonlayer}{background}
    \node[fit=(text), rounded corners, fill=white, opacity=#1, draw=none] {};
    \end{pgfonlayer}
  \end{pgfinterruptboundingbox}
\end{tikzpicture}%
}

% General macro to draw a shape filled with a bitmap
\newcommand\fillshape[3]{ % #1 = shape, #2 = filename of texture, #3 = includegraphics options
    \begin{scope}
        \clip #1;
        \node {\includegraphics[#3]{#2}};
    \end{scope}
    \draw[line width=0.5mm] #1;
}

% Particularization for hexagonal shape
\newcommand\fillhexagon[2][]{% #1 (optional) = includegraphics options, #2 = filename of texture
    \fillshape{(0:4) -- (60:4) -- (120:4) -- (180:4) -- (240:4) -- (300:4) -- cycle}{#2}{#1}
}

\newcommand\tile[6]{
\begin{tikzpicture}
    \fillhexagon[scale=#3]{#2};
    \node at (0,2.4) {\highlight{0.65}{\LARGE\bf #1}};
    \node at (0,0.7) {\highlight{1}{#6}};
    \draw [rounded corners, fill=white, opacity=1] (-2,-0.6)--(2,-0.6)--(2,-2.5)--(-2,-2.5)--cycle;
    \node at (0,-1.05) {#4};
    \node at (0,-1.85) {#5};
\end{tikzpicture}
}

\newcommand\image[2]{$\vcenter{\hbox{\includegraphics[scale=#1]{#2}}}$}

\newcommand\wood{\image{0.22}{wood.png}}
\newcommand\food{\image{0.23}{bowl.jpg}}
\newcommand\person{\image{0.25}{peasant.jpg}}
\newcommand\grain{\image{0.5}{grain2.jpg}}
\newcommand\sheep{\image{0.05}{sheep.png}}
\newcommand\stone{\image{0.35}{stone.png}}
\newcommand\ale{\image{0.12}{ale.png}}
%\newcommand\cloth{\image{0.2}{cloth.png}}
\newcommand\paper{\image{0.1}{paper.png}}
\newcommand\gold{\image{0.7}{gold.jpg}}
\newcommand\marble{\image{0.2}{marble.jpg}}

\newcommand\TO{\Huge$\rightarrow$}

\newcommand*{\vpointer}{$\vcenter{\hbox{\ \scalebox{2}{$\rightarrow$}}}$}

\newcommand\convert[2]{#1\vpointer\, #2}

\begin{document}
\tile{Lake}{lake.jpg}{1.2}{Starts on Board}{--}{\food}\hfill
\tile{Field}{field2.jpg}{1.5}{Replaces Clearing}{\person\person\person\person}{\grain}\\

\tile{Forest}{forest2.jpg}{0.4}{Starts on Board}{--}{\wood}\hfill
\tile{Mountain}{mountain2.jpg}{0.3}{Starts on Board}{--}{--}\\

\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}\hfill
\tile{Butcher}{butcher.jpg}{10}{Build on Clearing}{\wood\wood\person}{\convert{\sheep}{\food}}\\

\tile{Grazing}{grazing.jpg}{0.3}{Replaces Hill}{\person}{\sheep}\hfill
\tile{Pasture}{sheepfield.jpg}{2.1}{Replaces Clearing}{\wood\sheep\sheep\sheep\sheep}{\sheep\sheep}

\end{document}

A: Your hexagons are bit wider to fit 3 of them on a line. Hence I introduced \mylength to adjust. You can use a tabular to arrange the tiles with a column definition:
\newcolumntype{C}{>{\centering\arraybackslash}p{\dimexpr0.32\textwidth-2\tabcolsep\relax}}

using array package and use them like
\begin{tabular}{CCC}

Code:
\PassOptionsToPackage{draft}{graphicx}   %% uncomment in your system
\documentclass{article}
\usepackage[a4paper,margin=2mm]{geometry}
\usepackage{tikz,nopageno}
\usepackage{wasysym}
\usepackage{array}
\newcolumntype{C}{>{\centering\arraybackslash}p{\dimexpr0.32\textwidth-2\tabcolsep\relax}}

\usetikzlibrary{fit,backgrounds}

\setlength{\parskip}{0mm}
\newlength{\mywidth}
\setlength{\mywidth}{3cm}  %%% size of the hexagon adjusted so that three hexgons fit

\newcommand{\highlight}[2]{%
\begin{tikzpicture}[baseline = (text.base)]
  \node[inner sep=0pt] (text) {#2};
  \begin{pgfinterruptboundingbox}
    \begin{pgfonlayer}{background}
    \node[fit=(text), rounded corners, fill=white, opacity=#1, draw=none] {};
    \end{pgfonlayer}
  \end{pgfinterruptboundingbox}
\end{tikzpicture}%
}

% General macro to draw a shape filled with a bitmap
\newcommand\fillshape[3]{% #1 = shape, #2 = filename of texture, #3 = includegraphics options
    \begin{scope}
        \clip #1;
        \node {\includegraphics[#3]{#2}};
    \end{scope}
    \draw[line width=0.5mm] #1;
}%

% Particularization for hexagonal shape
\newcommand\fillhexagon[2][]{% #1 (optional) = includegraphics options, #2 = filename of texture
    \fillshape{(0:\mywidth) -- (60:\mywidth) -- (120:\mywidth) -- (180:\mywidth) -- (240:\mywidth) -- (300:\mywidth) -- cycle}{#2}{#1}
}

\newcommand\tile[6]{
\begin{tikzpicture}
    \fillhexagon[scale=#3]{#2};
    \node at (0,2.4) {\highlight{0.65}{\LARGE\bf #1}};
    \node at (0,0.7) {\highlight{1}{#6}};
    \draw [rounded corners, fill=white, opacity=1] (-2,-0.6)--(2,-0.6)--(2,-2.5)--(-2,-2.5)--cycle;
    \node at (0,-1.05) {#4};
    \node at (0,-1.85) {#5};
\end{tikzpicture}
}

\newcommand\image[2]{$\vcenter{\hbox{\includegraphics[scale=#1]{#2}}}$}

\newcommand\wood{\image{0.22}{wood.png}}
\newcommand\food{\image{0.23}{bowl.jpg}}
\newcommand\person{\image{0.25}{peasant.jpg}}
\newcommand\grain{\image{0.5}{grain2.jpg}}
\newcommand\sheep{\image{0.05}{sheep.png}}
\newcommand\stone{\image{0.35}{stone.png}}
\newcommand\ale{\image{0.12}{ale.png}}
%\newcommand\cloth{\image{0.2}{cloth.png}}
\newcommand\paper{\image{0.1}{paper.png}}
\newcommand\gold{\image{0.7}{gold.jpg}}
\newcommand\marble{\image{0.2}{marble.jpg}}

\newcommand\TO{\Huge$\rightarrow$}

\newcommand*{\vpointer}{$\vcenter{\hbox{\ \scalebox{2}{$\rightarrow$}}}$}

\newcommand\convert[2]{#1\vpointer\, #2}

\begin{document}
\begin{tabular}{CCC}
\tile{Lake}{lake.jpg}{1.2}{Starts on Board}{--}{\food}&
\tile{Field}{field2.jpg}{1.5}{Replaces Clearing}{\person\person\person\person}{\grain}&
\tile{Forest}{forest2.jpg}{0.4}{Starts on Board}{--}{\wood}\\%%[1ex] %% uncomment to adjust vertical gap

\tile{Mountain}{mountain2.jpg}{0.3}{Starts on Board}{--}{--}&
\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}&
\tile{Butcher}{butcher.jpg}{10}{Build on Clearing}{\wood\wood\person}{\convert{\sheep}{\food}}\\%%[1ex] %% uncomment to adjust vertical gap

\tile{Grazing}{grazing.jpg}{0.3}{Replaces Hill}{\person}{\sheep}&
\tile{Pasture}{sheepfield.jpg}{2.1}{Replaces Clearing}{\wood\sheep\sheep\sheep\sheep}{\sheep\sheep}&
\end{tabular}

\end{document}

You can adjust the vertical gap between rows so as to suit your needs. Sorry for the bad picture but I don't have patience to find a replacement for all those images.
Tiled version with tabular
\PassOptionsToPackage{draft}{graphicx}
\documentclass[a4paper]{article}
\usepackage[margin=2mm]{geometry}
\usepackage{tikz,nopageno}
\usepackage{wasysym}
\usepackage{array}
\newcolumntype{C}{>{\centering\arraybackslash}p{\dimexpr0.23\textwidth-2\tabcolsep\relax}}

\usetikzlibrary{fit,backgrounds}

\setlength{\parskip}{0mm}
\newlength{\mywidth}
\setlength{\mywidth}{3.7cm}  %%% size of the hexagon adjusted so that three hexgons fit

\newcommand{\highlight}[2]{%
\begin{tikzpicture}[baseline = (text.base)]
  \node[inner sep=0pt] (text) {#2};
  \begin{pgfinterruptboundingbox}
    \begin{pgfonlayer}{background}
    \node[fit=(text), rounded corners, fill=white, opacity=#1, draw=none] {};
    \end{pgfonlayer}
  \end{pgfinterruptboundingbox}
\end{tikzpicture}%
}

% General macro to draw a shape filled with a bitmap
\newcommand\fillshape[3]{% #1 = shape, #2 = filename of texture, #3 = includegraphics options
    \begin{scope}
        \clip #1;
        \node {\includegraphics[#3]{#2}};
    \end{scope}
    \draw[line width=0.5mm] #1;
}%

% Particularization for hexagonal shape
\newcommand\fillhexagon[2][]{% #1 (optional) = includegraphics options, #2 = filename of texture
    \fillshape{(0:\mywidth) -- (60:\mywidth) -- (120:\mywidth) -- (180:\mywidth) -- (240:\mywidth) -- (300:\mywidth) -- cycle}{#2}{#1}
}

\newcommand\tile[6]{
\begin{tikzpicture}
    \fillhexagon[scale=#3]{#2};
    \node at (0,2.4) {\highlight{0.65}{\LARGE\bf #1}};
    \node at (0,0.7) {\highlight{1}{#6}};
    \draw [rounded corners, fill=white, opacity=1] (-2,-0.6)--(2,-0.6)--(2,-2.5)--(-2,-2.5)--cycle;
    \node at (0,-1.05) {#4};
    \node at (0,-1.85) {#5};
\end{tikzpicture}
}

\newcommand\image[2]{$\vcenter{\hbox{\includegraphics[scale=#1]{#2}}}$}

\newcommand\wood{\image{0.22}{wood.png}}
\newcommand\food{\image{0.23}{bowl.jpg}}
\newcommand\person{\image{0.25}{peasant.jpg}}
\newcommand\grain{\image{0.5}{grain2.jpg}}
\newcommand\sheep{\image{0.05}{sheep.png}}
\newcommand\stone{\image{0.35}{stone.png}}
\newcommand\ale{\image{0.12}{ale.png}}
%\newcommand\cloth{\image{0.2}{cloth.png}}
\newcommand\paper{\image{0.1}{paper.png}}
\newcommand\gold{\image{0.7}{gold.jpg}}
\newcommand\marble{\image{0.2}{marble.jpg}}

\newcommand\TO{\Huge$\rightarrow$}

\newcommand*{\vpointer}{$\vcenter{\hbox{\ \scalebox{2}{$\rightarrow$}}}$}

\newcommand\convert[2]{#1\vpointer\, #2}

\begin{document}

\begin{tabular}{cCc}
\tile{Lake}{lake.jpg}{1.2}{Starts on Board}{--}{\food}&
&
\tile{Forest}{forest2.jpg}{0.4}{Starts on Board}{--}{\wood}\\[-3cm] %% uncomment to adjust vertical gap

&
\makebox[0pt][c]{\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}}&
\\[-3cm] %% uncomment to adjust vertical gap

\tile{Lake}{lake.jpg}{1.2}{Starts on Board}{--}{\food}&
&
\tile{Forest}{forest2.jpg}{0.4}{Starts on Board}{--}{\wood}\\[-3cm] %% uncomment to adjust vertical gap

&
\makebox[0pt][c]{\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}}&
\\[-3cm] %% uncomment to adjust vertical gap

\tile{Lake}{lake.jpg}{1.2}{Starts on Board}{--}{\food}&
&
\tile{Forest}{forest2.jpg}{0.4}{Starts on Board}{--}{\wood}\\[-3cm] %% uncomment to adjust vertical gap

&
\makebox[0pt][c]{\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}}&
\\[-3cm] %% uncomment to adjust vertical gap

\tile{Lake}{lake.jpg}{1.2}{Starts on Board}{--}{\food}&
&
\tile{Forest}{forest2.jpg}{0.4}{Starts on Board}{--}{\wood}\\[-3cm] %% uncomment to adjust vertical gap

%&
%\makebox[0pt][c]{\tile{Baker}{baker.jpg}{7}{Build on Clearing}{\wood\wood\person}{\convert{\grain}{\food}}}&
%\\[-3cm] %% uncomment to adjust vertical gap

\end{tabular}
\end{document}

This may make cutting difficult, but I hope adding/deleting rows shouldn't be difficult.

A: How about defining a coordinate system? Then you can use what ever tikz method you choose to create the tiles and then just shift the transformation matrix using the coordinate system.
Some apologies for the slightly boring tile content. To space the tiles out more just set the x and and y vectors to larger values.
\documentclass[tikz,border=0.125cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\tikzset{hexagon/.style args={#1with image#2[#3]#4(#5)}{%
  regular polygon, regular polygon sides=6,
  path picture={\node{\includegraphics[#3]{#5}};},
  draw, ultra thick, minimum size=#1, node contents=},
  %
  hexagonal cs/.cd,
    x/.store in=\hexx, y/.store in=\hexy,
    x=0,y=0,
}
\tikzdeclarecoordinatesystem{hexagonal}{%
  \tikzset{hexagonal cs/.cd,#1}%
  \pgfpointxy{\hexx*0.75}{(\hexy-mod(\hexx,2)/2)*cos(30)}%
}
\begin{document}
\begin{tikzpicture}
\foreach \h [evaluate={\i=mod(\h,5); \j=floor(\h/5);
  \k=random(0,2); \l={"a","b","c"}[\k];}] in {0,...,24}
  \node [x=2.25cm, y=2.25cm] at (hexagonal cs:x=\j, y=\i)
    [hexagon={2cm with image [scale=0.25] (example-image-\l)}];
\end{tikzpicture}
\end{document}


text:
Q: Create perfect hash for millions of items - result just needs to be "exists or not" Does anyone know of a good library (windows) that will allow me to create a static (not runtime) perfect hash for millions of items (probably about 10m)?
I essentially have millions of sets of strings and I want to know at a minimal O(1) if a string is in my set or not - that's it. I don't need it to actually look up the string - there's no value behind it (other than the existance).

A: Try:

*

*Bob Jenkins's perfect.

*CMPH

*gperf
perfect and gperf produce tables in C code form, which should work fine on Windows. I don't know what CMPH's output is.
CMPH has a comment saying:

gperf is a bit different, since it was conceived to create very fast perfect hash functions for small sets of keys and CMPH Library was conceived to create minimal perfect hash functions for very large sets of keys.

If that's correct, then with your million-key case, you should probably prefer CMPH to gperf. I don't know how they compare to Jenkins's perfect. It should be simple enough to try all three and benchmark them against each other.

A: A Bloom filter will do what you want, I would look around for libraries that have them or you can attempt to write one yourself.


text:
Q: Windows 10: Strange taskbar flickering and cursor delay for jumplists For the last couple of months, I've been facing a very strange flickering/delay issue in Windows 10 that I cannot resolve.
There are two problems:

*

*Some time after every reboot, I have noticed that engaging the
taskbar and then clicking anywhere else on the desktop causes a strange flickering
of the entire taskbar. I've attached a GIF illustrating it. The
problem arises regardless if I'm simply clicking on the taskbar and then on the
desktop, or if I expand an app's jumplist and doing the same (which is the GIF version).

*Usually in combination with the above, I have also noticed a very annoying
delay when opening the jumplists for apps. When right-clicking on an
app icon to expand its jump list, the mouse pointer gets stuck for a
split second before the jump list opens up. This issue doesn't
happen constantly, and I was unable to capture it now.

I've been trying my best to narrow down what's causing this. I'm running the very latest version of Windows 10 Home (x64), and the problem has persisted over several major updates. I have made sure to always update my NVIDIA drivers for my GTX 1070 Ti (currently running version 445.87), but that also hasn't helped. This means there might be some other app/process causing some issues.
I also run Stardock Fences 3 to customize my desktop, so I suspected this app's causing it. But I have tried disabling it to see if it has any effect, but no dice. Also did "sfc" and "chkdsk" in a terminal, but there are no issues to speak of. I figured "sfc" would see if my Explorer process is busted.
After rebooting my PC, the problem usually disappears and it has been very hard to see when/why it gets triggered. One thing that seems to be true is that it usually happens after I open up two windows and put them in side-by-side mode (WINDOWS+Left Arrow and WINDOWS+Right Arrow), for some reason. I have an ultrawide 21:9 monitor running in 3440x1440px, if it matters.
Any help on narrowing this issue down would be great, thanks in advance!

A: God knows how many months later, it looks like I've found a solution to both the described problems; turning off the Geforce Experience overlay from the NVIDIA settings. After doing that, it seems the taskbar flickering is completely gone, and the jumplists do not cause any perceivable lag/"mouse locking" anymore!


text:
Q: 12.04 reports itself as quantal after installing the toolchain-test-ppa? I upgraded to 12.04 (64 bit) today, so far so good, everything worked great, until I tried doing some more advanced stuff.
When I tried adding the toolchain-test ppa, I got a mismatch on distribution. After a try or 4 this changed and linked me to this bug report. So far so good, a weird error but I'm not the only one and it will get fixed right?
But I found it a very weird error, and I also noticed some other (custom) apps behaving weird concerning my distribution version. So I tried to find out what release I'm running, these are the results I got:
>:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu quantal (development branch)
Release:    12.10
Codename:   quantal

>:~$ cat /etc/issue
Ubuntu quantal (development branch) \n \l

Now I'm wondering: did I do something wrong on installation? Did I accidentally download some weird nightly, set up wrong repositories, ...? Or is this simply a bug in some small part of the system that does the reporting wrong and maybe will confuse an app or two?
Now, whatever the reason: is there a simple way I can set this release information to the correct version again?

A: I had the exact same problem. In my case it was due to the fact that I had the ppa:ubuntu-toolchain-r/test enabled and even though only precise was listed as the series, the base-files package in there seems to belong to quantal. To find out from where the misbehaving base-files package is installed, use the following command:
$ apt-cache policy base-files

Find the line where the version matches the installed version and inspect the URL that is reported for that version.
If you want to keep the PPA enabled (e.g. because you want/must use the gcc-4.7 compiler), you can use apt-pinning to force the system into keeping the base-files package while allowing you to install gcc-4.7. Create the file /etc/apt/preferences.d/base-files (make sure not to use any dots in the name) with the following content:
Package: base-files
Pin: release o=Ubuntu
Pin-Priority: 1001

This will force a downgrade of the base-files package to its default version (from the main ubuntu repository) on the next upgrade.
Be extra careful about typographical errors, particularly spaces and capitalization.
Once the file is in place, use apt-cache policy base-files to determine the Candidate version. It should correspond to the version that is listed next to the default Ubuntu archive. Finally, start the downgrade:
$ sudo apt-get upgrade

When asked whether you really want to DOWNGRADE (capitalization not mine...), answer with y+Enter.

A: As far as I know, once a package is upgraded it cannot be downgraded, with the exception being a procedure like REMOVE PACKAGE- > CHANGE REPO- > UPDATE APT -> REINSTALL OLD PACKAGE. Which is a quite odd procedure, as sometimes there are some dependencies and version issues.
Anyway, go to /etc/apt/sources.list and /etc/apt/sources.list.d/*.list and see if there are some rows containing the word "quantal".
If there are, then that's the problem. I would suggest you backup everything and reinstall a clean stable version. The other solution would be to change all the "quantal" words in "precise", re-update repos and hope that all of the quantal packages will be replaced with a more up-to-date precise version. But it's a VERY BAD solution!


text:
Q: Node.js not searching modules in node_modules folder I have installed packages using npm install -g http-server.
However, when i try to run this using node http-server. it throws error as below:
module.js:338
    throw err;
          ^
Error: Cannot find module '/home/khagesh/http-server'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

I have tried setting NODE_PATH to /home/khagesh/npm/lib/node_modules.
As far as i can think is that node is not searching modules in node_modules and directly searching in user directory.
I am running it on Ubuntu 14.04.
Any help to fix this issue is appreciated.


text:
Q: RequireJS: Difference between "requirejs" and "require" functions I am using requireJS 2.x. I found out that some tutorials (and the official docs) sometimes use
requirejs.config({ [...] });
requirejs(["module"]) ...

and sometimes
require.config({ [...] });
require(["module"]) ...

Is there any difference between those two functions (require and requirejs)? I could not find any word about that in the docs. :(

A: They are exactly the same.
The reason is some environments might already have a require, in which case RequireJS doesn't overwrite it and allows usage of the library through requirejs
See this commit - https://github.com/jrburke/requirejs/commit/be45948433b053921dc6a6a57bf06d04e13b3b39

A: Are requirejs And require the Same?
As of RequireJS 2.1.15, require and requirejs in the global space are indeed "exactly the same", as can be evidenced by this test you can perform in the console:
> require === requirejs
true

That the test returns true tells you they are the exact same function object. They are not two functions that happen to have similar or identical code. They are the same object, period.
Note, however when you execute define(['require'], function (require) { The require passed to the function is normally different from the global require.
Should You Use require or requirejs?
It depends. RequireJS is an AMD loader but it is not the only loader in town. If you want to write code that conforms 100% to the AMD spec, so that someone using your code can use whatever loader they want without having to modify your code, then you should use require at the global level, because requirejs is specific to RequireJS. Another AMD loader won't define it. The AMD spec defines require but not requirejs.
If you are loading something else that defines a global require then you have to use requirejs at the global level to avoid conflict.
Inside a module, always use define to obtain a reference to require. You should do this quite irrespective of whether there is a conflict in the global space.

A: OK, they may indeed be "exactly the same". Let's then focus on why you would use one versus the other...
What is unclear is what should be considered "best practice": If requirejs provides extra assurance "if some environments might already have a require", then wouldn't it be a good idea to always use the requirejs function to define a require configuration rather than the require function?
Also, what happens if the unthinkable happens and the environment in question not only already has a "require" defined but also has a "requirejs" defined? Does that mean we should have a requirejsjs too? And so on...?

A: They are Same
Open website which loaded require already
then open Chrome console
type require in console and press enter
type requirejs in console and press enter
you can find that they are same function with different names


text:
Q: BenQ PD3220U with 2014 MacBook Pro Retina (USB hub question) I want to buy the BenQ PD3220U monitor but I am not sure if I will be able to use it how I intend to. As The following post shows that I should be able to connect to the monitor from my Thunderbolt 2 port using an adapter: Is Thunderbolt 2 to Thunderbolt 3 (type C) possible?
This way I should be able to get 4k 60Hz output. I don't know however if I will also be able to use all it's other features such as the integrated USB hub and KVM switch. Does anybody know if it will work?

A: If you have another system (PC or Mac) and this 2014 MacBook Pro, you can have a DisplayPort KVM switch to have both systems share the monitor and keyboard/ mouse/ other USB devices.  With the DisplayPort KVM switch, you don't need to have a Thunderbolt 2-to-3 converter.  And you also can get extra USB sharing ports at the same time.
Just carefully to select the right DisplayPort-to-Type-C active converter for the connection between the KVM switch video out to the Type-C monitor.
We tested and recommended CAC-1557 for the cable  and UDP-12AP for the KVM switch.


text:
Q: Asterisk: Dropping calls with an "ast_yyerror" I'm having an intermittent issue where asterisk will play our greeting to the caller, and then drop the call instead of making our phones ring.
I'm unable to reproduce the problem with any phones I have here, and many callers get through just fine. Some callers though, run into the problem, and I can't find any pattern to it.
The bit of information I could find said it was caused by an error in evaluating a dialplan expression. I'm thinking it's this line:

exten => START,n,GotoIf($[${FORCE_CLOSED}=TRUE]?CLOSED,1)

But I'm not sure what's wrong with it.
I see the following error on the console:

[Apr  4 16:29:49] WARNING[27038]: ast_expr2.fl:459 ast_yyerror: ast_yyerror():  syntax error: syntax error, unexpected '=', expecting $end; Input:=TRUE^

Surrounding Console output:

-- Executing [START@AGInbound:1] Answer("IAX2/AtlantaTeliax-10086", "") in new stack
-- Executing [START@AGInbound:2] BackGround("IAX2/AtlantaTeliax-10086", 0000_AG_THANK_YOU_FOR_CALLING_AG") in new stack
--  Playing '0000_AG_THANK_YOU_FOR_CALLING_AG.slin' (language 'en')
[Apr  4 16:29:49] WARNING[27038]: ast_expr2.fl:459 ast_yyerror: ast_yyerror():  syntax error: syntax error, unexpected '=', expecting $end; Input:
=TRUE
^
[Apr  4 16:29:49] WARNING[27038]: ast_expr2.fl:463 ast_yyerror: If you have questions, please refer to doc/tex/channelvariables.tex in the asterisk source.
    -- Executing [START@AGInbound:3] GotoIf("IAX2/AtlantaTeliax-10086", "?CLOSED,1") in new stack
    -- Executing [START@AGInbound:4] GotoIfTime("IAX2/AtlantaTeliax-10086", "9:30-17:0|mon-fri|*|*?OPEN,1") in new stack
    -- Executing [START@AGInbound:5] GotoIfTime("IAX2/AtlantaTeliax-10086", "10:0-18:30|sat|*|*?OPEN,1") in new stack
    -- Executing [START@AGInbound:6] GotoIfTime("IAX2/AtlantaTeliax-10086", "12:0-17:0|sun|*|*?OPEN,1") in new stack

Relevant lines from the dial plan:

exten => START,1,Answer()
exten => START,n,Background(0000_AG_THANK_YOU_FOR_CALLING_AG)

; See if we're open
; Force Closed if no one's going to be answering
exten => START,n,GotoIf($[${FORCE_CLOSED}=TRUE]?CLOSED,1)

exten => START,n,GotoIfTime(${AG_WEEKDAY_OPEN_HOUR}:${AG_WEEKDAY_OPEN_MIN}-${AG$
exten => START,n,GotoIfTime(${AG_SATURDAY_OPEN_HOUR}:${AG_SATURDAY_OPEN_MIN}-${$
exten => START,n,GotoIfTime(${AG_SUNDAY_OPEN_HOUR}:${AG_SUNDAY_OPEN_MIN}-${AG_S$
; ...and we're not. But maybe the time of day has been overridden?
exten => START,n,GotoIf($[${OVERRIDE_TIME_OF_DAY}=TRUE]?OPEN,1)
; No override... We're definatly closed.
exten => START,n,Goto(CLOSED,1)

Any idea what's wrong with the expression? We recently upgraded from 1.4 to 1.6.

A: In an Asterisk $[] expression, undefined variables do not return an implicit empty string or zero. They expand as "nothing" prior to evaluation of the expression, so after the variable is expanded (to nothing), it isn't visible to the expression parser. This causes the error already noted by Pablo Alsina:
GotoIf("IAX2/AtlantaTeliax-10086", "?CLOSED,1")

There are two ways to avoid this:

*

*Always give your variables reasonable defaults before you use them (as Pablo suggested).

*In any $[] expression, enclose your variables and literals with double-quotes. This will cause an undefined variable to be handled as an empty string, which can still be used for comparison purposes.

Personally, I try to do both. For example:
exten => START,n,Set(FORCE_CLOSED=FALSE)
exten => START,n,GotoIf($["${FORCE_CLOSED}"="TRUE"]?CLOSED,1)

Note the double-quotes around ${FORCE_CLOSED} and the comparison value. Even if the variable is undefined, the expression will have "" (an empty string) to compare against "TRUE".
Really, you can use any character you like, because it will just be tacked onto the variable expansion. It just gives you a literal value that is guaranteed to be there in case the variable is undefined. I like quotes because it makes the code resemble other programming languages. You could just as easily use something like $[x${FORCE_CLOSED}=xTRUE], which is commonly seen in Bourne shell scripting. The end result is the same.

A: Here's what I can tell you.
yyerror is an error from a parser generated by yacc.
The error complains of the =. So it seems that, on that line, the = is a construct that the grammar does not support.
Good luck on serverfault.com where this question is headed ...

A: Who defines ${FORCE_CLOSED}?
From what I see, it seems that that variable sometimes does not get an initial value, and then the parser raises and error when you evaluate
GotoIf("IAX2/AtlantaTeliax-10086", "?CLOSED,1")

Check that the calls that raises an error have a reasonable value for FORCE_CLOSED


text:
Q: CodeIgniter: Returning data as an object vs array There are functions to return your data as either an object:
$query = $this->db->query("YOUR QUERY");

if ($query->num_rows() > 0)
{
   foreach ($query->result() as $row)
   {
      echo $row->title;
      echo $row->name;
      echo $row->body;
   }
}

Or an array:
$query = $this->db->query("YOUR QUERY");

foreach ($query->result_array() as $row)
{
   echo $row['title'];
   echo $row['name'];
   echo $row['body'];
}

I've always returned my data as arrays, but when is a case that returning an "object" is preferable?

A: I usually prefer an array when there are multiple rows and an object when there is a single record returned.  I often ask myself a few questions like:

*

*Does it need to be in a particular order? Array

*Am I going to output for an API? Objects

*Is this a list of elements with properties? Array of Objects

*Who am I delivering data to? Do they work with Arrays or Objects?


text:
Q: How to remove multiple objects in batch call using their IDs? How can I remove multiple objects in batch call using their IDs ?
I tried this
EntityManager em = ...
em.getTransaction().begin();
try
{
    for (Visitor obj : map.keySet())
    {
        Visitor fake = em.getReference(Visitor.class, obj.getId());
        em.remove(fake);
    }

    em.getTransaction().commit();
}
catch (Exception ex)
{
    ex.printStackTrace();
}

I see DELETE statements in log file but them it throws
<openjpa-2.1.1-r422266:1148538 fatal store error> org.apache.openjpa.persistence.RollbackException: Optimistic locking errors were detected when flushing to the data store.  The following objects may have been concurrently modified in another transaction: [com.reporting.data.Visitor-53043]
    at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:593)
    at com.reporting.ui.DBUtil.saveAnswers(DBUtil.java:311)

I have single thread.
Update:
I also tried
for (Visitor obj : map.keySet())
    em.remove(obj);

But it's slow because on every iteration it sends SELECT to a server. I assume OpenJPA does it to reattach object to context.

A: After multiple experiments I ended up doing hacky JPQL query. Here is code-snippet:
List<Long> lstExistingVisitors = ...
Query qDeleteVisitors = em.createQuery("delete from Visitor obj where obj.id in (?1)");
qDeleteVisitors.setParameter(1, lstExistingVisitors);
qDeleteVisitors.executeUpdate();

I tried list as big as 5000 IDs. It works fine with mysql 5.1 and H2DB.

A: Try to use JPQL
em.createQuery("delete from  Visitor v where v.id in (:param)")
.setParameter("param", idsList).executeUpdate();

OpenJPA docs: http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/jpa_langref.html#jpa_langref_bulk_ops