text:
Q: Unity Android manifest merge issue I am trying to build an android app, however something goes wrong with merging manifests. When I check the:

PROJECT\Temp\StagingArea\AndroidManifest.xml

It seems like my Manifest with compare to the older ones is missing some content. As far as I know to final manifest should contain elements from Unity "part" and from other plugins (in my case Google Play Games) as described here. In section "How Unity produces the Android Manifest". When i look at my actual Manifest i can spot that line is missing:
<meta-data android:name="com.google.android.gms.games.unityVersion"
            android:value="\ 0.9.50" />

but there are also some more which seems to be missing but I exactly do not know which (about 12 lines). The second thing that happens is that the App icon is lacking.
I have already tried :

*

*Assets -> Play Services Resolver -> Android Resolver -> Force Resolve

*Adding manually missing lines it is rather hit-or-miss approach.
Google Play Games plugin manifest:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
     Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.example.games.mainlibproj"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />

    <application>

        <!-- The space in these forces it to be interpreted as a string vs. int -->
        <meta-data android:name="com.google.android.gms.games.APP_ID"
            android:value="\ {MY_ID}" />

        <!-- Keep track of which plugin is being used -->
        <meta-data android:name="com.google.android.gms.games.unityVersion"
            android:value="\ 0.9.50" />

        <activity android:name="com.google.games.bridge.NativeBridgeActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    </application>
</manifest>

Final manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="{package name}" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:isGame="true">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <meta-data android:name="unity.build-id" android:value="{build id}" />
    <meta-data android:name="unity.splash-mode" android:value="0" />
    <meta-data android:name="unity.splash-enable" android:value="True" />
  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>

Unity Cloud Build service is building good final manifest (I used apktool to get it back from .apk):
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="{package name}">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true"/>
    <uses-feature android:glEsVersion="0x00020000"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false"/>
    <uses-permission android:name="com.android.vending.BILLING"/>
    <uses-feature android:name="android.software.vr.mode" android:required="false"/>
    <uses-feature android:name="android.software.vr.high_performance" android:required="false"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <application android:allowBackup="true" android:icon="@mipmap/app_icon" android:isGame="true" android:label="@string/app_name" android:theme="@style/UnityThemeSelector">
        <activity android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:label="@string/app_name" android:launchMode="singleTask" android:name="com.unity3d.player.UnityPlayerActivity" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
        </activity>
        <meta-data android:name="unity.build-id" android:value="{build id}"/>
        <meta-data android:name="unity.splash-mode" android:value="0"/>
        <meta-data android:name="unity.splash-enable" android:value="true"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:name="com.unity.purchasing.googleplay.PurchaseActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:enableVrMode="com.google.vr.vrcore/com.google.vr.vrcore.common.VrCoreListenerService" android:name="com.unity.purchasing.googleplay.VRPurchaseActivity" android:theme="@style/VrActivityTheme">
            <intent-filter>
                <action android:name="com.google.vr.vrcore.ACTION_NONE"/>
                <category android:name="com.google.intent.category.DAYDREAM"/>
            </intent-filter>
        </activity>
        <activity android:excludeFromRecents="true" android:exported="false" android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
        <service android:exported="true" android:name="com.google.android.gms.auth.api.signin.RevocationBoundService" android:permission="com.google.android.gms.auth.api.signin.permission.REVOCATION_NOTIFICATION"/>
        <activity android:exported="false" android:name="com.google.android.gms.common.api.GoogleApiActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
        <receiver android:name="com.hippogames.simpleandroidnotifications.Controller"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="true" android:name="com.unity3d.ads.adunit.AdUnitActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="true" android:name="com.unity3d.ads.adunit.AdUnitTransparentActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:name="com.unity3d.ads.adunit.AdUnitTransparentSoftwareActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:name="com.unity3d.ads.adunit.AdUnitSoftwareActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
        <meta-data android:name="com.google.android.gms.games.APP_ID" android:value=" {app id}"/>
        <meta-data android:name="com.google.android.gms.games.unityVersion" android:value=" 0.9.50"/>
        <activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
    </application>
</manifest>

I want to do something with the editor to build same manifest as before/unity cloud build

A: Make a copy of AndroidManifest.xml and place it in the folder.

To use an Android Manifest that you have created outside of Unity,
import your Android Manifest file to the following location:
  Assets/Plugins/Android/AndroidManifest.xml
This overrides the default Unity-created Manifest.

Unity Override Android Manifest


text:
Q: Apache HTTP Server & Flask: Avoid Restarting Python App After Some Time I have a flask server that I run using Apache HTTP Server.
The python program starts by loading a lot of files into memory (takes about 10 minutes) and then serves some REST API.
Everything works well for some time but after a day or so (or some inactivity?), the python program shuts down. When a new request comes in, the program is re-started (so the first request after some time takes 10 minutes). Caches created in the python program are naturally also empty.
This is my /etc/apache2/sites-available/server.conf (I replaced my actual paths with angle brackets):
<VirtualHost *:80>
     # Add machine's IP address (use ifconfig command)
     ServerName <IP here>

     WSGIDaemonProcess myapp python-home=<path>
     WSGIProcessGroup myapp
     WSGIApplicationGroup %{GLOBAL}

     # Give an alias to to start your website url with
     WSGIScriptAlias <some alias> <path to wsgi>
     <Directory <dir>>
             # set permissions as per apache2.conf file
            Options FollowSymLinks
            AllowOverride None
            Require all granted
     </Directory>
     ErrorLog ${APACHE_LOG_DIR}/error.log
     LogLevel warn
     CustomLog
</VirtualHost>

This is my wsgi file found under <path to wsgi>:
#! /usr/bin/python3111

import logging
import sys
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0, '<python application root>')
from flask_server import app as application
application.secret_key = 'anything you wish'

I gues I am missing some configuration line that keeps the python program alive for ever...?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to keep only strings which follows a specific form in a list (Python) i have a corpus text extracted from pdf file defined in this list below
list=["7.1 PLAN COST MANAGEMENT",'Plan Cost Management is the process of defining how the project costs will be estimated','7.1.1 PLAN COST MANAGEMENT: INPUTS','Described in Section 4.2.3.1. The project charter provides the preapproved financial ','7.1.1.1 PROJECT CHARTER']

However , i wanted to extract only the titles found in this list which owns a specific form as shown in the example [(d.d.d.d + upper case title) or (d.d.d + upper case title) or (d.d + upper case title)] & getting rid of the rest. I don't really know how to encounter this properly.
Any help is appreciated

A: This is a perfect use case for regular expressions.  Here's some code to do what you're asking:
import re

list = ["7.1 PLAN COST MANAGEMENT",
        'Plan Cost Management is the process of defining how the project costs will be estimated',
        '7.1.1 PLAN COST MANAGEMENT: INPUTS',
        'Described in Section 4.2.3.1. The project charter provides the preapproved financial ',
        '7.1.1.1 PROJECT CHARTER']

exp = re.compile(r"(\d+(\.\d+){1,3}) +([A-Z :]+)")

for x in list:
    m = exp.match(x)
    if m:
        print(m.group(0))

Result:
7.1 PLAN COST MANAGEMENT
7.1.1 PLAN COST MANAGEMENT: INPUTS
7.1.1.1 PROJECT CHARTER

You weren't clear about what constitutes a valid "upper case title".  This solution assumes that the ':' character and whitespace are valid characters in a title. You can adjust what's inside the square braces in the expression to tweak what you do or do not want to consider valid characters in titles.

A: Try this solution, it gives the exact result you want
rx=re.compile(r'(\d+\.){1,3}\d+ [A-Z|\s|A-Z]+(\d+)?\n')


text:
Q: call method of dialog from other activity i have problem that i cannot call dialog method from another activity, the dialog get user input into sharedprefrnces
here my activity that i want check if theres stored sharedprefernce if not exist i want the dialog appear to get the user input and after i click ok its continue running the main activity
here the main
public class main extends Activity {

private Button button;
private EditText CardNumber;

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);
    checkid();

        }
    });
}
public void checkid(){
 File f = new File(
            "/data/data/com.example.ahmed_samir.enjaz/shared_prefs/MyPrefs.xml");
if (f.exists())
    Toast.makeText(OpreatorMobily.this, "exist:", Toast.LENGTH_LONG).show();
else {

  NationalId na= new NationalId();
    na.dialogmethod();

}

}
}

and here my second activity of dialog
public class NationalId extends Activity {

public static final String MyPREFERENCES = "MyPrefs";
public static final String Name = "nameKey";
SharedPreferences sharedpreferences;

final Context context = this;
private Button button;
private TextView result;

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_national_id);
    dialogmethod();
    // components from main.xml
    button = (Button) findViewById(R.id.button1);
    result = (TextView) findViewById(R.id.tv1);
    sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);

    // add button listener
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {

            dialogmethod();

        }

    });

}

public   void  dialogmethod(){
    LayoutInflater li = LayoutInflater.from(context);
    View promptsView = li.inflate(R.layout.prompts, null);

    android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(
            context);

    // set prompts.xml to alertdialog builder
    alertDialogBuilder.setView(promptsView);

    final EditText userInput = (EditText) promptsView
            .findViewById(R.id.editTextDialogUserInput);

    alertDialogBuilder
            .setCancelable(false)
            .setPositiveButton("OK",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            String n = userInput.getText().toString();
                            SharedPreferences.Editor editor = sharedpreferences.edit();
                            editor.putString(Name, n);
                            editor.commit();
                            // edit text
                            result.setText(userInput.getText());

                            Toast.makeText(NationalId.this, "saved:" + n, Toast.LENGTH_LONG).show();

                        }
                    })
            .setNegativeButton("Cancel",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.cancel();
                        }
                    });

    // create alert dialog
    android.app.AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();

}

}

A: You should not do this. A possible solution is to create a separate class which contains a static method for your dialog.
So in your activity you can call it like this:
Dialog myDialog = CustomDialog.createDialog(this);
myDialog.show();

Inside the static method:
public static Dialog createDialog(Context context) {
    Dialog dialog = new Dialog(this);
    //do all the initialization stuff

    //return the dialog
    return dialog;
}


text:
Q: R-CNN: looking for REPO where FC for classification is retrainable I'm studying different object detection algorithms for my interest.
The main reference are Andrej Karpathy's slides on object detection slides here.
I would like to start from some reference, in particular something which allows me to directly test some of the network mentioned on my data (mainly consisting in onboard cameras of car and bike races).
Unfortunately I already used some pretrained network (repo forked from JunshengFu one, where I slightly adapt Yolo to my use case), but the classification accuracy is rather poor, I guess because there were not many training instances of racing cars like Formula 1.
For this reason I would like to retrain the networks and here is where I'm finding the most issues:
properly training some of the networks requires either hardware (powerful GPUs) or time I don't have so I was wondering whether I could retrain just some part of the network, in particular the classification network and if there is any repo already allowing that.
Thank you in advance

A: That is called fine-tuning of the network or transfer-learning. Basically you can do that for any network you find (having similar problem domains of course), and then depending on the amount of the data you have you will either fine-tune whole network or freeze some layers and train only last layers. For your case you would probably need to freeze whole network except last fully-connected layers (which you will actually replace with new ones, satisfying your number of classes), which perform classification. I don't know what library you use, but tensorflow has official tutorial on transfer-learning. However it's not very clear tbh.
More user-friendly tutorial you can find here by some enthusiast: tutorial. Here you can find a code repository as well. One correction you need thou is that the author performs fine-tuning of the whole network, while if you want to freeze some layers you will need to get list of the trainable variables and remove those you want to freeze and pass the resultant list to the optimizer (so he ignores removed vars), like following:
all_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,scope='InceptionResnetV2')
to_train = all_vars[-6:] // you better specify them by name explicitely, but this still will work
optimizer = tf.train.AdamOptimizer(lr=0.0001)
train_op = slim.learning.create_train_op(total_loss,optimizer, variables_to_train=to_train)

Further, tensorflow has a so called model zoo (bunch of trained models you can use for your purposes and transfer-learning). You can find it here.


text:
Q: Can you prove that average cost of n insertions to BST/AVL/Splay tree can't be lower than nlog(n)? I'm curious if you guys know an answer to this question that came to my mind.
We know that an average cost of BST insertion is O(log n) and worst case as well as average for AVL/Splay is O(log n).
Since we are inserting n times (basically we are building a tree) we will recieve the final cost being n*logn.
How can we prove that we can't get lower than that? It's easy to observe but kind of hard to prove.
Maybe we can use recursive equations and somehow limit them?
Thanks in advance.

A: As a hint, you can do an inorder traversal of any binary search tree in time O(n) to retrieve the elements of that BST in sorted order.
The algorithms for inserting into a red/black tree, AVL tree, splay tree, etc. are all comparison-based and work by comparing the newly-inserted element to a sequence of other elements in the tree. What would happen if you were able to do this in time o(n log n) (using little-o notation)?


text:
Q: How old is the morphing technology in Animorphs? In the Animorphs book (and shortly-lived television) series, the ability to morph into animals is conferred via touching an Escafil Device, a blue cube named for its Andalite creator.
However, the books are inconsistent in regards to the age of the technology; it's both regarded as new territory and yet it's also said that Andalites have already spent their lives mastering a few forms for the sake of subterfuge.
Just how old is the Escafil Device technology?

A: Per @Probst's comment, It's possible the Andalites simply have a different idea of what constitutes "new technology" than we do.  Recall that Aximili is stunned when he discovers that it only took humans less than 70 years to get from primitive flying machines to landing a human on our moon--the Andalites may simply develop technology much more slowly than we do, so that a technology "only" a couple of generations old still seems new to them.

A: The Hork-Bajir Chronicles, Chapter 2 header:

Andalite date: year 8563.5
Yeerk date: Generation 686, early-cycle
Hork-Bajir date: late-cool
Earth date: 1968

The Hork-Bajir Chronicles, Chapter 7 (Page 39 in my book):

<Yes.  Dak... I am going to become a chadoo.>
He had no answer to that.  I wasn't surprised.  The morphing technology is so new that there are even Andalites who doubt its safety or usefulness.  Fortunately, I had a friend back on the home world whose mother was one of the designers of the Escafil Device.  She had shown it to me.  I'd used it.

#34, The Prophecy, Chapter 6 (Page 36/37 in my book):

"Aldrea, don't say anything for a moment.  Just listen.  Let me explain," I said softly.  When I felt her acceptance, I rushed on.  "You were brought to this planet because there is a colony of free Hork-Bajir here.  Your grandson, Jara Hamee, is part of the colony.  So is your great-granddaughter, Toby Hamee."

(Some other relational ties are also known, to give an idea of lifespans:  Andalite War-Prince Alloran-Semitur-Corrass was alive and active in The Hork-Bajir Chronicles, was disgraced due to the events of said book, and later trained Elfangor and Arbron.  The Yeerk that would come to be known as Visser Three (by possessing Alloran's body) was also born at the start of The Hork-Bajir Chronicles.)
#18, The Decision, Chapter 24 (Page 136 in my book):

<We have few Andalites here on the planet now.  And none who possess the wide array of morphs you have,> Galuit explained.  <All Andalite warriors are morph-capable.  But few acquire morphs or use them.  That is mostly done by our people in intelligence.  Spies.  But you four may be able to penetrate the Yeerk forces.>

It took 5 years (1996 - 2001) to publish the series, and I vaguely remember a statement from one of the last few books that says that's roughly the same amount of time the Animorphs had been fighting the Yeerks. So since The Decision was published in 1998, that's presumably the year it takes place.
The above makes the Escafil Device around 30 years old during the series - likely to be one single Andalite generation, given the known relationships above.
Lastly, according to Galuit, Andalites don't morph very often - and those that do shouldn't be caught anyway.  So non-Andalites are unlikely to have seen the morphing technology, making it "new" to most of them.  And the way Galuit phrases his statements, I'm under the impression that the morphing ability also isn't well-known in the civilian population.


text:
Q: JSF threw exception java.lang.StackOverflowError I have a StackOverflowError My environment Sping 3.2.0, JSF 2.1.9.
I'm using a OneMenuList with a converter, and after the return of the converter when I debug I had this exception java.lang.StackOverflowError in Phases.class.
Phases.class :
    try {
        handleBeforePhase(context, listeners, event);
        if (!shouldSkip(context)) {
            execute(context);
        }
    } catch (Throwable e) {
        queueException(context, e);
    }

I started to receive the following error when trying to render a JSF page. Anyone have any thoughts ?
Converter :
@Component
@FacesConverter(value = "programmeConverter")
public class ProgrammeConverter implements Converter {

@Autowired
@RmiClient
private IProgrammeService programmeService;

@Override
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
    if (arg2 == null || arg2.isEmpty()) {
        return null;
    }

    String programme = arg2;
    Long value = Long.valueOf(programme);
    ProgrammeDto result = new ProgrammeDto();
    result = programmeService.findById(value);
    return result;
}

@Override
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {

    if (arg2 == null) {
        return "";
    }
    if(arg2 instanceof ProgrammeDto) {
        if (((ProgrammeDto) arg2).getIdProgramme() == null) {
            return "";
        }
    }

    ProgrammeDto programme = new ProgrammeDto();

    if(arg2 instanceof ProgrammeDto) {

        programme = (ProgrammeDto) arg2;
        String codeProgramme = programme.getIdProgramme().toString();
        return (codeProgramme != null) ? String.valueOf(codeProgramme) : null;
    } else throw new ConverterException("Something wrong!" + arg2.hashCode() + arg2.toString());

}
}

Controler :
@Component
@Scope("session")
public class ProgrammeController implements Serializable {

/**
 *
 */
private static final long serialVersionUID = 2L;

private List<ProgrammeDto> listProgrammes = new ArrayList<ProgrammeDto>();

private ProgrammeDto selectedProgramme = new ProgrammeDto();
private ProgrammeDto programme = new ProgrammeDto();

@Autowired
@RmiClient
private IProgrammeService programmeService;

public String init(){
    actualize();
    return "/views/programme/listeProgramme?faces-redirect=true";
}

public void actualize(){
    selectedProgramme = new ProgrammeDto();
    listProgrammes = programmeService.findAll();
}

public String createDemnade(){
    prepareDtoBeforeSave();
    ProgrammeDto programmeCreatedId = programmeService.create(programme);
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("New Tiers Created : " + programmeCreatedId));
    return "/views/programme/newProgramme?faces-redirect=true";
}

protected void prepareDtoBeforeSave() {

}

public void getProgrammeByCode(){

}

/**
 * @return the listProgrammes
 */
public List<ProgrammeDto> getListProgrammes() {
    if (listProgrammes == null) {
        listProgrammes = new ArrayList<ProgrammeDto>();
    }
    return listProgrammes;
}

/**
 * @param listProgrammes the listProgrammes to set
 */
public void setListProgrammes(List<ProgrammeDto> listProgrammes) {
    this.listProgrammes = listProgrammes;
}

/**
 * @return the selectedProgramme
 */
public ProgrammeDto getSelectedProgramme() {
    ProgrammeDto programme = new ProgrammeDto();
    programme = selectedProgramme;
    return programme;
}

/**
 * @param selectedProgramme the selectedProgramme to set
 */
public void setSelectedProgramme(ProgrammeDto selectedProgramme) {
    this.selectedProgramme = selectedProgramme;
}
}

View :
                <!-- Programme -->
                <p:fieldset legend="Programmes" toggleable="true" toggleSpeed="500"
                    style="margin-left: 10px; margin-top: 30px; background-color:RGB(225,240,233)">

                    <p:commandButton value="Choisir programme" oncomplete="dlg.show()"
                        update="choixProgramme"
                        actionListener="#{programmeController.init}" />

                    <p:dialog header="TMA Programmes" modal="true" showEffect="fade"
                        hideEffect="fade" widgetVar="dlg" width="800px">
                        <p:fieldset legend="Programme" toggleable="true"
                            toggleSpeed="500" style="margin-left: 10px; margin-top: 30px">

                            <h:panelGrid columns="2" cellpadding="10">
                                <h:outputText value="Choisir un programme" />
                                <p:selectOneMenu id="choixProgramme"
                                    converter="#{programmeConverter}"
                                    value="#{programmeController.selectedProgramme}">
                                    <f:selectItem itemLabel="Choisir un programme"
                                        itemValue="#{null}" noSelectionOption="true" />
                                    <f:selectItems value="#{programmeController.listProgrammes}"
                                        var="programme" itemLabel="#{programme.codeProgImmobilier}"
                                        itemValue="#{programme}" />
                                    <p:ajax update="dataTableBien" />
                                </p:selectOneMenu>
                            </h:panelGrid>

                            <p:dataTable id="dataTableBien" var="bien"
                                resizableColumns="true" liveResize="true" paginator="true"
                                value="#{programmeController.selectedProgramme.biens}"
                                rows="10" scrollable="false" style="width: 100%"
                                rowKey="#{bien.idBien}" selectionMode="single"
                                selection="#{demandeController.selectedBien}"
                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                rowsPerPageTemplate="5,10,15">

                                <p:ajax event="rowSelect" oncomplete="dlg.hide()"
                                    update=":editDemandesForm:programmeShow :editDemandesForm:acquereurShow" />

                                <p:column headerText="N° de Lot" style="width: 100px">
                                    <h:outputText value="#{bien.numLotCommercial}" />
                                </p:column>

                                <p:column headerText="Nom de l'acquéreur" style="width: 100px">
                                    <h:outputText value="#{bien.idAcquereur.nomAcquereur}" />
                                </p:column>

                            </p:dataTable>
                        </p:fieldset>

                    </p:dialog>

                    <h:panelGroup id="programmeShow">
                        <h:panelGrid columns="5" cellpadding="10">
                            <h:outputText value="Programme" style="font-weight:bold" />
                            <h:outputText
                                value="#{demandeController.selectedBien.idProgramme.codeProgImmobilier}" />
                            <h:outputText
                                value="#{demandeController.selectedBien.idProgramme.nomCommercial}" />
                            <h:outputText value="Numéro Lot" style="font-weight:bold" />
                            <h:outputText
                                value="#{demandeController.selectedBien.numLotCommercial}" />
                        </h:panelGrid>
                        <h:panelGrid columns="3" cellpadding="10">
                            <h:outputText value="Nom Juridique" style="font-weight:bold" />
                            <h:outputText
                                value="#{demandeController.selectedBien.idProgramme.formeJuridiqueEntitee}" />
                            <h:outputText
                                value="#{demandeController.selectedBien.idProgramme.nomJuridique}" />
                        </h:panelGrid>
                    </h:panelGroup>

                </p:fieldset>


text:
Q: Three monitors, clicks on right monitor triggers on left monitor (and vice versa) I just installed Ubuntu 19 alongside Windows 10 on my PC again. I have three monitors. One 16:9 in the middle and 16:10 on the left and right . When I put all of them in the right order (1 on the left, 2 in the middle, 3 on the right; which should be correct according to device names shown) It displays a 1 on the right monitor and a 3 on the left though (those icons in the top left) If I move my cursor to the right, the cursor is on the right screen, but all clicks trigger on the left screen. If my cursor is on the left screen, clicks trigger on the right screen. Flipping the two around in the Settings makes clicks trigger on the correct monitor, but moving my cursor to the left, makes it appear on the right obviously. How can I fix this? I had it working on a previous Ubuntu 19 Installation from the same ISO.
So tl/dr: Monitors seem to be aligned the right way in System Settings however they are flipped (all contents) besides the mouse.

A: You need to install Nvidia drivers.
However, there have been some problems with these drivers, and the 5.3 kernel found in Ubuntu 19.xx.
The drivers found in Software & Updates are probably older Nvidia drivers.
Go to https://www.geforce.com/drivers and download/install version 440.44, (from Dec 11, 2019) of these drivers.


text:
Q: Rails3 localization with views? haven't found anything about localized views in rails3. what do i need to get views like
index.en.html.erb
index.de.html.erb

working? how to set the routes?
thanks!

A: Your own settings in your config/application.rb file will provide the default locale (it's en if not set, so that index.en.html.erb view will already work right now).
The only thing you need to do is to provide some mechanism for your users to select/change their locale, either something manual that the user triggers eg. a link on your pages that allows them to change languages or something more automatic, eg. the user's language preferences in their profile/session or something like that.
Either way, I strongly recommend using a subdomain - it's simple to set up, stays put once you've set it up, and allows a user to send their own language link to others without having to do anything special.
Check the Rails Guides, for more on how to do this.


text:
Q: wait() & in partent loop linux #include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

void main(){
   int x,y,status, i;
   int cnt = 0;
   int flag = 0;
   char buf[50];
   char str[50];
   char * argv[10];
   char * ptr;

   for(i=0; i<10; i++){
    printf("$");
    gets(buf);
    strcpy(str, buf);

    ptr = strtok(buf, " ");

    while(ptr != NULL){
      argv[cnt] = ptr;
      cnt++;
      ptr = strtok(NULL," ");
    }

    if(!strcmp(argv[cnt-1], "&")) {
      argv[cnt-1] = 0;
      flag = 1;
    }
    else {
        argv[cnt] = 0;
    }

    if(!strcmp(argv[0],"exit")) exit(0);

    x=fork();

    if (x==0){
        sleep(1);
        printf("I am child to execute %s\n", str);
        y=execve(argv[0], argv, 0);

        if (y<0){
           perror("exec failed");
           exit(1);
        }

    }
    else {
      if(flag == 0) {
          wait(&status);
      }
    }

    flag = 0;
    cnt = 0;
   }
}

I want to exec background with '&'
like real linux shell
so I divied
   else {
      if(flag == 0) {
          wait(&status);
      }
    }

like this
so it works well
if I enter /bin/ls (without &)
prompt $ is placed after /bin/ls
and if I enter /bin/ls & (with &)
then prompt $ is placed before /bin/ls
but rewrite /bin/ls (without &) like first time I entered
then prompt $ is placed before /bin/ls
why?
===============

$/bin/ls
I am child to execute /bin/ls
ch f1 f2 shell shell.c t t.c test test.c testfile

$/bin/ls &
$I am child to execute /bin/ls &
ch f1 f2 ch f1 f2 shell shell.c t t.c test test.c testfile

$/bin/ls
$I am child to execute /bin/ls
ch f1 f2 shell shell.c t t.c test test.c testfile

================
Is it right?

A: I'd say '$' behavior is expected.
I don't even know how does this code compile. You can't use void main(){ (at least while using gcc). Valid form would be int main() {. Also, you can simplify your code a lot:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

int main() { /*Changed void main()*/
   int x, y, status, i, cnt=0, flag=0; /*Squashed declarations*/
   char buf[50]; /*removed str*/
   char * argv[10], * ptr;
   for(i=0; i<10; i++){
      putchar('$'); /*printf() is overkill. Also, watch out for this!*/
      fgets(buf, 49, stdin); /*49 (null terminator), gets --> fgets*/
      /*strcpy(str, buf); <-- why?*/
      ptr = strtok(buf, " ");
      while(ptr != NULL) {
          argv[cnt++] = ptr;
          ptr = strtok(NULL," ");
      }
      if(!strcmp(argv[cnt-1], "&")) {
          argv[cnt-1] = 0;
          flag = 1;
      } else {
          argv[cnt] = 0;
      }
      if(!strcmp(argv[0],"exit"))
          return 0;
      x=fork();
      if (!x) {
          sleep(1);
          y=execve(argv[0], argv, 0);

          if (y<0) {
              perror("execve failed");
              return 1;
          }

      } else {
          if(!flag) {
              wait(&status);
          }
      }
      flag = 0;
      cnt = 0;
   }
}

You are creating children, and echoing '$' in every case - that makes '$' show up.
After, fork(), '$' is getting displayed once again, even when you are executing process.


text:
Q: Java Synchronizing for Integer values. Cleaning up map that tracks synchronize objects I have a portion of code that needs to be thread safe. It is code that loads and modifies an object from the database based on its ID. I want to avoid synchronizing on just the Integer ID variable, so I am attempting to implement the solution offered in this thread: https://stackoverflow.com/a/659939/3561422
However, I am not creating a cache so I have nothing in place to manage the objects added to the map. I want to avoid a memory leak situation. I have looked into using a WeakHashMap, but that is apparently not thread-safe. I have created a map as follows, but the GC does not appear to be cleaning up the references I create.
 private static Map<Integer, Object> locks = Collections.synchronizedMap(new WeakHashMap<Integer, Object>())

Is there something I am missing here that would make this solution work? Is WeakHashMap actually safe for me to use here?
Some example code:
    public static void mainMethod(Integer id){
        Object lockObject = getMapObject(id);
        synchronized (lockObject) {
            Object dbObj = loadDBObjFromDB(id);
            //Do pre execution checks
            if (dbObj.isInUse()) {
                //fail here
            }
            dbObj.setAsInUseAndCommitToDB();
        }
        actOnObj(dbObj);
}

private static Object getMapObject(final Integer id) {
    locks.putIfAbsent(id, new Object);
    return locks.get(id);
}

Basically, I need to mark something in the database as in use. If another thread comes in and wants to do something on it, it needs to see if it is already in use. If it is, I fail and give the user feedback. I need to lock around loading, checking if it is in use, and updating that it is in use. I would like to use the map to avoid locking on an Integer object

A: I think that what you are looking for here is an implementation of ConcurrentHashSet (there are several out there, I'd look at Guava's). It is the same idea as a ConcurrentHashMap without needing a value (in fact, Guava's is based on ConcurrentHashSet per the documentation). Another alternative is simply doing what you are doing, and only using a single, statically created object as the value (since the value here is irrelevant):
private static final MAP_VALUE = new Object();
private static Object getMapObject(final Integer id) {
    locks.putIfAbsent(id, MAP_VALUE);
    return locks.get(id);
}

For the map, just make it a regular ConcurrentHashMap. No need to worry about weak references or weak hashmaps.


text:
Q: Conditional Statements for 2 Pandas Dataframes I've been having troubles solving the following problem:
I have 2 dataframes in pandas, the first dataframe (df1) is about the fruits I have bought over an entire year, the next dataframe (df2) is about the pricing of the fruits. Now the problem consists that some of the prices for the fruits in the df1 are incorrect. Here's the example:
df1 = pd.DataFrame({'Fruits Bought Over a Year' : ['Apple', 'Apple', 'Apple', 'Apple', 'Orange', 'Watermelon',
                                      'Orange', 'Orange', 'Watermelon', 'Apple', 'Grapes',
                                      'Watermelon', 'Grapes'],
       'Price': [5, 5, 4, 4.5, 3, 7, 2.5, 2, 6, 4, 1, 6, 2]})

df2 = pd.DataFrame({'Fruits' : ['Apple', 'Orange', 'Watermelon', 'Grapes'],
       'Fruits Price': [5, 3, 7, 2]})

What I want to do is to create a formula that can evaluate that if (for example) the apple price in df1 is different than the price in df2, then tell me the difference between the real price in df2 and the incorrect price in df1 and put it in as a new column in df1.
Example: df1 apple costed 6 and the real price in df2 the apple costs only 5, now the difference would be 1, and it will appear as a new column called 'price difference' in df1.

A: You can try the below solution to get the results:

*

*set the index of the df2 as fruits column

df2 = df2.set_index('Fruits')

*convert df2 to the dictionary

di = df2.to_dict('index')

*use the apply method to take the difference using the above dictionary.

df1['price difference'] = df1.apply(lambda row: abs(df1['Price'][row.name] - di[df1['Fruits Bought Over a Year'][row.name]]['Fruits Price']), axis=1)

In the 3rd step, we are taking a difference using the dictionary we created in step 2.


text:
Q: How to set image priority when linking via Facebook for example? You know if you were to post you website into a status or comment on Facebook and it then takes your meta headers and arranges your site title, description etc neatly into a link.
It also uses one of your images randomly on your website as a thumbnail preview. You can of course change before you post the link but I remember reading there was a way to set the priority for your images to appear in this instance. At the minute it just takes the highest image in the code.
Is there a way to do this, can someone give me the code?
Thanks in advance.

A: Not sure about priority but you can set an image by adding an image source meta tag to the head of your document.
<link rel="image_src" href="http://domain.top/yourimage.jpg" />

A: The thumbnails of these images from meta tags are cached on Facebook. The priority is following the rule: higher res images will come first. The idea is from:
How to set priority order to Open Graph images for links that are inserted in comments. (Not sharing or wall posts.)
Hope it will help.


text:
Q: Where is the Spring jar file located? I'm trying to install Spring Boot using Maven. I use IntelliJ Community Edition (that doesn't have a built-in support for Spring). Therefore, I entered here: http://start.spring.io/, and downloaded an initial Spring Boot project for Maven. The first thing I did is running "install" in order to install the dependencies.
When the installation completed, I looked at the Java file inside src/main/java folder:
package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

I get errors: "Can't resolve symbol springframework/SpringApplication". I understand that these errors show, as my Spring jar file is not included in the classpath.
My question is where is this file located, so I can add it to the classpath?
My pom.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

I have only one jar file in the target directory:
$ ls target/*.jar
target/demo-0.0.1-SNAPSHOT.jar

A: I finally found it under:
~/.m2/repository/org/springframework/


text:
Q: Flutter new phone authentication now do "not a robot" check in seperate browser which make entire procedure slow I solved this issue (App crashes upon phone authentication after changing package name - Flutter) of app crash by adding implementation "androidx.browser:browser:1.2.0"  into app/build.gradle dependencies.
But NOW whole phone authentication procedure got changed. Now app open a browser to do Not a robot test. But I don't want app to open a browser just to verify it's not a robot it make entire process slow and ugly. Below is the video example. How to get rid of this issue? It shows app firebase address in the browser link too.
Video example of issue is below
https://drive.google.com/file/d/1G7noQWyyAHvyTo_Te0v6d2O3IvaiClAw/view?usp=sharing
Below is the code snippet of verifyPhone function.
  Future<dynamic> verifyPhone(phoneNo, BuildContext context) async {
    var completer = Completer<dynamic>();
    dynamic newUserResult;

    Future<String> getOTPresult() async {
      print("Dialog shown");
      await showModalBottomSheet(
        context: context,
        backgroundColor: Colors.transparent,
        builder: (context) => Container(
          height: 270,
          child: OTPBottomSheet(controller: _otpController),
        ),
      );
      return _otpController.text;
    }

    //  >>>>>>>>>>>>> On Complete

    final PhoneVerificationCompleted verificationComplete =
        (AuthCredential authCred) async {
      print(" I N S I D E   C O M P L E T E ");
      newUserResult = await signInWithPhoneNumber(authCred);
      completer.complete(newUserResult);
    };

    //  >>>>>>>>>>>>> On Timeout

    final PhoneCodeAutoRetrievalTimeout autoRetrieve = (String verID) {
      print("\n2. Auto retrieval time out");
      completer.complete(newUserResult);
    };

    // >>>>>>>>>>>>>  On manual code verification

    final PhoneCodeSent smsCodeSent =
        (String verID, [int forceCodeResend]) async {
      print(" I N S I D E   C O D E   S E N T");
      var OTPDialogResult = await getOTPresult();
       if (OTPDialogResult != null) {
        AuthCredential authCred = PhoneAuthProvider.credential(
            verificationId: verID, smsCode: OTPDialogResult);
         newUserResult = AuthService().signInWithPhoneNumber(authCred);
        if (!completer.isCompleted) {
          completer.complete(newUserResult);
        }
      }
    };

      //  >>>>>>>>>>>>> On Ver failed

      final PhoneVerificationFailed verificationFailed =
        (Exception authException) {
       completer.complete(newUserResult);
    };

    await FirebaseAuth.instance
        .verifyPhoneNumber(
          phoneNumber: phoneNo,
          timeout: Duration(seconds: 50),
          verificationCompleted: verificationComplete,
          verificationFailed: verificationFailed,
          codeSent: smsCodeSent,
          codeAutoRetrievalTimeout: autoRetrieve,
        ).catchError((error) {
      print(error.toString());
    });

    print("New user result at the end before await: " + newUserResult.toString());
    newUserResult = await completer.future;
    print("New user result at the end after await: " + newUserResult.toString());
    return newUserResult;
  }

signInWithPhoneNumber function

  Future signInWithPhoneNumber(AuthCredential authCreds) async {
    try {
      UserCredential result = await FirebaseAuth.instance.signInWithCredential(authCreds);
      User customUser = result.user;
    return _userFormFirebaseUser(customUser).getuid;
  }

  CustData _userFormFirebaseUser(User user) {
    print("----> Inside _userFormFirebaseUser and user ID: " + user.uid);
    return user != null
        ? CustData(
            custId: user.uid,
          )
        : null;
  }

// --- CustData  model class

class CustData {
  String custId;
  String custName;
  String custPhNo;
  String custContactNO;
  DateTime custDateOfBirth;
  Map<String, dynamic> address;
  String cartID;
  CustData({
    this.custId,
    this.custName,
    this.custPhNo,
    this.custDateOfBirth,
    this.address,
    this.cartID,
    this.custContactNO,
  });

  CustData.initial() : custId = '';
  String get getuid => this.custId;
}

A: Already making the whole procedure slow...
Try this Auth Version and it will work well for you :)
implementation com.google.firebase:firebase-auth:19.3.1

A: The reason behind this is explained in the official documentation https://firebase.google.com/docs/auth/android/phone-auth#enable-app-verification
reCAPTCHA verification: In the event that SafetyNet cannot be used, such as when the user does not have Google Play Services support, or when testing your app on an emulator, Firebase Authentication uses a reCAPTCHA verification to complete the phone sign-in flow. The reCAPTCHA challenge can often be completed without the user having to solve anything. Please note that this flow requires that a SHA-1 is associated with your application.

To solve it you have to :

*

*In the Google Cloud Console, enable the Android DeviceCheck API for your project. The default Firebase API Key will be used, and needs to be allowed to access the DeviceCheck API.

*If you haven't yet specified your app's SHA-256 fingerprint, do so from the Settings Page of the Firebase console. Refer to Authenticating Your Client for details on how to get your app's SHA-256 fingerprint.


text:
Q: Swift textview scrollRangeToVisible is not working inside textFieldDidBeginEditing I'm building a chat and when I type a message and press send button textview is positioning at the bottom, like I want. But when I dismiss keyboard and click to type another message the textview is positioning at the top, I would like at the bottom. I try to put scrollRangeToVisible inside textFieldDidBeginEditing but is not working.
Follow the code:
@IBAction func sendMessage(_ sender: AnyObject) {
    let date = NSDate()
    let calendar = NSCalendar.current
    let components = calendar.dateComponents([.hour, .minute], from: date as Date)
    let complement = "Sender (" + String(describing: components.hour!) + ":" + String(describing: components.minute!) + ") "
    self.chatTextView.text = (self.chatTextView.text)! + complement + self.textMessage.text! + "\n\n"
    self.textMessage.text = ""
    chatTextView.resignFirstResponder()
    let stringLength:Int = self.chatTextView.text.characters.count
    self.chatTextView.scrollRangeToVisible(NSMakeRange(stringLength-1, 0))
}

 func textFieldDidBeginEditing(_ textField: UITextField) {
    scrollView.setContentOffset(CGPoint(x:0,y:250),animated: true)
    heightChatTextConstraint.constant = heightChatTextConstraint.constant - 250
    let stringLength:Int = self.chatTextView.text.characters.count
    self.chatTextView.scrollRangeToVisible(NSMakeRange(stringLength-1, 0))
}

func textFieldDidEndEditing(_ textField: UITextField) {
    scrollView.setContentOffset(CGPoint(x:0,y:0),animated: true)
    heightChatTextConstraint.constant = heightChatTextConstraint.constant + 250
}

Follow image working fine (when I type one message after another without dismiss keyboard):

Follow image not working (After I dismiss keyboard and click to type a new message, textview is not going to the bottom):


text:
Q: How do you integrate the Lorentz factor over a path between two points? How do you integrate the Lorentz factor over a path between two points, where the velocity changes between the two points over that path?
Something like $$γ_{\text{total}} = ∫ γ \,dx = ∫ \frac{1}{\sqrt{1 - v^2/c^2}}  dx$$


text:
Q: pushing rails 4 app to heroku epic fail Pushing this rails 4 app to heroku. Any help is appreciated. App is copied straight from Lynda.com Ruby on Rails 4 Essential Training Exercise files zip. I read other posts and removed the gemfile.lock then ran bundle install but it didn't many any difference. There shouldn't be a problem? Thanks anyway
ggeorgiev@ubuntu:~/projects/simple_cms_4$ git push heroku master
Initializing repository, done.
Counting objects: 173, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (161/161), done.
Writing objects: 100% (173/173), 47.04 KiB, done.
Total 173 (delta 31), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.5.2
   New app detected loading default bundler cache
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
   Fetching gem metadata from https://rubygems.org/.........
   Fetching additional metadata from https://rubygems.org/..
   Using rake (10.1.0)
   Using minitest (4.7.5)
   Using tzinfo (0.3.37)
   Using builder (3.1.4)
   Using erubis (2.7.0)
   Using rack (1.5.2)
   Installing multi_json (1.7.7)
   Using polyglot (0.3.3)
   Using activerecord-deprecated_finders (1.0.3)
   Installing mime-types (1.23)
   Using bcrypt-ruby (3.0.1)
   Using hike (1.2.3)
   Using json (1.8.0)
   Installing arel (4.0.0)
   Using bundler (1.5.2)
   Using thor (0.18.1)
   Using tilt (1.4.1)
   Using rack-test (0.6.2)
   Installing treetop (1.4.14)
   Using rdoc (3.12.2)
   Using sprockets (2.10.0)
   Using mail (2.5.4)
   Using sdoc (0.3.20)
   Installing i18n (0.6.4)
   Installing atomic (1.1.10)
   Installing thread_safe (0.1.2)
   Installing activesupport (4.0.0)
   Installing activemodel (4.0.0)
   Installing actionpack (4.0.0)
   Installing activerecord (4.0.0)
   Installing actionmailer (4.0.0)
   Installing railties (4.0.0)
   Installing sprockets-rails (2.0.0)
   Installing acts_as_list (0.3.0)
   Installing rails (4.0.0)
   Installing mysql2 (0.3.13)
   Your bundle is complete!
   Gems in the groups development and test were not installed.
   It was installed into ./vendor/bundle
   Bundle completed (17.99s)
   Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   I, [2014-01-22T13:17:44.812043 #1278]  INFO -- : Writing /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/public/assets/footer_gradient-4f04310658a469a35a8014a13e9e1fff.png
   I, [2014-01-22T13:17:44.816570 #1278]  INFO -- : Writing /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/public/assets/plus_sign-d0a969825c4cf5d10c388d8449c717c0.png
   rake aborted!
   couldn't find file 'jquery'
   (in /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/app/assets/javascripts/application.js:13)
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:106:in `resolve'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:146:in `require_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/directive_processor.rb:217:in `process_require_directive'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/directive_processor.rb:167:in `block in process_directives'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/directive_processor.rb:165:in `each'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/directive_processor.rb:165:in `process_directives'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/directive_processor.rb:99:in `evaluate'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:197:in `block in evaluate'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `each'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `evaluate'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:12:in `initialize'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `new'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `block in build_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:395:in `circular_call_protection'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:373:in `build_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `new'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `build_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `block in compile'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `each'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
   /tmp/build_8a07d45d-d10f-448a-9d51-c50b5e9fdd7c/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
   Tasks: TOP => assets:precompile
   (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:intense-tor-3783.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:intense-tor-3783.git'
ggeorgiev@ubuntu:~/projects/simple_cms_4$

A: It's trying to compile your assets without access to jQuery. You need to uncomment/add gem 'jquery-rails' to your Gemfile. If you haven't already, Heroku also recommends adding gem 'rails_12factor'.


text:
Q: How to update the marker whenever user touch on screen? public void pointLocation(){
    if(gmap!=null){
    gmap.setOnMapLongClickListener(new OnMapLongClickListener() {

        @Override
            public void onMapLongClick(LatLng latlng) {
                // TODO Auto-generated method stub
                double lat = latlng.latitude;
                double lng = latlng.longitude;
                mVisible=gmap.addMarker(new MarkerOptions().position(new LatLng(lat, lng)));
                Toast.makeText(getApplicationContext(), "Latitude :"+" "+lat+"Longitude :"+" "+lng, Toast.LENGTH_LONG).show();
            }
        });
    mVisible.setVisible(false);//marker setVisible off so that old marker get destroy and new get appear
    }
}

A: package com.sample;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Window;
import android.widget.Toast;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.sample.R;

public class MainActivity extends FragmentActivity {

    GoogleMap gmap;
    // GPSTracker gpsTracker;
    SupportMapFragment mapFragment;
    Marker mVisible;

    boolean checkCall = true;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.selectlocation);

        // gpsTracker = new GPSTracker(this);
        mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.maplocation);

        userPosition();

        pointLocation();
    }

    public void userPosition() {
        gmap = mapFragment.getMap();
        if (gmap != null) {
            // if (gpsTracker.canGetLocation()) {
            // double latCurrentloc = gpsTracker.getLatitude();
            // double lngCurrentloc = gpsTracker.getLongitude();
            LatLng pointer = new LatLng(17.2145632, 8.2345876);
            gmap.addMarker(new MarkerOptions().position(pointer).title(
                    "Hello world"));
            CameraPosition cameraPosition = new CameraPosition.Builder()
                    .target(pointer).zoom(12).build();
            gmap.animateCamera(CameraUpdateFactory
                    .newCameraPosition(cameraPosition));
            // }
        }
    }

    public void pointLocation() {
        if (gmap != null) {
            // mVisible.setVisible(true);

            gmap.setOnMapLongClickListener(new OnMapLongClickListener() {
                @Override
                public void onMapLongClick(LatLng latlng) {
                    if (checkCall) {

                        double lat = latlng.latitude;
                        double lng = latlng.longitude;
                        mVisible = gmap.addMarker(new MarkerOptions()
                                .position(new LatLng(lat, lng)));
                        Toast.makeText(
                                getApplicationContext(),
                                "Latitude :" + " " + lat + "Longitude :" + " "
                                        + lng, Toast.LENGTH_LONG).show();

                        checkCall = false;
                    }
                }
            });

        }
    }
}


text:
Q: How can I stream music I have in my Ubuntu One account to Subsonic in my Android smartphone? How can I stream music I have in my Ubuntu One account to Subsonic in my Android smartphone?
The Android Subsonic app asks me for:

*

*Server address

*Username

*Password

I want to use my Ubuntu One subscription to stream my music. What information do I have to enter in that fields?
Subsonic have an option to Test connection but it isn't working with the data I populate that fields.

A: You want to use the Ubuntu One Music app almost certainly rather than the full Subsonic client (for several reasons).
In any case, you can get your mobile credentials and then use https://streaming.one.ubuntu.com/ as the endpoint. You can read more on the developer documentation site.


text:
Q: Proper way to load a single post via Ajax? I'm loading single posts via Ajax into a div that I have set up on my index page. Everything is working fine in this regard. I want to use history.js to push/pop the state so if users enter example.com/my-post into the address bar, it loads up the index page with the post already loaded in the div. That is where the problem lies.
This is a simplified version of the function I'm using (the actual also includes a slide):
function my_load_ajax_content () {

    $args = array(
        'p' => $_POST['post_id'],
        'post_type' => 'projects'
        );

    $post_query = new WP_Query( $args );
    while( $post_query->have_posts() ) : $post_query->the_post(); ?>

            <?php the_title( '
', '
' ); ?>
            <?php the_content(); ?>

    <?php
    endwhile;
    wp_die();
}

add_action ( 'wp_ajax_nopriv_load-content', 'my_load_ajax_content' );
add_action ( 'wp_ajax_load-content', 'my_load_ajax_content' );

This is how I'm calling it:
$('.post-link').on('click', function(e) {
    e.preventDefault();

    var post_id = $(this).data('id'), // data-id attribute for .post-link
        projectTitle = $(this).data('title'), // data-title attribute for .post-link
        projectSlug = $(this).data('slug'), // data-slug attribute for .post-link
        ajaxURL = site.ajaxurl; // Ajax URL localized from functions.php

    $.ajax({
        type: 'POST',
        url: ajaxURL,
        context: this,
        data: {'action': 'load-content', post_id: post_id },
        success: function(response) {
            $('#project-container').html(response);
            return false;
        }
    });
});

Here is the loop
<?php $home_query = new WP_Query('post_type=projects');

while($home_query->have_posts()) : $home_query->the_post(); ?>

        <?php the_post_thumbnail( 'home-thumb' ); ?>

            <a class="post-link expand" href="<?php the_permalink(); ?>" data-id="<?php the_ID(); ?>" data-title="<?php the_title(); ?>" data-slug="<?php global $post; echo $post->post_name; ?>">+

<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>

I'm wondering if I'm going about this the wrong way. I'm confused and a part of me is thinking that I should put all the html into my single template and call that from the Ajax function. But then I don't exactly know how that would work either because if the user enters example.com/my-post into their browser, it'll only load the single post without all of the html on the index page. I hope I'm explaining this correctly. Can someone show me how it's done?

A: Here is my view: Load it inside your single.php why use ajax at all?
Google wont be able to see this (using most crawlers).
In any case - here is the right way to return the data...
please note that you can use get_post or wp_query. up tp you.
JS Part:
   jQuery(document).ready(function($) {
    $.post(ajax_object.ajaxurl, {
        action: 'my_load_ajax_content ',
        post_id: post_id  // << should grab this from input...

    }, function(data) {

        var $response   =   $(data);
        var postdata    =   $response.filter('#postdata').html();

        $('.TARGETDIV').html(postdata);
    });
});

PHP Part:
function my_load_ajax_content () {

    $pid        = intval($_POST['post_id']);
    $the_query  = new WP_Query(array('p' => $pid));

    if ($the_query->have_posts()) {
        while ( $the_query->have_posts() ) {
            $the_query->the_post();

            $data = '

'.get_the_title().'

'.get_the_content().'

            ';

        }
    }
    else {
        echo '
'.__('Didnt find anything', THEME_NAME).'
';
    }
    wp_reset_postdata();

    echo '
'.$data.'
';
}

add_action ( 'wp_ajax_nopriv_load-content', 'my_load_ajax_content' );
add_action ( 'wp_ajax_load-content', 'my_load_ajax_content' );

Hope this helps.
again, i wouldnt recommend doing that but... this should work.
REVISION FOR GET POST ON CLICK
first: the button / link - should be something like
<button class="get_project" data-postid="POSTID HERE!">PROJECT NAME</button>

second: the js code listening to a click:
jQuery(function($){

    $('.get_project').click(function() {

        var postid = $(this).attr('data-postid');

        $.post(ajax_object.ajaxurl, {
            action: 'my_load_ajax_content ',
            postid: postid
        }, function(data) {
            var $response   =   $(data);
            var postdata    =   $response.filter('#postdata').html();
            $('.TARGETDIV').html(postdata);
        });

    })

});

The php code needs no changing - just set the data you need.


text:
Q: How to make my Jekyll convert .html.md file? I just installed Jekyll and when I run jekyll on a directory contains some .html.md file. But it didn't convert it into .html file. Jekyll just copied th files into _site directory as is.
I added _config.yml and added
markdown:        maruku

but it still doesn't convert Markdown into HTML.
What should I do more to make it work?

A: A standard mistake that I've seen with new jekyll users (and did myself) was omitting the YAML front matter in the files to be converted. Each one should start with:
---
layout: default
title: Page/Post Title
---

This assumes you have a file in your "_layouts" directory called "default.html".


text:
Q: Mondrian parent-child hierarchy not working Some issues to make mondrian work with a parent-child hierarchy.
My table structure is as follows (simplified, as the Category table is actually a MPTT):
RESPONSE             QUESTION                   CATEGORY
--------------       -------------------        ----------
id             ¡---> identifier (String)  ¡---> id     <---¡
question_id ___|     category_id     _____|     parent_id _|
value (Measure)      title                      name_en

My closure table is a simple setup: child_id, parent_id, distance (with the primary key being the tuple (child_id, parent_id) ).
My cube's schema is as follows:
<Cube cache="true"
    defaultMeasure="Value" enabled="true" name="mycube">

    <Dimension foreignKey="question_id" name="Category">
        <Hierarchy allMemberName="All Categories" hasAll="true"
            primaryKey="identifier" primaryKeyTable="question">
            <Join leftKey="category_id" rightKey="id">

            </Join>

            <Level column="id" name="Category ID"
                nameColumn="name_en" nullParentValue="NULL"
                parentColumn="parent_id" table="category"
                type="Numeric" uniqueMembers="true">

                <Closure childColumn="child_id" parentColumn="parent_id">

                </Closure>
            </Level>
        </Hierarchy>
    </Dimension>
   <Measure aggregator="avg" caption="Value"
        column="actual_value" formatString="#,###.00" name="Value"/>
</Cube>

Now, based on the mondrian FoodMart test pages, I have set up a simple jsp pages for my cube, which I want to use as a starting point for my tests. It has the following MDX:
select {[Measures].[Value]} ON COLUMNS,
 {( [Category] )} ON ROWS
from [mycube]

The result it shows at first is "All Categories". When I try to drill down or hierarchize in the Categories, it returns nothing but [All Categories]. I have tried also with Descendants() to no avail.
Equally, when I try to list the members of Categories, it returns nothing.
I see that in the background it runs a query as follows to start the drilling down:

05/12/13 23:53:10,967 postgres: [3-1] LOG:  execute : select
  "category"."id" as "c0", "category"."name_en" as "c1" from "question"
  as "question", "category" as "category" where "question"."category_id"
  = "category"."id" and "category"."parent_id" IS NULL group by "category"."id", "category"."name_en" order by "category"."id" ASC
  NULLS LAST

Obviously this query has an empty result because it joins question with root-level categories whilst only the leaves of my tree are attached some Questions.
It also shows that the closure table is not used here.
Any clue on what I can do to fix this?
Thanks ahead
lai

A: Following a few experiments, I shall conclude that my use case is probably not supported by Mondrian.
Here is the test I did to come to this conclusion:
- ensure I have 3 levels in my tree (level 0->2)
- create a fake question related to a root category (i.e. whose parent_id = NULL)
- create a response attached to this fake question
- at this stage, only level 0 and level 2 Category records have questions and responses related to them
- go ahead with a query
Here is the result I got in the logs:

14:37:09,082 WARN  [SqlTupleReader] The level [Category].[Name] makes
  use of the 'parentColumn' attribute, but a parent member for key 3 is
  missing. This can be due to the usage of the NativizeSet MDX function
  with a list of members form a parent-child hierarchy that doesn't
  include all parent members in its definition. Using NativizeSet with a
  parent-child hierarchy requires the parent members to be included in
  the set, or the hierarchy cannot be properly built natively.

"key 3" relates to one of my level-2 records i.e. tree leaves (similar messages show for the other level-2 records).
Conclusion: not supported :-(
Enclosing the "working" schema below:
<Schema name="Foo">
    <Cube name="Foo" caption="Cube to report on the Foo quizz dimensions" visible="true" defaultMeasure="Rating" cache="true" enabled="true">

        <Dimension type="StandardDimension" visible="true" foreignKey="question_id" highCardinality="false" name="Category">
            <Hierarchy name="Category" visible="true" hasAll="false" allMemberName="All Categories" primaryKey="identifier" primaryKeyTable="question">
                <Join leftKey="category_id" rightKey="id">

                </Join>
                <Level name="Name" visible="true" table="category" column="id" nameColumn="name" ordinalColumn="tree_id" parentColumn="parent_id" nullParentValue="NULL" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
                </Level>
            </Hierarchy>
        </Dimension>
        <Measure name="Ratings" column="actual_value" formatString="#,###.00" aggregator="avg" caption="Ratings">
        </Measure>
    </Cube>
</Schema>


text:
Q: Problems with finding a "Shared" directory in isolated storage When I use the following code:
var appStorage = IsolatedStorageFile.GetUserStoreForApplication();

string[] listDirectories = appStorage.GetDirectoryNames();

I pull up a directory called "Shared", is there any easy way to ignore this directory, or will I have to define parameters in GetDirectoryNames()?
And also, what is/can the Shared folder be used for?

A: Just remove it from the results:
var appStorage = IsolatedStorageFile.GetUserStoreForApplication();
var listDirectories = appStorage.GetDirectoryNames().Where(l => l != "Shared");

It can be used for example when generating custom images as you live tiles, the images must be stored in this directory.


text:
Q: To copy files from 1 source folder to 2 destination folders based on a criteria I am working on this code which successfully can copy the files from one folder to another folder perfectly using (moveFilesFromListPartial) by reading the names from Excel sheet. However, I need a help in it.
Is it possible if the files should be copied from 1 source folder to two destination folders based on the a criteria defined below.
e.g. 1 have 1 source folder and 2 Destination folders (Destination_1) and (Destination_2). Whatever the names mentioned in Sheet1 cells A1 to A20 should be moved to Destination_2 folder and all remaining files should be moved to Destination_1 folder.

I shall remain thankful
the code i have is mentioned below
Sub moveFilesFromListPartial_A()

    Const sPath As String = "E:\Sourece"
    Const dPath As String = "E:\Destination"
    Const fRow As Long = 2
    Const Col As String = "A"

    ' Reference the worksheet.
    Dim ws As Worksheet: Set ws = Sheet1

    ' Calculate the last row,
    ' i.e. the row containing the last non-empty cell in the column.
    Dim lRow As Long: lRow = ws.Cells(ws.Rows.Count, Col).End(xlUp).Row

    ' Validate the last row.
    If lRow < fRow Then
        MsgBox "No data in column range.", vbCritical
        Exit Sub
    End If

    ' Early Binding - needs a reference
    ' to 'Tools > References > Microsoft Scripting Runtime' (has intelli-sense)
    Dim fso As Scripting.FileSystemObject
    Set fso = New Scripting.FileSystemObject
    ' Late Binding - needs no reference (no intelli-sense)
    'Dim fso As Object: Set fso = CreateObject("Scripting.FileSystemObject")

    ' Validate the source folder path.
    Dim sFolderPath As String: sFolderPath = sPath
    If Right(sFolderPath, 1) <> "\" Then sFolderPath = sFolderPath & "\"
    If Not fso.FolderExists(sFolderPath) Then
        MsgBox "The source folder path '" & sFolderPath _
            & "' doesn't exist.", vbCritical
        Exit Sub
    End If

    ' Validate the destination folder path.
    Dim dFolderPath As String: dFolderPath = dPath
    If Right(dFolderPath, 1) <> "\" Then dFolderPath = dFolderPath & "\"
    If Not fso.FolderExists(dFolderPath) Then
        MsgBox "The destination folder path '" & dFolderPath _
            & "' doesn't exist.", vbCritical
        Exit Sub
    End If

    Dim r As Long ' current row in worksheet column
    Dim sFilePath As String
    Dim sPartialFileName As String
    Dim sFileName As String
    Dim dFilePath As String
    Dim sYesCount As Long ' source file moved
    Dim sNoCount As Long ' source file not found
    Dim dYesCount As Long ' source file exists in destination folder
    Dim BlanksCount As Long ' blank cell

For r = fRow To lRow
    sPartialFileName = CStr(ws.Cells(r, Col).Value)
    If Len(sPartialFileName) > 3 Then ' the cell is not blank
        ' 'Begins with' sPartialFileName
        sFileName = Dir(sFolderPath & sPartialFileName & "*")
        ' or instead, 'Contains' sPartialFileName
        'sFileName = Dir(sFolderPath & "*" & sPartialFileName & "*")
        Do While sFileName <> ""
            If Len(sFileName) > 3 Then ' source file found
                sFilePath = sFolderPath & sFileName
                dFilePath = dFolderPath & sFileName
                If Not fso.FileExists(dFilePath) Then ' the source file...
                    fso.CopyFile sFilePath, dFilePath ' ... doesn't exist...
                    sYesCount = sYesCount + 1 ' ... in the destination
                Else ' the source file exists in the destination folder
                    dYesCount = dYesCount + 1
                End If
            Else ' the source file doesn't exist
                sNoCount = sNoCount + 1
            End If
            sFileName = Dir
        Loop
    Else ' the cell is blank
        BlanksCount = BlanksCount + 1
    End If
Next r

End Sub

A: Copy Files From Lists

*

*Building on the existing procedure would invite multiple complications.

*Splitting the tasks into smaller procedures makes the code more readable and maintainable.

*This doesn't use the FileSystemObject object although it could be easily implemented.

Sub CopyBeginsWith()

    Const sPath As String = "E:\Source"
    Const sUpAddress As String = "A2:A20"
    Const dUpPath As String = "E:\Destination2"
    Const dLowPath As String = "E:\Destination1"

    Dim pSep As String: pSep = Application.PathSeparator

    Dim ws As Worksheet: Set ws = Sheet1

    ' Copy from 1st (upper) range.

    Dim rgUp As Range: Set rgUp = ws.Range(sUpAddress)

    CopyFilesFromRangeBeginsWith rgUp, sPath, dUpPath, pSep

    ' Copy from 2nd (lower) range.

    Dim rgLow As Range: Set rgLow = SetStackedBelowSingleColumnRange(rgUp)
    If rgLow Is Nothing Then Exit Sub ' no data below 1st (upper) range

    CopyFilesFromRangeBeginsWith rgLow, sPath, dLowPath, pSep

End Sub

Sub CopyFilesFromRangeBeginsWith( _
        ByVal rg As Range, _
        ByVal SourcePath As String, _
        ByVal DestinationPath As String, _
        Optional ByVal PathSeparator As String = "\")

    Dim cell As Range
    Dim FilePattern As String

    For Each cell In rg.Cells
        FilePattern = CStr(cell.Value) & "*" ' begins with
        If Len(FilePattern) > 1 Then
            CopyFilesUsingPattern FilePattern, SourcePath, _
                DestinationPath, PathSeparator
        End If
    Next cell

End Sub

Sub CopyFilesUsingPattern( _
        ByVal FilePattern As String, _
        ByVal SourcePath As String, _
        ByVal DestinationPath As String, _
        Optional ByVal PathSeparator As String = "\")

    Dim sFileName As String
    sFileName = Dir(SourcePath & PathSeparator & FilePattern)

    Dim sFilePath As String
    Dim dFilePath As String

    Do While Len(sFileName) > 0
        sFilePath = SourcePath & PathSeparator & sFileName
        dFilePath = DestinationPath & PathSeparator & sFileName
        ' Be aware that the following simplification 'hides' various errors,
        ' when e.g. invalid path, file is open... etc.
        ' i.e. not all files may be copied!
        On Error Resume Next
            FileCopy sFilePath, dFilePath ' overwrites existing files!
        On Error GoTo 0
        sFileName = Dir
    Loop

End Sub

Function SetStackedBelowSingleColumnRange( _
    ByVal SingleColumnRange As Range) _
As Range
' Uses the End property. Be aware of its shortcomings!

    Dim rg As Range: Set rg = SingleColumnRange.Columns(1)
    Dim ws As Worksheet: Set ws = rg.Worksheet

    Dim fCell As Range: Set fCell = rg.Cells(rg.Cells.Count).Offset(1)
    Dim lCell As Range: Set lCell = ws.Cells(ws.Rows.Count, rg.Column).End(xlUp)
    If lCell.Row < fCell.Row Then Exit Function ' empty below first range

    Set SetStackedBelowSingleColumnRange = ws.Range(fCell, lCell)

End Function


text:
Q: this really just nails it
The findings strongly suggest that fast radio bursts could be the result of at least two distinct astrophysical phenomena. "I think this really just nails it that there is a difference," says study co-author Kiyoshi Masui, an astrophysicist at the Massachusetts Institute of Technology in Cambridge.

Source: nature
What does "this" refer to? It is singular, not consistent with whatever previously mentioned ("the findings" and "bursts" are plural).  Perhaps it refers to "the result" - "the result has successfully hit the target"? Just a wild guess.

A: The it that is "being nailed" in the quote is a dummy it. The this in the quote could also be interpreted as a dummy it, or as an implied reference to "the discovery" in a general sense.
There is no reason that the pronoun has to refer to "the findings" or "the result" mentioned in the previous sentence, because it is a quote of something said by a person, not the actual words of the author who wrote the article.


text:
Q: how to return inputBox using groovy (jenkins) I use the jenkins with active choices parameter
I need that groovy depends on my choice return area where I can write something
I try this
if (test_bench_UID.equals('user_spec')) { inputBox = "<input name='value' class='setting-input' type='text'>" return inputBox }

Where test_bench_UID is name active choices parameter, user_spec is parameter after choosing whom groovy should return input box

A: You have to add Active Reactive Reference Parameters, and select the choice type of the "Formatted HTML" field
,
don't forget to select the reference field!), and write such a script     (
if(refParameter.equals("value")){
inputBox = "<input name='value' class='setting-input' type='text'>"
return inputBox
} else return "<b>else value will be show as text</b>"

A: You can use the variable by using ${value}.
In your case may be you can try ${user_spec} where ever you want to access it.
Hope it helps.


text:
Q: Can I use the alias of a derived table as the table reference for comparison subquery? I have been working with MySQL for some time, however still learning best ways to use it.
For practice, I wrote a query to get the most featured film category for every actor in the sakila example database we can get with the workbench for MySQL. The result looks like this:

I get the result with the following query. However, I had to repeat the same query twice, once in the from part of the outer query, and second time in the where part of a subquery.
select  `MCPA`.`first_name` ,`MCPA`.`last_name`,
        group_concat(`MCPA`.`category`) as `most_featured_categories`
    from
    (
        SELECT  AC.first_name as `first_name` ,AC.last_name as `last_name` ,
                CA.`name` as `category` ,
                count( distinct FI.film_id ) as `number_of_movies` ,
                count( distinct FI.film_id ) /
                     fNumber_Of_Films_Per_Actor (AC.first_name, AC.last_name) * 100
                    as `percentage_of_movies_done`
            from  actor as AC
            inner join  film_actor as FIAC  ON AC.actor_id = FIAC.actor_id
            inner join  film as FI  ON FIAC.film_id = FI.film_id
            inner join  film_category as FICA  ON FI.film_id = FICA.film_id
            inner join  category as CA  ON FICA.category_id = CA.category_id
            group by  AC.first_name, AC.last_name, CA.`name`
    ) as `MCPA`
    where  `MCPA`.`number_of_movies` =
    (
        SELECT  max(`SubMCPA`.`number_of_movies`)
            from
            (
                SELECT  AC.first_name as `first_name`, AC.last_name as `last_name`,
                        CA.`name` as `category` ,
                        count( distinct FI.film_id ) as `number_of_movies` ,
                        count( distinct FI.film_id ) /
                             fNumber_Of_Films_Per_Actor (AC.first_name,
                                AC.last_name
                             ) * 100
                           as `percentage_of_movies_done`
                    from  actor as AC
                    inner join  film_actor as FIAC  ON AC.actor_id = FIAC.actor_id
                    inner join  film as FI  ON FIAC.film_id = FI.film_id
                    inner join  film_category as FICA  ON FI.film_id = FICA.film_id
                    inner join  category as CA
                          ON FICA.category_id = CA.category_id
                    group by  AC.first_name, AC.last_name, CA.`name`
            ) as `SubMCPA`
            where  1=1
              and  `MCPA`.`first_name` = `SubMCPA`.`first_name`
              and  `MCPA`.`last_name` = `SubMCPA`.`last_name`
    )
    group by  `MCPA`.`first_name`, `MCPA`.`last_name` ;

I had tried to use
    select max(`SubMCPA`.`number_of_movies`)
    from `MCPA` as `SubMCPA`
    where 1=1
        and `MCPA`.`first_name` = `SubMCPA`.`first_name`
        and `MCPA`.`last_name` = `SubMCPA`.`last_name`

But it didn't work; seems that workbench does not recognize the derived table, and requires me to redefine it.
Do I have some other way to avoid typing the code
    (
        select AC.first_name as `first_name`
            ,AC.last_name    as `last_name`
            ,CA.`name` as `category`
            ,count( distinct FI.film_id ) as `number_of_movies`
            ,count( distinct FI.film_id ) /
                    fNumber_Of_Films_Per_Actor (AC.first_name, AC.last_name) * 100
                  as `percentage_of_movies_done`
        from actor as AC
        inner join film_actor as FIAC
        on AC.actor_id = FIAC.actor_id
        inner join film as FI
        on FIAC.film_id = FI.film_id
        inner join film_category as FICA
        on FI.film_id = FICA.film_id
        inner join category as CA
        on FICA.category_id = CA.category_id
        group by AC.first_name, AC.last_name, CA.`name`
     ) as

twice?
** I have tried to avoid it by first creating a table and then referencing it, however maybe there is some other way?
Moreover seems having all done in one query increases performance.
Any advice would be appreciated, hope my question was clear, I refrained describing all of the database structure to avoid a too tedious question.

A: Does something like this give you the answer?:
select  `MCPA`.`first_name` ,`MCPA`.`last_name`,
        group_concat(`MCPA`.`category`) as `most_featured_categories`
    from
        (  SELECT
               ...
        ) AS MCPA
    ORDER BY MCPA.`number_of_movies` DESC
    LIMIT 1;

For possible added performance, see my tips on many:many tables .


text:
Q: Use curl instead of file_get_contents in function Below my code for loading and storing a xml-feed. Important is also the time-out in case the feed is offline or responds to slow.
Some users do not have file_get_contents enabled. I'm looking for a way to change this to curl or do a check and use the one that is enabled. And not lose the functionality to set a time out. Any ideas?
    function feeder()
    {
    $cache_time = 3600 * 12; // 12 hours
    $cache_file = plugin_dir_path(__FILE__) . '/cache/feed.xml';
    $timedif = @(time() - filemtime($cache_file));
    $fc_xml_options = get_option('fc_xml_options');
    $xml_feed = $fc_xml_options['feed'];

    // remove white space(s) and/or space(s) from connector code

    $xml_feed = str_replace(' ', '', $xml_feed);
    $xml_feed = preg_replace('/\s+/', '', $xml_feed);
    if (file_exists($cache_file) && $timedif < $cache_time)
        {
        $string = file_get_contents($cache_file);
        }
      else
        {
        // set a time-out (5 sec) on fetch feed
        $xml_context = array( 'http' => array(
              'timeout'       => 5,
          ) );
        $pure_context = stream_context_create($xml_context);

        $string = file_get_contents($xml_feed, false, $pure_context);
        if ($f = @fopen($cache_file, 'w'))
            {
            fwrite($f, $string, strlen($string));
            fclose($f);
            }
        }

A: You can use curl to read local file. Just change url to file path prefixed by file://
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "file://full_path_to_file");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // $output contains the output string
    $output = curl_exec($ch);
    curl_close($ch);


text:
Q: Printing out the input of a linked list [C] I wrote a linked list and managed to add filesupport to it. Now there is a problem with the command prompt output. The last pokemon->name and pokemon->number is getting outputted cryptic. Somehow I assume I did a mistake in saving the last batch of data into memory, because it is actually correctly saved into the file.
Here is the code (input testing after the code)
pokemonPtr addPokemon(void){

FILE *filePtr;

//filePtr = fopen ("pokedex.txt", "a");

//if (filePtr == NULL){
    filePtr = fopen ("pokedex.txt","w");
//}

pokemonPtr firstPtr;
pokemonPtr thisPokemon;
firstPtr = NULL;

firstPtr = (pokemon *) malloc(sizeof(pokemon));
firstPtr->name = (char *) malloc(sizeof(char) * POKEMON_LENGTH);

printf ("Enter the name of the Pokemon.\n");
scanf("%s",firstPtr->name);
fprintf(filePtr, "Pokemon Name:%s    ", firstPtr->name);
getchar();
printf ("Enter the number of the Pokemon.\n");
scanf("%d",&firstPtr->number);
fprintf(filePtr, "Pokemon Nummer:%d\n", firstPtr->number);

firstPtr->next = (pokemon *) malloc(sizeof(pokemon));

thisPokemon = firstPtr->next;

int i = 0;

while (i < 2){

    thisPokemon->name = (char *) malloc(sizeof(char) * POKEMON_LENGTH);

    printf ("Enter the name of the Pokemon.\n");
    scanf("%s",thisPokemon->name);
    fprintf(filePtr, "Pokemon Name:%s    ", thisPokemon->name);
    printf ("Enter the number of the Pokemon.\n");
    scanf("%d",&thisPokemon->number);
    fprintf(filePtr, "Pokemon Nummer:%d\n", thisPokemon->number);

    thisPokemon->next =(pokemon *) malloc (sizeof(pokemon));
    thisPokemon = thisPokemon->next;

    i++;

}

thisPokemon->next = NULL;

fclose (filePtr);

return firstPtr;

}

void showPokemon(pokemonPtr firstPtr){

printf ("Name:   %s\n"
        "Nummer: %d\n", firstPtr->name, firstPtr->number);

pokemonPtr thisPokemon = firstPtr->next;

while (thisPokemon != NULL){

    printf ("Name:   %s\n"
            "Nummer: %d\n", thisPokemon->name, thisPokemon->number);

    thisPokemon = thisPokemon->next;
}

}

The input I tried was:

Pokemon Name:dudu    Pokemon Nummer:3
  Pokemon Name:dada    Pokemon Nummer:3
  Pokemon Name:dudi    Pokemon Nummer:23
  The output in cmd was:
  Name:   dudu
  Nummer: 3
  Name:   dada
  Nummer: 3
  Name:   dudi
  Nummer: 23
  Name:   Ót
  Nummer: 7607776

What happened here?

A: Ok, the problem is in the way you build your linked list - it is trivial as soon as you execute the code under a debugger -> you should really learn to do that ;-)
You correctly save the head in firstPtr, but you start you loop with an empty but allready created and link element. So here is what happens in addPokemon:

*

*initial part: alloc a new item and read its values allocate a new item and link it to first: first(dudu) -> this(empty)

*first pass in loop: first(dudu) -> dada -> empty

*second pass in loop: first(dudu) -> dada -> dudi -> empty

*after end of loop, you put a null, but one step too far: first(dudu) -> dada-> dudi -> empty -> NULL

How to fix:
You should allocate a new item inside the loop just before storing values in it and start the loop with thisPokemon pointing to firstPokemon:
...
firstPtr->next = NULL;

thisPokemon = firstPtr;

int i = 0;

while (i < 2){

    thisPokemon->next =(pokemon *) malloc (sizeof(pokemon));
    thisPokemon = thisPokemon->next;
    thisPokemon->name = (char *) malloc(sizeof(char) * POKEMON_LENGTH);

    printf ("Enter the name of the Pokemon.\n");
    scanf("%s",thisPokemon->name);
    fprintf(filePtr, "Pokemon Name:%s    ", thisPokemon->name);
    printf ("Enter the number of the Pokemon.\n");
    scanf("%d",&thisPokemon->number);
    fprintf(filePtr, "Pokemon Nummer:%d\n", thisPokemon->number);

    i++;

}
...

A:
The last pokemon->name and pokemon->number is getting outputted
  cryptic

Reason:
The reason why you get a 4th node is because you are creating an empty node at the end of each iteration and then filling it up at the start of each iteration...

*

*So during the last iteration you create an empty node and get out of the loop.

*to this empty node's next member you assign the NULL.

*Therefore you end up getting four nodes printed in which the final one is empty.

Solution :
The solution to this problem is to assign memory at the beginning as the other answer suggests.But,

In your code, you take the pain of writing everything separately for head node and rest of the nodes in both the functions

You can achieve what you want to do by using a single loop...
here I've provided a function in which you can do that within a single loop:
pokemonPtr addPokemon(void){

FILE *filePtr;

filePtr = fopen ("pokedex.txt","w");

pokemonPtr firstPtr;
pokemonPtr thisPokemon;

int i;

for(i = 0 ; i < 3 ; i++ ) //single loop!
{
    if(i==0)//head node
    {
        thisPokemon =(pokemon *) malloc (sizeof(pokemon));
        firstPtr=thisPokemon;
    }
    else //any other node
    {
        thisPokemon->next =(pokemon *) malloc (sizeof(pokemon));
        thisPokemon=thisPokemon->next;
    }

    //first allocation of memory takes place
    thisPokemon->name = (char *) malloc(sizeof(char) * POKEMON_LENGTH);

    //then you enter details
    printf ("Enter the name of the Pokemon.\n");
    scanf("%s",thisPokemon->name);
    fprintf(filePtr, "Pokemon Name:%s    ", thisPokemon->name);
    printf ("Enter the number of the Pokemon.\n");
    scanf("%d",&thisPokemon->number);
    fprintf(filePtr, "Pokemon Nummer:%d\n", thisPokemon->number);

    //no memory allocated at the end
}

thisPokemon->next=NULL; // the next of last entered node points NULL

fclose (filePtr);

return firstPtr;

}

Apart from this similarly, i'd like to suggest you to use the showPokemon() function this way:
void showPokemon(pokemonPtr firstPtr){

pokemonPtr thisPokemon = firstPtr;

while (thisPokemon != NULL)
{

    printf ("Name:   %s\n"
            "Nummer: %d\n", thisPokemon->name, thisPokemon->number);

    thisPokemon = thisPokemon->next;
}

}

you need not print separately for first node and rest of the nodes :)