text:
Q: How to have QFileSelector select files based on device Reading the QFileSelector Class documentation, I see:

QFileSelector is a convenience for selecting file variants based on platform or device characteristics

I am successfully using the related QQmlFileSelector class to select a set of files based on if I am building for Mac (a +mac directory).
However, I need to also build for Ubuntu Desktop and an embedded device which is also running Ubuntu. Therefore, I cannot just add another platform directory directly related to ubuntu.
Based on the reference to device characteristics in the documentation, I figure I can create a folder directly related to the device.
I have a Kit setup for the embedded device and a Device used by the kit named Ansible.
Can anyone provide further details on how I can have QQmlFileSelector select the files in a + folder when building for Ansible?

A: You can add your own selectors using any name you want. Here's an example:
    QQmlFileSelector *selector = QQmlFileSelector::get(engine);
    QStringList options;

    if (usingAnsible())
    {
        options << "ansible";
    }
    else
    {
        options << "x86";
    }

    selector->setExtraSelectors(options);

Then your files would be in either the +ansible or +x86 directory.


text:
Q: what is the correct navigation sequence? because tabbars can't dissapear when the switch contains stack, and the switch is child of bottomtabnavigator I'm making react native applications, where my application is like a marketplace application. My app has bottom tab navigation as root navigation with 5 tabs, and the fifth tab contains a switchNavigator to authenticate if the user has successfully logged in / register then will switch to the profileStack and stay in loginStack when not logged in. When I want to set bottomTabNavigator tabbat visibility to disappear when the screen stack of profileStack > 0, it means that the tabbar bottomTabNavigator is only visible on the main profile page and does not appear on the editprofile page, but with the switchNavigator inside the bottomTabNavigator, the tabbar continues to appear until the editprofile page
my app using lib version:
"react": "16.6.3",
"react-native": "0.58.6",
"react-navigation": "^3.3.2"
import {createStackNavigator, createMaterialTopTabNavigator, createBottomTabNavigator, createSwitchNavigator, createAppContainer} from 'react-navigation';

const LoginStack = createStackNavigator({
    LogIn :{screen: LogIn, navigationOptions: ({ navigation }) => ({header: null}) },
    Register :{screen: Register, navigationOptions: ({ navigation }) => ({header: null}) },
    RegisterPassword :{screen: RegisterPassword, navigationOptions: ({ navigation }) => ({header: null}) }
},{
    initialRouteName: 'LogIn'
})

LoginStack.navigationOptions = ({ navigation }) => {
    let tabBarVisible = true;
    if (navigation.state.index > 0) {
      tabBarVisible = false;
    }

    return {
      tabBarVisible,
    };
};

const ProfileStack = createStackNavigator({
    Profile :{screen: Profile, navigationOptions: ({ navigation }) => ({header: null}) },
    MyPoint :{screen: MyPoint, navigationOptions: ({ navigation }) => ({header: null}) },
    EditProfileMenu :{screen: EditProfileMenu, navigationOptions: ({ navigation }) => ({header: null}) },
    EditProfile :{screen: EditProfile, navigationOptions: ({ navigation }) => ({header: null}) },
    ProfileAddress :{screen: ProfileAddress, navigationOptions: ({ navigation }) => ({header: null}) }
},{
    initialRouteName: 'Profile'
})

ProfileStack.navigationOptions = ({ navigation }) => {
    let tabBarVisible = true;
    if (navigation.state.index > 0) {
      tabBarVisible = false;
    }

    return {
      tabBarVisible,
    };
};

const AuthSwitch = createSwitchNavigator({
    AuthChecker: { screen: AuthChecker,
        navigationOptions: ({ navigation }) => ({title: 'AuthChecker'}) },
    LoginStack: { screen: LoginStack},
    ProfileStack: { screen: ProfileStack}
},{
    initialRouteName: 'AuthChecker'
})

AuthSwitch.navigationOptions = ({ navigation }) => {
    let tabBarVisible = true;
    if (navigation.state.index > 0) {
      tabBarVisible = false;
    }

    return {
      tabBarVisible,
    };
};

const AppNavigator = createBottomTabNavigator({
    Home :{screen: HomeStack,
        navigationOptions:{
            tabBarLabel: "Home",
            tabBarIcon: ({ focused }) => (
                // <Ionicons name="ios-home" color={tintColor} size={24} />
                focused ?
                <Image source={require('../assets/images/nav/home_active.png')} style={{width:23, height:23}} />
                : <Image source={require('../assets/images/nav/home.png')} style={{width:23, height:23}} />
            )
        }},
    FastShop :{screen: FastShopStack,
        navigationOptions:{
            tabBarLabel: "Fast Shop",
            tabBarIcon: ({focused}) => (
                // <Ionicons name="ios-cart" color={tintColor} size={24} />
                focused ?
                <Image source={require('../assets/images/nav/fast_shop_active.png')} style={{width:23, height:23}} />
                : <Image source={require('../assets/images/nav/fast_shop.png')} style={{width:23, height:23}} />
            )
        }},
    MyOrder :{screen: MyOrderStack,
        navigationOptions:{
            tabBarLabel: "My Order",
            tabBarIcon: ({focused}) => (
                // <Ionicons name="ios-list-box" color={tintColor} size={24} />
                focused ?
                <Image source={require('../assets/images/nav/myorder_active.png')} style={{width:23, height:23}} />
                : <Image source={require('../assets/images/nav/myorder.png')} style={{width:23, height:23}} />
            )
        }},
    Inbox :{screen: Inbox,
        navigationOptions:{
            tabBarLabel: "Inbox",
            tabBarIcon: ({focused}) => (
                // <Ionicons name="ios-chatbubbles" color={tintColor} size={24} />
                focused ?
                <Image source={require('../assets/images/nav/inbox_active.png')} style={{width:28, height:23}} />
                : <Image source={require('../assets/images/nav/inbox.png')} style={{width:28, height:23}} />
            )
        }},
    Account :{screen: AuthSwitch,
        navigationOptions:{
            tabBarLabel: "Account",
            tabBarIcon: ({focused}) => (
                // <Ionicons name="ios-contact" color={tintColor} size={24} />
                focused ?
                <Image source={require('../assets/images/nav/akun_active.png')} style={{width:23, height:23}} />
                : <Image source={require('../assets/images/nav/akun.png')} style={{width:23, height:23}} />
            )
        }},
    },{
        initialRouteName: 'Home',
        tabBarOptions: {
            style: {
             backgroundColor: '#FFF',
             height:50
            },
            activeTintColor: '#2EB499',
            inactiveTintColor: 'gray',
            labelStyle: {
                fontSize: 10,
              },
          }
    }
);

const App = createAppContainer(AppNavigator);

export default App;

i expect the tabbar of profileStack and loginStack only appear only on Profile and Login initialRoute page

redpajama_set_name: RedPajamaStackExchange


text:
Q: performance testing of an application using dummynet I have installed network emulator, dummy-net in window 7 and tried some ipfw commands for limiting bandwidth, latency and queue size, etc.
ipfw pipe 1 config bw 1MByte/s delay 100ms queue 10
ipfw add pipe 1 ip from any to any

But I have following problems:

*

*How can I judge the effect of changing bandwidth, latency ,queue
size, etc, quantitatively?

*I have to check the performance of  mobile phone application using
this emulator. How can I check?

Please suggest me anything related to this.


text:
Q: Android: Checking network connectivity return not connected when connected to wifi/3g in Broadcast receiver I want to check if device in connected or not in broadcastReceiver.
below is my code :
public boolean isOnline(Context context) {
NetworkInfo info = (NetworkInfo) ((ConnectivityManager) context
        .getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();

if (info == null || !info.isConnected()) {
    Log.e("UpdateDataReceiver","info: "+info);
    return false;
}
return true;
}

Issue with my code:
above function returns me false (even when wifi connected) when BroadcastReceiver fires in background(when app is in background)
and it returns true when app is in foreground.

info: NetworkInfo: type: WIFI[], state: DISCONNECTED/BLOCKED, reason:
  (unspecified), extra: (none), roaming: false, failover: false,
  isAvailable: true, isConnectedToProvisioningNetwork: false, simId: 0

Device Info: Redmi Note

A: This is how I'm handling it as it turns out getActiveNetworkInfo will always return you DISCONNECTED/BLOCKED in a specific case even if there is network connection. This is the receive method in the BroadcastReceiver with intent filter ConnectivityManager.CONNECTIVITY_ACTION.
@Override
public void onReceive(Context context, Intent intent) {
    ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = conn.getActiveNetworkInfo();

    NetworkInfo intentNetworkInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);

    if (intentNetworkInfo == null) {
        intentNetworkInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
    }

    if (networkInfo == null) {
        networkInfo = intentNetworkInfo;
    } else {
        //when low battery get ActiveNetwork might receive DISCONNECTED/BLOCKED but the intent data is actually CONNECTED/CONNECTED
        if (intentNetworkInfo != null && networkInfo.isConnectedOrConnecting() != intentNetworkInfo.isConnectedOrConnecting()) {
            networkInfo = intentNetworkInfo;
        }
    }

    //do something with networkInfo object
}

I've searched for better solution but no results. The case I've been able to reproduce 100% on my device (Pixel 7.1.2) is the following:

*

*The device must be on low battery < 15% (other devices <20%)

*Wifi is on, app is launched

*Send app to background turnoff wifi and go to 3g (or vice versa)

*Go back to the app

*In that situation the app will report DISCONNECTED/BLOCKED from getActiveNetworkInfo.

If you change connectivity while in app it will be ok but if it is on background it wont. This won't happen while you are debugging because it will be charging the device even if the battery is low.
In the example above EXTRA_NETWORK_INFO in ConnectivityManager and WifiManager is actually same string "networkInfo" but I didn't wan't to risk it if in other Android versions they are different, so it is extra boilerplate.
You can directly use the networkInfo from the intent but I wanted to show here that there is a case where actualNetworkInfo is not the actual network info.

A: I believe the way you can do this is,
Register a Broadcast Receiver with an IntentFilter of ConnectivityManger.Connectivity_Action
private BroadcastReceiver receiverDataChange;

private void registerData(){

    try {
        receiverDataChange = new bcr_ToggleData();
        IntentFilter filterData = new IntentFilter();
        filterData.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
        registerReceiver(receiverDataChange, filterData);

    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    }}

Then in your Broadcast receiver class
public class bcr_ToggleData extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {

    String action = intent.getAction();

    if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {

        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        int state = telephonyManager.getDataState();
        switch (state){

            case TelephonyManager.DATA_DISCONNECTED: // off
                Log.d("DavidJ", "DISCONNECTED");
                break;

            case TelephonyManager.DATA_CONNECTED: // on
                Log.d("DavidJ", "CONNECTED");
                break;
        }
    }
}

}
This fires off when you go into your settings and turn on/off mobile data.
Hope this helps! :)

A:     ConnectivityManager cm =
        (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);

NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null &&
                      activeNetwork.isConnectedOrConnecting();

I found this on this google tutorial: http://developer.android.com/intl/pt-br/training/monitoring-device-state/connectivity-monitoring.html. check it out.


text:
Q: Need recommendation for a Content Management System (.NET) I am searching for a CMS that meets the following requirements:

*

*Based on .NET

*Works with a tree structure for content items

*User-defined content types (content templates)

*Manage external tables

*Extensible with my own management applications

*Support for versioning

*.NET API for content retrieval

Note that i am looking for a system that does just content management, i don't need it to handle rendering or supply me with a templating engine.
I just want to be able to manage my content and custom applications from one system without writing it myself.
Curious to what you guys would recommend!
/Ruud

A: It depends a little bit on the rest of your requirements. What kind of website is this? Do you have existing content that is already stored in a database?
I would recommend N2CMS

*

*It is free

*It works both using classic .NET Webforms as well as ASP.NET MVC

*It is easily extensible, for example with your own applications

*It has versioning and uses a tree structure

*It has decent support, considering it is free

*It doesn't try to do too much for you

One disadvatange I could think of is that, out of the box, it doesn't look too impressive. Which is fine, if you have time to 'pimp' it yourself, or if you use it for a site where the CMS GUI is not that important. However, it certainly won't 'WOW' your customers.
In your case, I wouldn't recommend the larger CMS frameworks like Umbraco, SiteCore or EPiServer. I'd use a free, lightweight CMS like N2.
I'm currently implementing it in my project. We did an overhaul of the GUI, but other than that, it works really nice.

A: I've been using few of these systems, but N2 is one of the best in terms of extensibility, content definition and maintenance, versioning...
Definitely the best choice.
More details:
http://n2cms.com/

A: Percussion CMS is a java based system but it's completely configurable, in fact 60% of it's customers are .net based. API, WEb DAV and wysiwyg are all ways for end users to publish content for the website. With that said I'm not going to continue with the other solutions it offers because it's not technically .net, if your interested for more info feel free to contact me back.


text:
Q: How to loop over multiple sql databases where names increment by one? I want to add a user to 100 databases where database names increment by one.
use database0001
EXEC sp_addrolemember 'user', 'accessman';

use database0002
EXEC sp_addrolemember 'user', 'accessman';
...
use database0100
EXEC sp_addrolemember 'user', 'accessman';

and so on.
There are other databases on the server whose permissions should not be changed.

A: This is not a great answer and there are better ways of doing this but this is also a way to do this. If this is just a single user which you want to add in all the USER databases then here is very simple script that will generate script which you can run in SSMS window and it will add the user in all the databases.
select 'use ' + QUOTENAME(name) + '; EXEC sp_addrolemember ''user'', ''accessman''; '  from sys.databases where database_id not in (1,2,3,4)
It generates the script like below. Make sure before running the query you press Ctrl + T
use [AdventureWorks2016]; EXEC sp_addrolemember 'user', 'accessman';
use [ReportServer$SQL2016]; EXEC sp_addrolemember 'user', 'accessman';
use [ReportServer$SQL2016TempDB]; EXEC sp_addrolemember 'user', 'accessman';

let me know how this goes.


text:
Q: PHP script cant connect to sql database I want my script to connect to a database and insert a simple apikey into it. The problem is that the script inst connecting to the database. Im running this script on a xampp installation on my pc.
Script:
<?php
    $servername = "127.0.0.1";
    $username = "root@127.0.0.1";
    $password = "root";
    $dbname = "apikey";

    // Create a connection to the server
    $conn = new mysqli ($servername, $username, $password, $dbname);
    // Check the connection to the server
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }

    $sql = "INSERT INTO APIkey (APIkey)
    VALUES ('John Doe')";

    if ($conn->query($sql) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " .$sql. "<br>" . $conn->error;
    }

    $conn->close();
?>

Does anyone has an Idea what could be wrong with the script?
Thank you for any advice.

A: You dont need the host on the user name
$username = "root";

Is all you need


text:
Q: Force set orientation to Landscape for an activity even when auto rotate is enabled I am setting the orientation with setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE)
However when I check for the orientation before setting this up using Activity.getResources().getConfiguration().orientation
I am getting value 1 which is potrait.
Then I set the orientation with the code. Still I am getting the value 1, also the android system is looking in Layout folder(potrait) for the layout rather than layout-large-land.
So conclusion is, How to force set the orientation to Landscape?

A: You can force set orientation in AndroidManifest.xml for  Activity:
<activity
    android:name="<name_of_your_activity>"
    android:screenOrientation="landscape"
    ...

Update
Take a look at this question.

A: create bool.xml in values
<resources>
    <bool name="isTablet">false</bool>
</resources>

create another bool.xml in values-sw600dp
<resources>
    <bool name="isTablet">true</bool>
</resources>

then in your activity
boolean tabletSize = getResources().getBoolean(R.bool.isTablet);
if (tabletSize) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}


text:
Q: How to get list of tags from DesignSync server vault I'm working with DesignSync vault contains branches
What is the way to extract list of files with attached tags?
The command I'm using is:
dssc ls -noheader -fullpath -report NG -rec sync://my.server.address.com:1234/Projects/Name

A: The approach is right.
This is the way to get a list of tags in DesignSync vault


text:
Q: How to use getPosition() to get the ListView value? In Activity WorkDetailsTable , it has a ListView as shown below. When it is clicked, it should  display the value on the Add_Details_Information EditText

Assume the first list is clicked, and it intent to  Add_Details_Information

Noted that the value on editText was actually get from the second list in Activity A. But what I want is get value accordingly to their position not the latest value.
WorkDetailsTable
int mClickedPosition;
MyCustomBaseAdapter objMyCustomBaseAdapter;
ArrayList<SearchResults> results=new ArrayList<SearchResults>();

listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { // if listView is clicked
            @Override
            public void onItemClick(AdapterView<?> a, View v, int position, long id) {
                mClickedPosition = position;
                // how to getPosition???
                Intent i = new Intent(getApplication(), Add_Details_Information.class);
                i.putExtra("ReceiveProject", ReceiveProject);
                i.putExtra("ReceiveDescription", ReceiveDescription);
                i.putExtra("ReceiveProgress", ReceiveProgress);
                i.putExtra("ReceiveTimeIn", ReceiveTimeIn);
                i.putExtra("ReceiveTimeOut", ReceiveTimeOut);
                i.putExtra("date",date);
                i.putExtra("status", status);
                startActivityForResult(i,PROJECT_REQUEST_CODE);
            }
        });
    }

Add_Details_Information
 @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_details_information);
        addItemsOnSpinner(); // Spinner for project/service/training
        tp = new TimePick(); // call tmePick
        description=(EditText)findViewById(R.id.editTextWorkDescription);
        timeIn=(EditText)findViewById(R.id.TimeIn);
        timeOut=(EditText)findViewById(R.id.TimeOut);
        save=(Button)findViewById(R.id.saveButton);
        seekBar=(SeekBar)findViewById(R.id.seekBarPercentage);
        progressText=(TextView)findViewById(R.id.textProgress);
        progressText.setText("Covered:" + "" + seekBar.getProgress() + "/" + seekBar.getMax());

        if(getIntent().getExtras()!=null)
        {
            final String Project1=getIntent().getStringExtra("ReceiveProject");
            final String Description1=getIntent().getStringExtra("ReceiveDescription");
            final int Progress1=getIntent().getIntExtra("ReceiveProgress", 0);
            final String TimeIn1=getIntent().getStringExtra("ReceiveTimeIn");
            final String TimeOut1=getIntent().getStringExtra("ReceiveTimeOut");

           // project.setText(Project1);
            description.setText(Description1);
            seekBar.setProgress(Progress1);
            timeIn.setText(TimeIn1);
            timeOut.setText(TimeOut1);
            seekBar.setProgress(Progress1);
            progressText.setText("Covered:" + "" + seekBar.getProgress() + "/" + seekBar.getMax());

        }

MyCustomBaseAdapter
public class MyCustomBaseAdapter extends BaseAdapter{   // for ListView in WorkDetailsTable

        private static ArrayList<SearchResults> searchArrayList;

        private LayoutInflater mInflater;

        public MyCustomBaseAdapter(Context context, ArrayList<SearchResults> results) {
            searchArrayList = results;
            mInflater = LayoutInflater.from(context);
        }

        public int getCount() {
            return searchArrayList.size();
        }

        public Object getItem(int position) {
            return searchArrayList.get(position);
        }

        public long getItemId(int position) {
            return position;
        }

       public void addNewItem(String P,String D,int Per,String I,String O)
      {
        SearchResults obj=new SearchResults();
        obj.setProject(" Project/Service/Training : "+P);
        obj.setDescription(" Work Description : " + D);
        obj.setProgress(" Progress : " + Per);
        obj.setTimeIn(" Time In : " + I);
        obj.setTimeOut(" Time Out : " + O);
        searchArrayList.add(obj);
        this. notifyDataSetChanged();
    }

        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder;
            if (convertView == null) {
                convertView = mInflater.inflate(R.layout.custom_row_view, null);
                holder = new ViewHolder();
                holder.txtProject= (TextView) convertView.findViewById(R.id.ListProject);
                holder.txtDescription = (TextView) convertView.findViewById(R.id.ListDescription);
                holder.txtProgress = (TextView) convertView.findViewById(R.id.ListProgress);
                holder.txtIn=(TextView)convertView.findViewById(R.id.ListTimeIn);
                holder.txtOut=(TextView)convertView.findViewById(R.id.ListTimeOut);

                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            holder.txtProject.setText(searchArrayList.get(position).getProject());
            holder.txtDescription.setText(searchArrayList.get(position).getDescription());
            holder.txtProgress.setText(searchArrayList.get(position).getProgress());
            holder.txtIn.setText(searchArrayList.get(position).getTimeIn());
            holder.txtOut.setText(searchArrayList.get(position).getTimeOut());

            return convertView;
        }

        static class ViewHolder {
            TextView txtProject;
            TextView txtDescription;
            TextView txtProgress;
            TextView txtIn;
            TextView txtOut;
        }
    }

Trying Code
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { // if listView is clicked
    @Override
    public void onItemClick(AdapterView<?> a, View v, int position, long id) {
      Object o=listview.getItemAtPosition(position);
        SearchResults fullObject=(SearchResults)o;
        String ReceiveDescription=((SearchResults) o).getDescription();
        Intent i = new Intent(getApplication(), Add_Details_Information.class);

        i.putExtra("ReceiveDescription", ReceiveDescription);

        startActivityForResult(i,PROJECT_REQUEST_CODE);
    }
});
}

A: Try this:
public View getViewByPosition(int pos, ListView listView) {
    final int firstListItemPosition = listView.getFirstVisiblePosition();
    final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1;

    if (pos < firstListItemPosition || pos > lastListItemPosition ) {
        return listView.getAdapter().getView(pos, null, listView);
    } else {
        final int childIndex = pos - firstListItemPosition;
        return listView.getChildAt(childIndex);
    }
}


text:
Q: Problemas con css, js y direccionamiento al pasar al servidor con codeigniter Hace un tiempo estoy trabajando en un proyecto que he desarrollado en Codeigniter 3.x donde realizo las típicas acciones de CRUD, además del llamado a JOBS en SQL Server.
Al probar el servicio de forma local, no presenta ningún inconveniente, todo funciona súper bien, carga todos los .css y .js, genera correctamente el direccionamiento, y todo genial.
Para realizar le direccionamiento, lo he realizado mediante el helper('url') el cual me permite utilizar base_url
cada llamada, ya sea CSS, js, u otras páginas las he realizado con ese helper.
Hasta ahí todo bien... El problema surge cuando traslado mi proyecto al servidor. Al ejecutarlo de forma local (en el servidor), funciona sin problemas. Pero necesito que otros usuarios se conecten a él y realicen sus operaciones.
al momento de ingresar desde otra computadora a la dirección de ese servidor la página carga, pero sin .css, ni .js, ni redirige...
Coloco un ejemplo de como estoy llamando a cada .css en la vista:
  <head>
    <title>Finanzas</title>
      <link rel="stylesheet" href="<?php echo base_url('assets/css/bootstrap.css'); ?>" />
      <link rel="stylesheet" href="<?php echo base_url('assets/DataTables/DataTables-1.10.16/css/dataTables.bootstrap.min.css');?>"/>
      <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">  <!-- este funciona bien, pues no es con base_url -->
      <link rel="shortcut icon" href="<?php echo base_url('imagenes/favicon.ico');?>" />
  </head>

Mi base_url:
$config['base_url'] = 'servidor:4002/codeigniter/';

Naturalmente de este código solo es capaz de cargar el elemento que está siendo llamado sin el base_url.
Al ver mediante "view source code" del navegador, presiono click en el elemento llamado, y no me abre de inmediato el .css, debo copiar el enlace, pegarlo en el navegador y presionar enter.
¿alguna idea?
Gracias de antemano por el tiempo y la ayuda!

A: El servidor está en la misma red por lo tanto puedo acceder mediante la dirección:
servidor/proyecto

De todos modos acabo de encontrar la solución a mi problema:
Esta solución la encontré en este foro. Había investigado bastante pero justo cuando publiqué la pregunta, encontré la respuesta...
https://es.stackoverflow.com/a/93691/62513 GRACIAS Risa__B (no pude etiquetarte)
el en respuesta a otro usuario publicó:

lo que pasa es que localhost solo existe en tu ordenador, por eso es
  localhost, desde otros ordenadores y telefonos no puedes usar
  localhost porque dicha url no existe usa mejor lo siguiente, eso lo
  uso yo tambien y me funciona perfecto:

    $config['base_url'] = 'http://'.$_SERVER["SERVER_NAME"].'/Alumbrado/'
    $_SERVER["SERVER_NAME"]

esto funciona para capturar el nombre del servidor(dominio) en el que
  estas actualmente

CON ELLO FUNCIONA PERFECTAMENTE!

A: Para acceder a tu web qué url usas? En teoría debes tener un dominio con el que accedes tipo "http://www.midominio.es". Pues es esta url la que debes colocar en base_url:
$config['base_url'] = "http://www.midominio.es";


text:
Q: Delphi TStringList CustomSort on Name I try to sort an TStringList on the Name part. For do that, I use the customSort method.
I show you a little example :
    function CompareString(List : TStringList; Index1, Index2 : integer) : integer;
    begin
        result := AnsiCompareText(List.Names[Index1], List.Names[Index2]);
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
        Memo2.Clear;
        Liste.CustomSort(CompareString);
        Memo2.Lines.Append(Liste.GetText)
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
        Liste := TStringList.Create;
        Liste.Append('INFOS_NEGOCE=NUM_CDE');
        Liste.Append('INFOS_NEGOCE=DATE_CDE');
        Liste.Append('INFOS_NEGOCE=NOM_REPERTOIRE_ENT');
        Liste.Append('INFOS_NEGOCE=NOM_CONTACT');
        Memo1.Lines.Clear;
        Memo1.Lines.Append(Liste.GetText)
    end;

The sort give me this result :
INFOS_NEGOCE=NOM_REPERTOIRE_ENT

INFOS_NEGOCE=NOM_CONTACT

INFOS_NEGOCE=NUM_CDE

INFOS_NEGOCE=DATE_CDE

I think that the sort DON'T change the order of the line (the name is always INFOF_NEGOCE).

A: The sorting is done with QuickSort. This means that the order of identical items (as seen by the sort) is undefined.
See Quicksort - Repeated Elements

A: function CompareString(List : TStringList; Index1, Index2 : integer) : integer;
begin
  Result := AnsiCompareText(List.Names[Index1], List.Names[Index2]);
  // If you want to sort equal strings then on the Values
  if Result = 0 then Result := AnsiCompareText(List.ValueFromIndex[Index1], List.ValueFromIndex[Index2]);
  // Or if you want to keep the original order
  { if Result = 0 then Result := Index1-Index2; --- qv : this won't work!}
end;

Result would be set to 0 by your code if the Names were equal. If they are equal, choose which additional criteria you want to use to sort items with the same name.

As  Uwe Raabe correctly observes, the 'original order' won't work.
But all is not lost. Typically, the object included in a Tstringlist isn't used. If it's available, then just before the sort, try
for i := 0 to pred(List.Count) do List.Objects[i] := TObject(i);

and the sort becomes
function CompareString(List : TStringList; Index1, Index2 : integer) : integer;
begin
  Result := AnsiCompareText(List.Names[Index1], List.Names[Index2]);
  // If you want to sort equal strings then on the Values
  if Result = 0 then Result := AnsiCompareText(List.ValueFromIndex[Index1], List.ValueFromIndex[Index2]);
  // Or if you want to keep the original order
  if Result = 0 then Result := integer(List.Objects[Index1])-integer(List.Objects[Index2]);
end;

but it would be a lot easier if we were let in on the secret of what the "correct" order is expected to be.


text:
Q: Air Pagination Issues I just completed an Adobe AIR app. I built it using html, css, javascript and jQuery. It installs fine, loads fine and everything works except pagination on a popup page.
You can install it here: http://www.bendelcorp.com/tools/air-installer.html
When you click on the Capacity tab and enter values in each of the three fields (enter double or triple digits to activate the pagination) and then click on the Show Capacity Chart it brings up another window with data.
The problem - when you click on the Next Page button, nothing happens. The web based version (located here) works fine. I just need some help "unlocking" the power of the Next Page button.
Thanks in advance for any help.

A: Once again I am the only one reading my entries about Adobe Air.
The fix was in the JavaScript:
CapacityWindow = window.open(document.location, 'CapacityWindow', 'toolbar,scrollbars,menubar,width=800,height=950');

CapacityWindow.document.write(s);
  CapacityWindow.document.close();
The previous script was not allowing the existing window to close so the new one could open up.


text:
Q: Probability from a NBinomial distribution Please, can someone help me with this question. I need to understand the steps or reasoning to arrive at the answer and not just the answer.
A company that produces fine crystal knows from experience that 10% of its goblets has flaws and must be classified as 'seconds'. If goblets are examined one by one, what is the probability that at most five must be selected to find four that are not 'seconds'.
Here is how I went about it. I analyzed this as a binomial distribution and then said:
X = number not seconds.
p= 0.9
x = 4
Then what varies is n, i.e what n gives the probability for P(X=4). I then told myself that to give 4 non-seconds, then we need to examine either 4 goblets (all are not seconds) or five goblets (4 are not seconds and 1 is a second). So, this is the addition of two binomial probability mass functions, b(4; 4, 0.9) + b(4; 5, 0.9)
b(4; 4, 0.9) = $ {4 \choose 4} (0.9)^4 (0.1)^0$ = 0.6561
b(4; 5, 0.9) = ${5 \choose 4}(0.9)^4(0.1) $ = 0.32805
the total gives = 0.9842.
But the textbook says that the answer is 0.918.
Please, can someone explain to me where I went wrong and how I should have tackled the problem. Or what principle in the problem I am missing?
thanks

A: You are unlucky...if they asked you "at most 6", for example, with your method you found a probability of about 1.08....greater than 1. So you would have realized that your method is wrong, also without reading the correct solution.
The correct solution is to use a Negative Binomial, the distribution that counts how many trials are necessary to get a fixed number of successes. In your cases
$$\binom{4-1}{4-1}0.9^4\cdot0.1^{4-4}+\binom{5-1}{4-1}0.9^4\cdot0.1^{5-4}=0.656+0.262=0.91854\approx0.919$$


text:
Q: Wrong result in MySQL user defined Function I have the following Mysql user-defined function :
CREATE DEFINER=`root`@`localhost` FUNCTION `vacationdays`(schoolyear varchar(9),schoolno int(11)) RETURNS int(11)
BEGIN
DECLARE vacationdays int(11);
SET vacationdays = (SELECT sum(Days) FROM greenland.vacations
where SchoolNo = schoolno
And SY = schoolyear
And Date_Format(Now(), "%Y-%m-%d") >= StartDate);
return vacationdays;
END

when I call it,SELECT vacationdays("2021/2022",1). it returns 60.
but when I run the same query
SELECT sum(Days) FROM greenland.vacations
where SchoolNo = 1
And SY = "2021/2022"
And
    Date_Format(Now(), "%Y-%m-%d") >= StartDat

it returns 30 (the correct result !!!
Noting I have 2 schools in my table with the same vacations days. Looks like the query in the user-defined function ignores the SchoolNo condition !!!
what I am doing wrong?

A: I followed Akina's suggestion to qualify the attribute in the WHERE clause:
WHERE greenland.vacations.SchoolNo = schoolno, and it works.


text:
Q: Find and delete files that contain same string in filename in linux terminal I want to delete all files from a folder that contain a not unique numerical string in the filename using linux terminal. E.g.:
werrt-110009.jpg => delete
asfff-110009.JPG => delete
asffa-123489.jpg => maintain
asffa-111122.JPG => maintain

Any suggestions?

A: you can use the linux find command along with the -regex parameter and the -delete parameter
to do it in one command

A: Use "rm" command to delete all matching string files in directory
cd <path-to-directory>/ && rm *110009*

This command helps to delete all files with matching string and it doesn't depend on the position of string in file name.
I was mentioned rm command option as another option to delete files with matching string.
Below is the complete script to achieve your requirement,
#!/bin/sh -eu

#provide the destination fodler path
DEST_FOLDER_PATH="$1"

TEMP_BUILD_DIR="/tmp/$( date +%Y%m%d-%H%M%S)_clenup_duplicate_files"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
clean_up()
{
    if [ -d $TEMP_BUILD_DIR ]; then
        rm -rf $TEMP_BUILD_DIR
    fi
}
trap clean_up EXIT

[ ! -d $TEMP_BUILD_DIR ] && mkdir -p $TEMP_BUILD_DIR
TEMP_FILES_LIST_FILE="$TEMP_BUILD_DIR/folder_file_names.txt"
echo "$(ls $DEST_FOLDER_PATH)" > $TEMP_FILES_LIST_FILE
while read filename
do
    #check files with number pattern
    if [[ "$filename" =~ '([0-9]+)\.' ]]; then
        #fetch the number to find files with similar number
        matching_string="${BASH_REMATCH[1]}"

        # use the extracted number to check if it is unique
        #find the files count with matching_string
        if [ $(ls -1 $DEST_FOLDER_PATH/*$matching_string* | wc -l) -gt 1 ]; then
            rm $DEST_FOLDER_PATH/*$matching_string*
        fi
    fi
    #reload remaining files in folder (this optimizes the loop and speeds up the operation
    #(this helps lot when folder contains more files))
    echo "$(ls $DEST_FOLDER_PATH)" > $TEMP_FILES_LIST_FILE
done < $TEMP_FILES_LIST_FILE

exit 0

How to execute this script,

*

*Save this script into file as
path-to-script/delete_duplicate_files.sh (you can rename whatever
you want)

*Make script executable
chmod +x {path-to-script}/delete_duplicate_files.sh

*Execute script by providing directory path where duplicate
files(files with matching number pattern) needs to be deleted
{path-to-script}/delete_duplicate_files.sh "{path-to-directory}"

A: I only now understand your question, I think. You want to remove all files that contain a numeric value that is not unique (in a particular folder). If a filename contains a value that is also found in another filename, you want to remove both files, right?
This is how I would do that (it may not be the fastest way):
# put all files in your folder in a list
# for array=(*) to work make sure you have enabled nullglob: shopt -s nullglob
array=(*)
delete=()

for elem in "${array[@]}"; do
    # for each elem in your list extract the number
    num_regex='([0-9]+)\.'
    [[ "$elem" =~ $num_regex ]]
    num="${BASH_REMATCH[1]}"
    # use the extracted number to check if it is unique
    dup_regex="[^0-9]($num)\..+?(\1)"
    # if it is not unique, put the file in the files-to-delete list
    if [[ "${array[@]}" =~ $dup_regex ]]; then
        delete+=("$elem")
    fi
done

# delete all found duplicates
for elem in "${delete[@]}"; do
    rm "$elem"
done

In your example, array would be:
array=(werrt-110009.jpg asfff-110009.JPG asffa-123489.jpg asffa-111122.JPG)

And the result in delete would be:
delete=(werrt-110009.jpg asfff-110009.JPG)

Is this what you meant?


text:
Q: Multiple definition of all functions when using manual makefile when it works fine in NetBeans In learning about make-files I have stumbled upon this error, and my teachers can't seem to point me the right direction. Having searched and read several related questions I still can't seem to see the answer. The thing that surprises me is that I don't get errors in NetBeans.
Makefile:
connect4: connect4.o basicBoardFunctions.o evaluationOfBoard.o hashCoding.o iaMinMaxing.o manageInput.o manageInputGeneral.o connect4.o
    gcc -o connect4 connect4.o basicBoardFunctions.o evaluationOfBoard.o hashCoding.o iaMinMaxing.o manageInput.o manageInputGeneral.o connect4.o

connect4.o: connect4.c
    gcc -c connect4.c

basicBoardFunctions.o: basicBoardFunctions.c
    gcc -c basicBoardFunctions.c

evaluationOfBoard.o: evaluationOfBoard.c
    gcc -c evaluationOfBoard.c

hashCoding.o: hashCoding.c
    gcc -c hashCoding.c

iaMinMaxing.o: iaMinMaxing.c
    gcc -c iaMinMaxing.c

manageInput.o: manageInput.c
    gcc -c  manageInput.c

manageInputGeneral.o: manageInputGeneral.c
    gcc -c manageInputGeneral.c

clean:
    rm connect4.o basicBoardFunctions.o evaluationOfBoard.o hashCoding.o iaMinMaxing.o manageInput.o manageInputGeneral.o tests.o connect4.o

The error I got:
gcc -o connect4 connect4.o basicBoardFunctions.o evaluationOfBoard.o hashCoding.o iaMinMaxing.o manageInput.o manageInputGeneral.o connect4.o
connect4.o: In function `main':
connect4.c:(.text+0x0): multiple definition of `main'
connect4.o:connect4.c:(.text+0x0): first defined here
connect4.o: In function `getInputSource':
connect4.c:(.text+0xea): multiple definition of `getInputSource'
connect4.o:connect4.c:(.text+0xea): first defined here
connect4.o: In function `startGame':
connect4.c:(.text+0x1a9): multiple definition of `startGame'
connect4.o:connect4.c:(.text+0x1a9): first defined here
connect4.o: In function `anounceWinner':
connect4.c:(.text+0x2ac): multiple definition of `anounceWinner'
connect4.o:connect4.c:(.text+0x2ac): first defined here
collect2: ld returned 1 exit status

All this functions are defined only once in the main file "connect4.c" which is not included anywhere. I don't know what to try but I thought it might be obvious to the trained person.
I feel like I'm going to get much criticism but I don't see the other situations apply to me.

A: Problem is in double linking the same object file, connect4.o:
connect4: connect4.o ... connect4.o
    gcc -o connect4 connect4.o ... connect4.o

Remove one of this files and all be fine:
connect4: connect4.o ...
    gcc -o connect4 connect4.o ...


text:
Q: File does not get converted to base64 string properly So I have written some code to capture an image from the user using the better_camera package and then store it in a file. Then I convert it to base64 string for further use. It seems like the image is getting saved properly since Image.file shows the image. But when I convert the image to base64string, it gives the image of a small white screen. I do not know where the problem is coming. Can someone check?
CODE
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:flutter_better_camera/camera.dart';
import 'package:frappe/flutter_flow/flutter_flow_theme.dart';
import 'package:path_provider/path_provider.dart';

class AddNewCameraItem extends StatefulWidget {
  const AddNewCameraItem({Key key}) : super(key: key);

  @override
  _AddNewCameraItemState createState() => _AddNewCameraItemState();
}

class _AddNewCameraItemState extends State<AddNewCameraItem> {
  CameraController controller;

  @override
  void initState() {
    super.initState();
    initCam();
  }

  void initCam() async {
    List<CameraDescription> cameras = await availableCameras();
    controller = CameraController(cameras[0], ResolutionPreset.max);
    controller.initialize().then((_) {
      controller.setFlashMode(FlashMode.off);
      if (!mounted) {
        return;
      }
      setState(() {});
    });
  }

  @override
  void dispose() {
    controller?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: FlutterFlowTheme.secondaryColor,
        automaticallyImplyLeading: true,
        centerTitle: true,
        title: Text(
          'ADD NEW ITEMS',
          style: FlutterFlowTheme.bodyText1.override(
            fontFamily: 'Noto Serif',
            color: Color(0xFFFAFAFA),
            fontSize: 20,
            fontWeight: FontWeight.w600,
          ),
        ),
        elevation: 4,
      ),
      body: !controller.value.isInitialized
          ? Container()
          // : Image.file(File(
          //     '/data/user/0/com.flutterflow.frappe/cache/lkpbpyigaqpjsh6iygy8dA4dsFDG9CAcVD7DueDLtd3C3JqzmmRuZcKaFFmAt88Ryyp208CzlE1oYfkJKnvwErBFv3DkO0dSYLZApETWDnsGOur728R7WgoUQ1EEOv9ilz1jAeNLotSsYFaI13Jk9wp5mmGdqhmRx6LYSCfHQHAdalrMCtniqrU3Sqhaw1iJZfeuUsJy.jpg')),
          : MaterialApp(
              home: CameraPreview(controller),
            ),
      floatingActionButton: FloatingActionButton(
        onPressed: () async {
          try {
            Directory tempDir = await getTemporaryDirectory();
            String randomName =
                tempDir.path + '/' + getRandomString(200) + '.jpg';
            // await controller.takePicture(randomName);
            File file = File(
                '/data/user/0/com.flutterflow.frappe/cache/IfXsEjNsSifPiQJ0d628j2d1HRh2Ww2Flin3urZc4d59WYeZ9DQ8mjpLdrt2jwzBjn2vxqvnkzRd4AGowI6fKCGRNWOfei7B2KufbpOG0RsNH7mobwGa7KS7q1C6ALoNIVJ13XLqpa7BX7pIQSgLobe5lW6z7P01QBms3CVrM9omeEvIZxRwxL5s555HLOGN4Te9Bta2.jpg');
            Uint8List list = await file.readAsBytes();
            print(list);
            print(base64Encode(list.toList()));

            print("Random n: " + randomName);
            // print(base64Encode((await xfile.readAsBytes()).toList()));
          } catch (e) {
            print("Error: " + e.toString());
          }
        },
        child: Center(
          child: Icon(Icons.camera_alt, color: FlutterFlowTheme.tertiaryColor),
        ),
      ),
    );
  }

  String getRandomString(int length) {
    String _chars =
        'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
    Random _rnd = Random();
    return String.fromCharCodes(Iterable.generate(
        length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))));
  }
}

BASE64OUTPUT
/9j/4QurRXhpZgAATU0AKgAAAAgACwEPAAIAAAAHAAAAkgEQAAIAAAARAAAAmgESAAMAAAABAAYAAAEaAAUAAAABAAAArAEbAAUAAAABAAAAtAEoAAMAAAABAAIAAAExAAIAAAA9AAAAvAEyAAIAAAAUAAAA+gITAAMAAAABAAEAAIdpAAQAAAABAAABDoglAAQAAAABAAAC8gAAAvhYaWFvbWkAAFJlZG1pIE5vdGUgNSBQcm8AAAAAAEgAAAABAAAASAAAAAF3aHlyZWQtdXNlciA5IFBLUTEuMTgwOTA0LjAwMSBWMTEuMC41LjAuUEVJTUlYTSByZWxlYXNlLWtleXMAADIwMjE6MDg6MTggMTk6MTY6MTkAAByCmgAFAAAAAQAAAmSCnQAFAAAAAQAAAmyIIgADAAAAAQAAAACIJwADAAAAAQJDAACQAAAHAAAABDAyMjCQAwACAAAAFAAAAnSQBAACAAAAFAAAAoiRAQAHAAAABAECAwCSAQAKAAAAAQAAApySAgAFAAAAAQAAAqSSAwAKAAAAAQAAAqySBwADAAAAAQABAACSCQADAAAAAQAQAACSCgAFAAAAAQAAArSSkAACAAAABwAAArySkQACAAAABwAAAsSSkgACAAAABwAAAsygAAAHAAAABDAxMDCgAQADAAAAAQABAACgAgAEAAAAAQAABpCgAwAEAAAAAQAABOigBQAEAAAAAQAAAtOiFwADAAAAAQACAACjAQAHAAAAAQEAAACkAgADAAAAAQAAAACkAwADAAAAAQAAAACkBQADAAAAAQAEAACkBgADAAAAAQAAAAAAAAAAAAAAAQAAAB4AAADcAAAAZDIwMjE6MDg6MTggMTk6MTY6MTkAMjAyMTowODoxOCAxOToxNjoxOQAAABMqAAAD6AAAAOMAAABkAAAAAAAAAGQAAA7iAAAD6Dk1NTM0OQBzOTU1MzQ5AAA5NTUzNDkAAAIAAQACAAAABFI5OAAAAgAHAAAABDAxMDAAAAAAAAA

UINT8LIST
[255, 216, 255, 225, 11, 171, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 11, 1, 15, 0, 2, 0, 0, 0, 7, 0, 0, 0, 146, 1, 16, 0, 2, 0, 0, 0, 17, 0, 0, 0, 154, 1, 18, 0, 3, 0, 0, 0, 1, 0, 6, 0, 0, 1, 26, 0, 5, 0, 0, 0, 1, 0, 0, 0, 172, 1, 27, 0, 5, 0, 0, 0, 1, 0, 0, 0, 180, 1, 40, 0, 3, 0, 0, 0, 1, 0, 2, 0, 0, 1, 49, 0, 2, 0, 0, 0, 61, 0, 0, 0, 188, 1, 50, 0, 2, 0, 0, 0, 20, 0, 0, 0, 250, 2, 19, 0, 3, 0, 0, 0, 1, 0, 1, 0, 0, 135, 105, 0, 4, 0, 0, 0, 1, 0, 0, 1, 14, 136, 37, 0, 4, 0, 0, 0, 1, 0, 0, 2, 242, 0, 0, 2, 248, 88, 105, 97, 111, 109, 105, 0, 0, 82, 101, 100, 109, 105, 32, 78, 111, 116, 101, 32, 53, 32, 80, 114, 111, 0, 0, 0, 0, 0, 72, 0, 0, 0, 1, 0, 0, 0, 72, 0, 0, 0, 1, 119, 104, 121, 114, 101, 100, 45, 117, 115, 101, 114, 32, 57, 32, 80, 75, 81, 49, 46, 49, 56, 48, 57, 48, 52, 46, 48, 48, 49, 32, 86, 49, 49, 46, 48, 46, 53, 46, 48, 46, 80, 69, 73, 77, 73, 88, 77, 32, 114, 101, 108, 101, 97, 115, 101, 45, 107, 101, 121, 115, 0, 0, 50, 48, 50, 49, 58, 48, 56, 58, 49, 56, 32, 49, 57, 58, 49, 5

A: You have to decode before using the Base64 string
String encoded = stringToBase64.encode(credentials);
String decoded = stringToBase64.decode(encoded);


text:
Q: "Where am I?" vs. "Where I am?" Which is more correct to say in a question? (For example a guy that wakes up in a train)

"Where am I?"

or

"Where I am?"

A: If you don't know where you are, you ask, "Where am I?"
The only legitimate use for "Where I am?" is in response to a question about the location of something that you think might be occupying the same general space you are. For example,

Questioner: Do you know where your clothes are?
You: Where I am?
Questioner: Wrong. We found you running around the streets nude.

A: The point of difficulty is in recognizing that a form of be can function as an auxiliary verb.
Questions in English are formed via Subject-Auxiliary Inversion. If the finite verb in a declarative sentence is any of the following (called auxiliary verbs):

do
  be
  can
  may
  shall
  will
  have

the corresponding question is formed by placing a question word (if it's a content question) at the beginning of the sentence, and then placing the auxiliary verb after the question word (if any). Then put in the rest of the sentence (with the original auxiliary verb and the antecedent of the question word omitted).
For example:

Thomas will buy [beets].
      Will Thomas buy beets?
      [What] will Thomas buy?
Thomas is [at school].
      Is Thomas at school?
      [Where] is Thomas?
Thomas should buy beets [at the store].
      Should Thomas buy beets at the store?
      [Where] should Thomas buy beets?

For declarative sentences whose finite verb is not among the auxiliaries, for the purpose of forming a question you treat the sentence as if it contained an auxiliary do. For example.

Thomas went [to the store]. (original declarative)
      Thomas did go [to the store]. (effective form for the purposes of question formation)
      Did Thomas go to the store?
      [Where] did Thomas go?


text:
Q: How do I turn this into an AJAX function At the moment I have a form button which when clicked reloads the page and posts data which then runs a mySQL command, this works find but I need to show the data right away instead of refreshing again, I could reload the page after the query but that then drains my resources. Ive tried reading up on AJAX but I cant understand it (or get it to work!!)
Can anybody show me how to go about this? My current code is...
    elseif(isset($_POST['int1'])) {
        $interest = $_POST['int1'];
        $qResult= mysql_query("DELETE from user_interests WHERE interest = '" . mysql_real_escape_string($interest) . "' and user_id = " . $usersClass->userID());
        if(! $qResult )
            {
              die('Could not delete data: ' . mysql_error());
            }
    }
    if($interest1 != ''){
        print $interest1 . "<form method='post' action='#'><input type='hidden' value='".$interest1."' name='int1' id='int1'/><input type='submit' value='delete' /></form><br />";
    }

A: I would suggest using jQuery if you're just getting into AJAX -- it will make everything work cross-browser for you.
$('#id_of_your_submit_button').click(function(e){
    $.ajax({
       type: "GET",
       url: "where_you_put_your_php.php",
       data: "some_info=" + $('#your_input_or_whatever'),
       success: function(msg){
             $('#id_of_where_you_want_info_to_go').html(msg);
       }
    });
    e.preventDefault(); // Tell submit button not refresh page
});

Then your form info (data) will be in a variable called $_GET['some_info'] in the file you put your PHP in. echo out what you want to return to the document, and it will appear in the ID of where you want info to go (see names in code.)

A: Try going through this page http://roshanbh.com.np/2008/04/ajax-login-validation-php-jquery.html ... i think this is precisely what you need now. If you have any confusion feel free to reply here.

A: First: Read up on how to implement jQuery into your webpage.
Then you can use the jQuery framework to handle your ajax query.
First, create a block of code like this:
<?php
if(isset($_POST['ajax'])){
    //Your code goes here
}
?>

From there, create an Ajax function:
$('#submit_button_id').click(function(){
    jQuery.post('/webpage.php',{
        'ajax' : true
    },function(data){
        //Stuff for your page to do when your page call loads.
    },'html'
});

jQuery has a lot of documentation on their website so you should easily figure out how to use it.

A: First of all, use the jQuery library http://www.jquery.com! It greatly simplifies working with javascript. Then give your

<input type='submit' value='delete' id="delete_button" />

Reference the jQuery library (best to put it at the very bottom of your html, right above the  tag)
Then follow it with a snippet of jQuery code like this (you will probably need to alter it to suit your needs, but I tried to get pretty close)
<script type="text/javascript">

$(document).ready(function() { // this only happens when DOM is fully loaded

    $('#delete_button').click(function(e){

        var int1Val = $('#int1').val();

        $.post("your_page.php",
            { int1: int1Val, maybeSomeOtherVar: "coolbeans value" },
            function(data) { // if your_page.php sends any response back, then this function gets called
            alert("Data loaded from server POST: " + data);
        });

        $('#someMessageDivID').text(int1Val); // to immediately display the form value somewhere

        e.preventDefault(); // I'm not sure if you need this if you also have return false below, but I always put both just to make sure the form doesn't submit on its own, because we have already done it above
        return false;

    });

});

</script>

You can create some really snazzy desktop-feeling web pages with AJAX, so enjoy getting to know it. I hope this helps!


text:
Q: add textfield to tableviewheader I am trying to add textfield to header view. I could not figure out why I can't see my textfield. When I use a label it works perfectly.
Following is the code:
-(UIView*) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
       UIView *tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(40, 0, self.view.frame.size.width - 70, 30)];
    UITextField *sectionTitleTF1 = [[UITextField alloc] initWithFrame:CGRectMake(58, 0, 500, 30)];
    sectionTitleTF1.backgroundColor = [UIColor whiteColor];
    [sectionTitleTF1 becomeFirstResponder];
    [tableHeaderView addSubview:sectionTitleTF1];
return tableHeaderView;

}
Thanks

A: Have you implemented this method of the datasource? It is a must if you want your section header to show.
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 30.0;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

Also, if you are unaware, you can return the UITextField directly rather than adding as a subview. However you may want it as a subview, depending on what you want to achieve.
EDIT: Datasource not Delegate

A: Try this,
  You can adjust view, textfield frame based on your device ipad or iphone

 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 30.0;
}

-(UIView*) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(40, 0, self.view.frame.size.width - 70, 30)];
tableHeaderView.backgroundColor =[UIColor grayColor];
UITextField *sectionTitleTF1 = [[UITextField alloc] initWithFrame:CGRectMake(58, 0, 500, 30)];
sectionTitleTF1.backgroundColor = [UIColor whiteColor];
[sectionTitleTF1 setBackgroundColor:[UIColor whiteColor]];
[sectionTitleTF1 setFont:[UIFont boldSystemFontOfSize:15]];
[sectionTitleTF1 setBorderStyle:UITextBorderStyleLine];
[sectionTitleTF1 setTextAlignment:UITextAlignmentCenter];
[sectionTitleTF1 setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];
[sectionTitleTF1 becomeFirstResponder];
[tableHeaderView addSubview:sectionTitleTF1];
return tableHeaderView;
}

A: just add this
sectionTitleTF1.borderStyle = UITextBorderStyleRoundedRect;
then you will see it


text:
Q: Sorting Records from a binary file in C I am working on a program that is to use read(), write(), open(), and close() to deal with files. We are given a binary file of records to sort.
My confusion starts at the read step. From my understanding, read puts the file contents into a character array. So if I'm not totally off, it means each index contains a single byte of information. The records are each seperate by a space. I am to sort them by the first four bytes each contains.
I know the format of the records but data has a variable range. Luckily there are only spaces between records, none within a single one. The structure is one integer as a file header that says how many records there are. Each key is 4 bytes, followed by 4 bytes saying how much data there is, followed by the data all without spaces. The size of the data does not include the space.
Will a sort routine from the C library work with these being handled as characters and not integers? Also, I am not sure where to start with separating and rearranging the records. Would I have to extract each into an array of record structs and sort from there?
I am new to C and can't find much online using these specific functions. It was from a homework assignment but the due date has passed; I am just trying to get my understanding up to speed.

A: If the file is binary, as you write - then the records are not separated by anything, you just need to know the size of each record (all records probably have same size).
For sorting, you can use the standard library functions such as qsort. This function uses a callback that you provide, so it can work with any kind of data. After qsort returns, you will have the data rearranged.

Would I have to extract each into an array of record structs and sort from there?

Yes, for small number of records (as in a student assignment) this is a good option.

A: Test data generation
We don't have any sample data, so we have to create some.  Let's use plain text lines as the 'data' section, and we can generate random keys in the range 0..999, and report the length of the lines as the length of the data, and include the blank pad at the end of each record.
For example, this code does the generation job, reading from standard input and writing to standard output:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

int main(void)
{
    srand(time(0));

    int fd = STDOUT_FILENO;
    char *buffer = 0;
    size_t buflen = 0;
    int len;
    while ((len = getline(&buffer, &buflen, stdin)) != -1)
    {
        int key = rand() % 1000;
        write(fd, &key, sizeof(key));
        write(fd, &len, sizeof(len));
        write(fd, buffer, len);
        write(fd, " ", 1);
    }
    free(buffer);
    return 0;
}

Given the input file (search on 'great panjandrum' to find out where the text comes from — it is not meant to be very sensible):
So she went into the garden
to cut a cabbage-leaf
to make an apple-pie
and at the same time
a great she-bear coming down the street
pops its head into the shop
What no soap
So he died
and she very imprudently married the Barber
and there were present
the Picninnies
and the Joblillies
and the Garyulies
and the great Panjandrum himself
with the little round button at top
and they all fell to playing the game of catch-as-catch-can
till the gunpowder ran out at the heels of their boots

the output could be:
0x0000: C3 03 00 00 1C 00 00 00 53 6F 20 73 68 65 20 77   ........So she w
0x0010: 65 6E 74 20 69 6E 74 6F 20 74 68 65 20 67 61 72   ent into the gar
0x0020: 64 65 6E 0A 20 C7 01 00 00 16 00 00 00 74 6F 20   den. ........to
0x0030: 63 75 74 20 61 20 63 61 62 62 61 67 65 2D 6C 65   cut a cabbage-le
0x0040: 61 66 0A 20 6C 03 00 00 15 00 00 00 74 6F 20 6D   af. l.......to m
0x0050: 61 6B 65 20 61 6E 20 61 70 70 6C 65 2D 70 69 65   ake an apple-pie
0x0060: 0A 20 6F 02 00 00 15 00 00 00 61 6E 64 20 61 74   . o.......and at
0x0070: 20 74 68 65 20 73 61 6D 65 20 74 69 6D 65 0A 20    the same time.
0x0080: 80 02 00 00 28 00 00 00 61 20 67 72 65 61 74 20   ....(...a great
0x0090: 73 68 65 2D 62 65 61 72 20 63 6F 6D 69 6E 67 20   she-bear coming
0x00A0: 64 6F 77 6E 20 74 68 65 20 73 74 72 65 65 74 0A   down the street.
0x00B0: 20 F5 02 00 00 1C 00 00 00 70 6F 70 73 20 69 74    ........pops it
0x00C0: 73 20 68 65 61 64 20 69 6E 74 6F 20 74 68 65 20   s head into the
0x00D0: 73 68 6F 70 0A 20 10 01 00 00 0D 00 00 00 57 68   shop. ........Wh
0x00E0: 61 74 20 6E 6F 20 73 6F 61 70 0A 20 4F 02 00 00   at no soap. O...
0x00F0: 0B 00 00 00 53 6F 20 68 65 20 64 69 65 64 0A 20   ....So he died.
0x0100: 73 01 00 00 2C 00 00 00 61 6E 64 20 73 68 65 20   s...,...and she
0x0110: 76 65 72 79 20 69 6D 70 72 75 64 65 6E 74 6C 79   very imprudently
0x0120: 20 6D 61 72 72 69 65 64 20 74 68 65 20 42 61 72    married the Bar
0x0130: 62 65 72 0A 20 60 01 00 00 17 00 00 00 61 6E 64   ber. `.......and
0x0140: 20 74 68 65 72 65 20 77 65 72 65 20 70 72 65 73    there were pres
0x0150: 65 6E 74 0A 20 0D 00 00 00 0F 00 00 00 74 68 65   ent. ........the
0x0160: 20 50 69 63 6E 69 6E 6E 69 65 73 0A 20 46 02 00    Picninnies. F..
0x0170: 00 13 00 00 00 61 6E 64 20 74 68 65 20 4A 6F 62   .....and the Job
0x0180: 6C 69 6C 6C 69 65 73 0A 20 88 02 00 00 12 00 00   lillies. .......
0x0190: 00 61 6E 64 20 74 68 65 20 47 61 72 79 75 6C 69   .and the Garyuli
0x01A0: 65 73 0A 20 92 00 00 00 21 00 00 00 61 6E 64 20   es. ....!...and
0x01B0: 74 68 65 20 67 72 65 61 74 20 50 61 6E 6A 61 6E   the great Panjan
0x01C0: 64 72 75 6D 20 68 69 6D 73 65 6C 66 0A 20 A8 01   drum himself. ..
0x01D0: 00 00 24 00 00 00 77 69 74 68 20 74 68 65 20 6C   ..$...with the l
0x01E0: 69 74 74 6C 65 20 72 6F 75 6E 64 20 62 75 74 74   ittle round butt
0x01F0: 6F 6E 20 61 74 20 74 6F 70 0A 20 15 01 00 00 3C   on at top. ....<
0x0200: 00 00 00 61 6E 64 20 74 68 65 79 20 61 6C 6C 20   ...and they all
0x0210: 66 65 6C 6C 20 74 6F 20 70 6C 61 79 69 6E 67 20   fell to playing
0x0220: 74 68 65 20 67 61 6D 65 20 6F 66 20 63 61 74 63   the game of catc
0x0230: 68 2D 61 73 2D 63 61 74 63 68 2D 63 61 6E 0A 20   h-as-catch-can.
0x0240: B1 03 00 00 37 00 00 00 74 69 6C 6C 20 74 68 65   ....7...till the
0x0250: 20 67 75 6E 70 6F 77 64 65 72 20 72 61 6E 20 6F    gunpowder ran o
0x0260: 75 74 20 61 74 20 74 68 65 20 68 65 65 6C 73 20   ut at the heels
0x0270: 6F 66 20 74 68 65 69 72 20 62 6F 6F 74 73 0A 20   of their boots.
0x0280:

Sorting the generated data
Now we have data that can be processed by a program to read, print, sort, and print the data.
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

struct record
{
    int   key;
    int   data_len;
    char  data[];
};

static int comparator(const void *v1, const void *v2);
static void print_records(const char *tag, int num_recs, struct record **recs);
static void err_syserr(const char *msg, ...);
static void err_setarg0(const char *argv0);

int main(int argc, char **argv)
{
    if (argc != 2)
    {
        fprintf(stderr, "Usage: %s file\n", argv[0]);
        return 1;
    }

    err_setarg0(argv[0]);

    int fd = open(argv[1], O_RDONLY);
    if (fd < 0)
        err_syserr("Failed to open file '%s' for reading\n", argv[1]);

    struct record **records = 0;
    int num_recs = 0;
    int max_recs = 0;
    int key;
    int len;
    while (read(fd, &key, sizeof(key)) == sizeof(key) &&
           read(fd, &len, sizeof(len)) == sizeof(len))
    {
        //printf("rec num %d (key %d, len %d)\n", num_recs, key, len);
        assert(len > 0);
        assert(num_recs <= max_recs);
        if (num_recs == max_recs)
        {
            size_t new_max = 2 * max_recs + 2;
            void *new_recs = realloc(records, new_max * sizeof(*records));
            if (new_recs == 0)
                err_syserr("Failed to realloc() %zu bytes of memory\n", new_max * sizeof(*records));
            records = new_recs;
            max_recs = new_max;
        }
        int rec_size = sizeof(struct record) + len;
        records[num_recs] = malloc(rec_size);
        records[num_recs]->key = key;
        records[num_recs]->data_len = len;
        if (read(fd, records[num_recs]->data, len) != len)
            err_syserr("Short read for record number %d (key %d)\n", num_recs, key);
        records[num_recs]->data[len-1] = '\0';
        //printf("Data: [%s]\n", records[num_recs]->data);
        char blank = 0;
        if (read(fd, &blank, sizeof(blank)) != sizeof(blank))
            err_syserr("Missing record terminator after record number %d (key %d)\n", num_recs, key);
        if (blank != ' ')
            err_syserr("Unexpected EOR code %d for record number %d (key %d)\n", blank, num_recs, key);
        num_recs++;
    }
    close(fd);

    print_records("Before", num_recs, records);
    qsort(records, num_recs, sizeof(struct record *), comparator);
    print_records("After", num_recs, records);

    for (int i = 0; i < num_recs; i++)
        free(records[i]);
    free(records);

    return 0;
}

static int comparator(const void *v1, const void *v2)
{
    int key_1 = (*(struct record **)v1)->key;
    int key_2 = (*(struct record **)v2)->key;
    if (key_1 < key_2)
        return -1;
    else if (key_1 > key_2)
        return +1;
    else
        return 0;
}

static void print_records(const char *tag, int num_recs, struct record **recs)
{
    printf("%s (%d records):\n", tag, num_recs);
    for (int i = 0; i < num_recs; i++)
    {
        struct record *rec = recs[i];
        printf("%6d: %4d: %s\n", rec->key, rec->data_len, rec->data);
    }
}

/* My standard error handling - stderr.h and stderr.c */
static const char *arg0 = "unknown";

static void err_setarg0(const char *argv0)
{
    arg0 = argv0;
}

static void err_syserr(const char *fmt, ...)
{
    va_list args;
    int errnum = errno;
    fprintf(stderr, "%s: ", arg0);
    va_start(args, fmt);
    vfprintf(stderr, fmt, args);
    va_end(args);
    if (errnum != 0)
        fprintf(stderr, "(%d: %s)\n", errnum, strerror(errnum));
    exit(EXIT_FAILURE);
}

The code exploits the knowledge that the data for each record ends with a newline, and it overwrites that newline with a null byte.  That makes the presentation better, too.  Also, note that you cannot create an array of structures with flexible array members (because the elements of an array are all the same size, and structures with flexible array members are not all the same size).  Hence the code uses an array of pointers to structures with flexible array members.  That affects the comparator function, amongst others.
In part because the data format is moderately complex, the code is careful to identify erroneous (malformatted) data.
Sample run
Note that the first column in the output is the record key — the goal is to sort the data into ascending order of the key numbers.  The second column is the data length.
Before (17 records):
   963:   28: So she went into the garden
   455:   22: to cut a cabbage-leaf
   876:   21: to make an apple-pie
   623:   21: and at the same time
   640:   40: a great she-bear coming down the street
   757:   28: pops its head into the shop
   272:   13: What no soap
   591:   11: So he died
   371:   44: and she very imprudently married the Barber
   352:   23: and there were present
    13:   15: the Picninnies
   582:   19: and the Joblillies
   648:   18: and the Garyulies
   146:   33: and the great Panjandrum himself
   424:   36: with the little round button at top
   277:   60: and they all fell to playing the game of catch-as-catch-can
   945:   55: till the gunpowder ran out at the heels of their boots
After (17 records):
    13:   15: the Picninnies
   146:   33: and the great Panjandrum himself
   272:   13: What no soap
   277:   60: and they all fell to playing the game of catch-as-catch-can
   352:   23: and there were present
   371:   44: and she very imprudently married the Barber
   424:   36: with the little round button at top
   455:   22: to cut a cabbage-leaf
   582:   19: and the Joblillies
   591:   11: So he died
   623:   21: and at the same time
   640:   40: a great she-bear coming down the street
   648:   18: and the Garyulies
   757:   28: pops its head into the shop
   876:   21: to make an apple-pie
   945:   55: till the gunpowder ran out at the heels of their boots
   963:   28: So she went into the garden


text:
Q: WHERE IS NULL Not Working in Nested Select INSERT INTO AutomatedTest_XMLReconciliation(TaskID, TestCaseID, TestInstanceID, XMLHierarchyLevelID, XMLNode, XMLValue_Truth, XMLValue_Test)
(
(SELECT A.TaskID, A.TestCaseID, NULL, A.XMLHierarchyLevelID, A.XMLNode, A.XMLValue_Truth, NULL
FROM AutomatedTest_XMLTruthData A
LEFT JOIN AutomatedTest_Auth B
ON A.TestCaseID = B.TestCaseID
FULL Join AutomatedTest_XMLTestData C
ON B.TestInstanceID = C.TestInstanceID AND A.TruthIdentity = C.TestIdentity AND A.XMLHierarchyLevelID = C.XMLHierarchyLevelID AND A.XMLNode = C.XMLNode AND A.TaskID = C.TaskID
WHERE (B.ReconcileDate IS NULL AND A.TaskID IS NOT NULL)

EXCEPT
   (Select A.TaskID, A.TestCaseID, NULL, A.XMLHierarchyLevelID, A.XMLNode, A.XMLValue_Truth, NULL
    FROM AutomatedTest_XMLTruthData A
    INNER JOIN AutomatedTest_Auth B
    ON A.TestCaseID = B.TestCaseID
    INNER JOIN AutomatedTest_XMLTestData C
    ON B.TestInstanceID = C.TestInstanceID AND A.TruthIdentity = C.TestIdentity AND A.XMLHierarchyLevelID = C.XMLHierarchyLevelID AND A.XMLNode = C.XMLNode AND A.TaskID = C.TaskID)
)

UNION

(SELECT C.TaskID, NULL, C.TestInstanceID, C.XMLHierarchyLevelID, C.XMLNode, NULL, C.XMLValue_Test
FROM AutomatedTest_XMLTruthData A
LEFT JOIN AutomatedTest_Auth B
ON A.TestCaseID = B.TestCaseID
FULL JOIN AutomatedTest_XMLTestData C
ON B.TestInstanceID = C.TestInstanceID AND A.TruthIdentity = C.TestIdentity AND A.XMLHierarchyLevelID = C.XMLHierarchyLevelID AND A.XMLNode = C.XMLNode AND A.TaskID = C.TaskID
WHERE B.ReconcileDate IS NULL AND C.TaskID IS NOT NULL)

EXCEPT
   (Select C.TaskID, NULL, C.TestInstanceID, C.XMLHierarchyLevelID, C.XMLNode, NULL, C.XMLValue_Test
    FROM AutomatedTest_XMLTruthData A
    INNER JOIN AutomatedTest_Auth B
    ON A.TestCaseID = B.TestCaseID
    INNER JOIN AutomatedTest_XMLTestData C
    ON B.TestInstanceID = C.TestInstanceID AND A.TruthIdentity = C.TestIdentity AND A.XMLHierarchyLevelID = C.XMLHierarchyLevelID AND A.XMLNode = C.XMLNode AND A.TaskID = C.TaskID)
))

UPDATE AutomatedTest_Auth
SET ReconcileDate = GETDATE()
WHERE (TestCaseID IN (Select TestCaseID FROM AutomatedTest_DataReconciliation WHERE TestCaseID IS NOT NULL)
OR TestInstanceID IN (Select TestInstanceID FROM AutomatedTest_DataReconciliation WHERE TestInstanceID IS NOT NULL))
AND ReconcileDate IS NULL

So I've got this insert query that is meant to check two tables, one test and one auth, and compare their rows. It matches a TestInstance in the test table with a TestCase in a truth table through the AutomatedTest_Auth table.
Once it is done, it updates the AutomatedTest_Auth table with the GETDATE() stamp to show that the reconciliation process is complete. The insert checks this in the WHEREs to make sure that it does not insert anything that is already inserted by making sure the ReconcileDate IS NULL (it defaults to null on upon a new entry into the AutomatedTest_Auth table).
My problem, however, is that the second "B.Reconcile IS NULL" is not working. Upon running this twice, it will pick up the same rows from AutomatedTest_XMLTestData it picked up the first time and insert them again. (Just a note, there is no PK violation, as the Reconciliation columns could overlap at any time; it has an identity column instead).
Is this an order of operations issue? ... a bug? Any help would be nice.
Also, when I change the B.ReconcileDate IS NULL to IS NOT NULL, the insert swaps, and it will instead insert the same rows from AutomatedTest_XMLTruthData and not AutomatedTest_XMLTestData, so I know the inserts from AutomatedTest_XMLTruthData are correctly recognizing the WHERE clause, and that AutomatedTest_XMLTestData is incorrectly inverting the B.ReconcileData IS NULL to IS NOT NULL.

A: You are inserting into a table called AutomatedTest_XMLReconciliation
The update where condition looks at a table called AutomatedTest_DataReconciliation which is not referenced elsewhere in your script. Is this correct? I think the Update should be:
UPDATE AUTOMATEDTEST_AUTH
SET    RECONCILEDATE = GETDATE()
WHERE  ( TESTCASEID IN (SELECT TESTCASEID
                        FROM   AUTOMATEDTEST_XMLRECONCILIATION
                        WHERE  TESTCASEID IS NOT NULL)
          OR TESTINSTANCEID IN (SELECT TESTINSTANCEID
                                FROM   AUTOMATEDTEST_XMLRECONCILIATION
                                WHERE  TESTINSTANCEID IS NOT NULL) )
       AND RECONCILEDATE IS NULL


text:
Q: Invalid Doctrine Entity being created I'm working on a web project that contains a mixture of Doctrine and traditional inline SQL for database access.  We're migrating from the latter to the former over time.
One of the database tables (Table A) has an informal foreign key (i.e. there are no actual constraints in the SQL table definition) column.  The value in this column is nullable, but sometimes the value in this column refers to a another table's (Table B) primary key that has since been deleted.
Table A's relationship with Table B is formalised in Table A's entity definition in Doctrine.  When I create an instance of an entity from an existing row in Table A and the informal foreign key column has a value that is no longer in Table B, then it seems an invalid Table B entity is created.  I.e. the object is set, and I can query it's id through the TableB->getId() method we have authored, but any other TableB->getProperty() fails and throws an error.
Since I'm already working with historic data, I need a run-time solution to this.  I need to identify via a check if the Table B entity is valid.
I could put it in a try-catch loop, but this is not a common pattern in our code base and does not seem very elegant.
Is there a canonical method for checking the validatity of a Doctrine entity to solve this problem?
Thank you

A: As I see it, there are 2 things you should do.
First fix your data corruption, this is a must. If A points to a non-existing B, then A should not be pointing at all. SELECT a.id FROM table_a a LEFT JOIN table_b b ON b.id = a.table_b_id WHERE b.id IS NULL. This query will select all FK that are not existing anymore, you can simply update the a.table_b_id to NULL with that list.
Second, you should (not in your getter) take care of the relation issue in your code. I'm not sure if Doctrine throws an EntityNotFoundException or only does this with find($pk), but I'm sure you can check if the return of your getter is null or catch that exception.


text:
Q: Implement Variadic function in C I am trying to write wrapper for a log function with a printf-like behavior.
Can anyone tell me why the following example does not work?
#include <stdarg.h>

void message(int level, const char* format, ...)
{
    if(level > 3)
        return;

    static char msgBuff[1024] = {0};

    va_list argptr;
    va_start(argptr, format);
    snprintf(msgBuff, sizeof(msgBuff), format, argptr);
    va_end(argptr);
    printf("%s", msgBuff); // Dummy Call
}

int main()
{
    int a = 42;
    message(3, "This is a test: %s %i", "The answer is ", a);
    return 0;
}

Output:
This is a test:  0

A: The arguments to snprintf after the format string must be the individual arguments expected according to the conversion specifiers in the format string. argptr is not such an argument, so the call is incorrect.
To print variable arguments using a va_list, call vsnprintf instead of snprintf.


text:
Q: Training SVM yields predictions of only 1 I'm provided with the following dataset: Dataset. I'm meant to use sklearn to create a Support Vector Machine that can predict it.
I load A and B from my dataset into a 2 dimensional array called input_data and load the label from my dataset into an array called label.
First of all I'm scaling A and B to fit in the range of -1 to 1 using
sklearn.preprocessing.MinMaxScaler.
input_data = np.array(input_data)
minmax = pre.MinMaxScaler(feature_range=(-1,1))
input_data = minmax.fit(input_data).transform(input_data)
label = np.array(label)

Then I use sklearn.model_selection.train_test_split to stratify and split my data keeping 40% for my test set and 60% for my training set.
model_selector = model_selection
X_train, X_test, y_train, y_test = model_selector.train_test_split(input_data, label, stratify=label, test_size=0.4)

After that I use sklearn.model_selection.GridSearchCV to try and come up with the optimal parameters (in my case only C).
gscv = model_selector.GridSearchCV
clf = gscv(svm.SVC(), tuned_parameters, cv=5, scoring='precision')
clf.fit(X_train, y_train)

After that I evaluate my results, but my Support Vector Machine just outputs 1 no matter what the input is, I'm not sure what exactly I'm doing wrong so after trying to figure things out by reading the documentation for a few hours I decided to ask for help, can anyone point out to me what I'm doing wrong? I'm pretty new in this area so my mistake is probably something simple I missed. Thanks in advance for any advice!
Here's an image of the dataset using a scatter plot:

A: What is tuned_parameters?
If I train SVC with default parameters on your dataset, it works fine with 61% accuracy, predicting both classes.
model.predict(X_test) with the model trained with your parameters outputs both 0 and 1 for me, with 98% accuracy:
model = svm.SVC(kernel = 'rbf', C=10, gamma=10)
model.fit(X_train, y_train)
print(model.predict(X_test))
print(model.score(X_test, y_test))

So the question is, how do you check what the model outputs on your test set? You may have a mistake there.


text:
Q: Alternative model to mod_rewrite maps I'm trying to come up to an alternative to to mod_rewrite maps.
I need an engine that is capable of efficiently dealing with thousands of rewrite rules, also with "wildcards" or patterns, that can be controlled by an external program (something with a user interface to control it).  I am fairly confident that I could write such an engine as an external program with a combination of a c based frontend and a python backend communicating with unix sockets.
The problem I have is that apache will only start one instance of the program and the solution has to be able to scale to thousands of requests per second.  I'm worried that no matter how well I code the program that with a single instance and single thread it could become a bottle neck.
I've considered using dbm style maps, and they do seem to perform quite well, but there is no way to do anything with wild cards/regex etc.
Unfortunately apache is a requirement and I don't really want to go down the route of another process acting as a pass through.
All I can think of right now is writing a new module for apache but it seems a little excessive.
Another option would be to write a remap config on the fly and do an apache graceful but that feels a little dangerous.
Does anybody have any suggestions or thoughts?  Or know of a method of implementing DBM style maps with stored regexs?

A: Write an Apache module. It will be very fast and is not particularly complicated - you only need to implement a couple of the hook functions.


text:
Q: Combining multiple Mobile Phone Internet Connection (to get high speed) I want to combine multiple mobile 4G internet(Jio) phone connection (Usb Tethering or hot spot) to get high speed internet on my Mac OS X.
Solution that i checked are -

*

*Use paid software speedify. (costly)

*Use Hardware ZifiLink (costly)

*First convert from usb to RJ45 (not sure how to do it without using multiple routers) then put Loadbalancer

*Install software like dispatch-proxy (not sure how well will it perform)

If you know some very good/efficient way to do it, please mention it will help others as well ( because many people are working from remote location due to COVID-19)

A: Short answer: Use a Router.
Long answer: Balancing over multiple connections is nothing, that OSX is very good at natively and you might run into problems with some software, that makes deeper assumptions than are (and stay) valid.
A tiny box running pfSense with multiple gateways will be easily able to do your network magic on the WAN side and expose a single link on the LAN side, to which you can connect your device(s)
In pfSense you start by creating your WAN connections individually, then combine them into a gateway group.