Add color to .obj in ThreeJS

I am new to ThreeJS and have a simple question. I have the following code that will work properly, but I cannot add color to my .obj. The short and narrow of it is that I designed a game controller in Solidworks 2012, then I exported the CAD file as a .stl. I then used MeshLab to export the .stl as a .obj. Now I use the .obj in ThreeJS and it works, but I cannot for the life of me get color added to the .obj. Here is the code

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>three.js webgl - loaders - vtk loader</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <style>
            body {
                font-family: Monospace;
                background-color: #000;
                color: #fff;
                margin: 0px;
                overflow: hidden;
            }
            #info {
                color: #fff;
                position: absolute;
                top: 10px;
                width: 100%;
                text-align: center;
                z-index: 100;
                display:block;
            }
            #info a, .button { color: #f00; font-weight: bold; text-decoration: underline; cursor: pointer }
        </style>
    </head>

    <body>
        <div id="info">
        <a href="" target="_blank">three.js</a> -
        vtk format loader test -
        model from <a href="" target="_blank">The GeorgiaTech Lagre Geometric Model Archive</a>,
        </div>

        <script src="three.min.js"></script>

        <script src="TrackballControls.js"></script>

        <script src="OBJLoader.js"></script>
        <script src="BinaryLoader.js"></script>
        <script src="Detector.js"></script>
        <script src="stats.min.js"></script>

        <script>

            if ( ! Detector.webgl ) Detector.addGetWebGLMessage();

            var container, stats;

            var camera, controls, scene, renderer;

            var cross;

            init();
            animate();

            function init() {

                camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.01, 1e10 );
                camera.position.z = 200;
                camera.position.y = 200;

                controls = new THREE.TrackballControls( camera );

                controls.rotateSpeed = 5.0;
                controls.zoomSpeed = 5;
                controls.panSpeed = 2;

                controls.noZoom = false;
                controls.noPan = false;

                controls.staticMoving = true;
                controls.dynamicDampingFactor = 0.3;

                scene = new THREE.Scene();

                scene.add( camera );

                // light

                var dirLight = new THREE.DirectionalLight( 0xffffff );
                dirLight.position.set( 20, 20, 100 ).normalize();

                camera.add( dirLight );
                camera.add( dirLight.target );

                // texture

                var manager = new THREE.LoadingManager();
                manager.onProgress = function ( item, loaded, total ) {

                    console.log( item, loaded, total );

                };

                var texture = new THREE.Texture();

                var loader = new THREE.ImageLoader( manager );
                loader.load( 'bigthumbnail.jpg', function ( image ) {

                    texture.image = image;
                    texture.needsUpdate = true;

                } );

                var loader = new THREE.OBJLoader()
                loader.load( 'Gamepad.obj', function ( object ) {

                    object.position.y = 0;
                    scene.add( object );

                } );
                // renderer

                renderer = new THREE.WebGLRenderer( { antialias: false } );
                renderer.setSize( window.innerWidth, window.innerHeight );

                container = document.createElement( 'div' );
                document.body.appendChild( container );
                container.appendChild( renderer.domElement );

                stats = new Stats();
                stats.domElement.style.position = 'absolute';
                stats.domElement.style.top = '0px';
                container.appendChild( stats.domElement );

                //

                window.addEventListener( 'resize', onWindowResize, false );

            }

            function onWindowResize() {

                camera.aspect = window.innerWidth / window.innerHeight;
                camera.updateProjectionMatrix();

                renderer.setSize( window.innerWidth, window.innerHeight );

                controls.handleResize();

            }

            function animate() {

                requestAnimationFrame( animate );

                controls.update();
                renderer.render( scene, camera );

                stats.update();

            }

        </script>

    </body>
</html>

I have poured through the threejs.org website and looked at most of the examples. All of the examples that use complex colors use .bin files or .js files. So I downloaded Python 2.7.6, installed it and ran convert_obj_three.py. This generated a .js file, but I'm not sure it is correctly formatted. Unfortunately, The output that convert_obj_three.py gave me is too large to post. My Second question is which file format is best for complex coloring, like chrome blue? .bin, .js or can I use .obj? If using a .js is the best way to go then how can I reliably convert the .obj file to .js? By the way, I tried using the .js that was created by convert_obj_three.py, but the webpage is blank all the time. Seems I cannot load the .js using THREE.JSONLoader().

Thanks in advance.


VB.NET WPF NullReference Exception

I have a TreeView with a parent node and two children node. Each of the nodes contain a checkbox stored in a TreeViewItem. I want the two children node checkboxes to be set to IsChecked=true when the user checks the parent node and I want the two children node checkboxes to be IsChecked=false when the user unchecks the parent node.

I have a for loop in which the child node checkboxes are stored in a list. The parent node checkbox check/uncheck event should iterate through the child node checkbox list but I am having a problem aceess the list. For some reason the list equals "nothing" in the parent node check/uncheck event. Can anyone explain how I should be accessing that list?

Here's My Code:

Public Class Question

Dim childCheckbox As CheckBox
Dim childCheckboxes() As CheckBox

Public Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

    Dim parentCheckbox = New CheckBox
    Dim parentNode = New TreeViewItem

    parentCheckbox.Uid = "All Sites"

    AddHandler parentCheckbox.Checked, AddressOf chkbox_AllChecked
    AddHandler parentCheckbox.Unchecked, AddressOf chkbox_AllUnchecked

    parentCheckbox.Content = "All Sites"
    parentNode.Header = parentCheckbox

    For Each osite In sites

                Dim childNode = New TreeViewItem
                Dim childCheckbox = New CheckBox

                AddHandler childCheckbox.Checked, AddressOf chkbox_Checked
                AddHandler childCheckbox.Unchecked, AddressOf chkbox_Unchecked

                childCheckbox.Uid = osite.SiteName.ToString

                childCheckbox.Content = osite.SiteName.ToString
                childNode.Header = childCheckbox
                parentNode.Items.Add(childNode)

                'Add all childCheckbox to an array for use by parentChildbox methods to check/uncheck all
                childCheckboxes(i) = childCheckbox

                i += 1

            Next
            TreeView1.Items.Add(parentNode)

    End Sub

Private Sub chkbox_AllChecked(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim chk = DirectCast(sender, CheckBox)

            'MessageBox.Show(chk.Uid.ToString)

            'This part doesn't work.
            For Each child In childCheckboxes
                child.IsChecked = True
            Next

    End Sub

Private Sub chkbox_Checked(ByVal sender As Object, ByVal e As RoutedEventArgs)
  Dim chk = DirectCast(sender, CheckBox)

            'MessageBox.Show("Check!")
            MessageBox.Show(chk.Uid.ToString)

End Sub

Private Sub chkbox_Unchecked(ByVal sender As Object, ByVal e As RoutedEventArgs)
   Dim chk = DirectCast(sender, CheckBox)

          'MessageBox.Show("Uncheck!")
           MessageBox.Show(chk.Uid.ToString)

End Sub

End Class

Thanks for the help!


BitmapImage from file PixelFormat is always bgr32

I am loading an image from file with this code:

BitmapImage BitmapImg = null;
BitmapImg = new BitmapImage();
BitmapImg.BeginInit();
BitmapImg.UriSource = new Uri(imagePath);
BitmapImg.CacheOption = BitmapCacheOption.OnLoad;
BitmapImg.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
BitmapImg.EndInit();

It works as expected except for the fact that no matter what kind of image I'm loading (24bit RGB, 8bit grey, 12bit grey,...), after .EndInit() the BitmapImage always has as Format bgr32. I know there have been discussions on the net, but I have not found any solution for this problem.
Does anyone of you know if it has been solved yet?

Thanks,

tabina


How to find the sum of values of a column in a ListView

I am Using vb 2008 with mysql express 2005
i have a viewlist box with some data like

========================================================
product id        product name            product rate
========================================================

12                     ANYONE                     50
12                     ANYONE                     100

========================================================

I want to add(sum) all of data given in PRODUCT RATE means column3

then sum will be shown in an text box


Do I need any kind of java installation on a webserver that hosts java applets?

A webserver hosting java applets doesn't necessarily need java installed on it, right?
It's the clients computer that views the applets that needs a java jre installation or similar?
Or do I get this wrong?
Thanks!


Move element with responsive CSS in GWT

I have three elements like this in GWT:

HorizontalPanel picturePanel = new HorizontalPanel();
picturePanel.setStylePrimaryName("picturePanel");
image.setStylePrimaryName("picture");
leftArrow.setStylePrimaryName("arrow-left");
rightArrow.setStylePrimaryName("arrow-right");
picturePanel.add(leftArrow);
picturePanel.add(image);
picturePanel.add(rightArrow);

Which currently becomes the following structure after the GWT compilation:

<table class="picture-container">
    ...
    <td align="left" style="vertical-align: top;">
        <img class="arrow-left" src="../images/icons/left2.svg"></img>
    </td>
    <td align="left" style="vertical-align: top;">
        <img class="picture mission-picture" src="../pictures/d5edc879-fe9b-4980-92e3-9bb4ac020abb.jpg"></img>
    </td>
    <td align="left" style="vertical-align: top;">
        <img class="arrow-right" src="../images/icons/right2.svg"></img>
    </td>
</table>

This HTML structure might very well(hopefully) be changed in the next version of GWT. To the question, is it possible to write CSS for this (without caring about the current HTML structure) so that the arrow-left and arrow-right will appear centered underneath the image, instead of on the sides? Note that the size of the picture is dynamic. I preferably don't want to change the GWT code as the CSS code is to be used only when the page gets smaller than a certain width, like

@media only screen and (max-width: 420px) {
    .arrow-left{}
    .arrow-right{}
}

Update:

I've tried a different approach by having a ResizeHandler in the GWT code that moves the arrows to a different panel underneath the image once the width becomes smaller than 420px. It works, but I think it would be a lot more efficient and handy to have it in the CSS. This solution feels a bit like an ugly hack and it makes me sad.

Here is a jsfiddle where you can try the described the problem: http://jsfiddle.net/YZSAr/


Android Global Data Binding

Can anybody give me a suggestion for android data binding.

I want my android application view components tied to a global data model.

This data model might be setted in Application object in application loading phase.

And later, once this data modal be modified, can appear in application immediately.


I wrote a python script for file manipulations, Since I don't know the way to redirect output file from one python script as input file in another python script, I have to run both the scripts separately. I want to learn as to how to pass on the output file from one script as input file for another script. Can someone please guide me regarding this query?


FOR XML multiple control by attribute in tree concept

I want to figure out one issue.

I already had question about simple ordering issue but I want to order more detail.
check below this link :
SQL Server : FOR XML sorting control by attribute

I made a example case.

SQL Query.

select (
    select '123' AS '@id', (
        select
        (
            select 'test' AS '@testid' , '20' AS '@order'
            FOR XML path ('tree') , TYPE
        ),
        (
            select 'test2' AS '@testid' , '30' AS '@order'
            FOR XML path ('tree-order') , TYPE
        ),
        (
            select 'test' AS '@testid' , '10' AS '@order'
            FOR XML path ('tree') , TYPE
        )
        FOR XML path ('Node') , TYPE
    )
    FOR XML path ('Sample') , TYPE
    ),
    (select '456' AS '@id', (
        select
        (
            select 'test' AS '@testid' , '20' AS '@order'
            FOR XML path ('tree') , TYPE
        ),
        (
            select 'test2' AS '@testid' , '30' AS '@order'
            FOR XML path ('tree-order') , TYPE
        ),
        (
            select 'test' AS '@testid' , '10' AS '@order'
            FOR XML path ('tree') , TYPE
        )
        FOR XML path ('Node') , TYPE
    )
    FOR XML path ('Sample') , TYPE)
FOR XML path ('Main') , TYPE

Result :

<Main>
  <Sample id="123">
    <Node>
      <tree testid="test" order="20" />
      <tree-order testid="test2" order="30" />
      <tree testid="test" order="10" />
    </Node>
  </Sample>
  <Sample id="456">
    <Node>
      <tree testid="test" order="20" />
      <tree-order testid="test2" order="30" />
      <tree testid="test" order="10" />
    </Node>
  </Sample>
</Main>

Expected result :

<Main>
  <Sample id="123">
    <Node>
      <tree testid="test" order="10" />
      <tree testid="test" order="20" />
      <tree-order testid="test2" order="30" />
    </Node>
  </Sample>
  <Sample id="456">
    <Node>
      <tree testid="test" order="10" />
      <tree testid="test" order="20" />
      <tree-order testid="test2" order="30" />
    </Node>
  </Sample>
</Main>

final result :

<Main>
  <Sample id="123">
    <Node>
      <tree testid="test" />
      <tree testid="test" />
      <tree-order testid="test2" />
    </Node>
  </Sample>
  <Sample id="456">
    <Node>
      <tree testid="test" />
      <tree testid="test" />
      <tree-order testid="test2" />
    </Node>
  </Sample>
</Main>

That's order by tree-order.

finally I don't want to show order information in attribute

Any one has great Idea?

Thank you for everybody who interesting to this.

Updated ----------------------------------------

Thank you every body finally I solved problem as below about order by and remove attribute issue :

declare @resultData xml = (select @data.query('
  element Main {
    for $s in Main/Sample
    return element Sample {
      $s/@*,
      for $n in $s/Node
      return element Node {
        for $i in $n/*
        order by $i/@order
        return $i
      }
    }
  }'));

  SET @resultData.modify('delete (Main/Sample/Node/tree/@order)');
  SET @resultData.modify('delete (Main/Sample/Node/tree-order/@order)');

  select @resultData


Windows Service installation - current directory

this question is related to my  previous one . I've written a service in C# and I need to make it's name dynamic and load the name from configuration file. The problem is that current directory while the service installer is invoked is the net framework 4 directory instead of the one that my assembly sits in.

Using the line (which helps with the same problem, but while the service is already running)
System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);

sets the directory to

C:\Windows\Microsoft.NET\Framework\v4.0.30319

which was also the initial value.

How to get the right path?


XML validation fails on attributes

I've some problem validating an xml against a schema that i defined. The weird thing is that the validation fails only if I use the default namespace xmlns="http://retis.sssup.it/duck-lab" while it works like a charm if I define it like xmlns:dl="http://retis.sssup.it/duck-lab".

When I use the empty namespace the validation fails only on the attributes with the following messages:

cvc-complex-type.3.2.2: Attribute 'data_len' is not allowed to appear in element 'data'.
cvc-complex-type.4: Attribute 'data_len' must appear on element 'data'.

VALID XML:

<dl:duck xmlns:dl="http://retis.sssup.it/duck-lab" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://retis.sssup.it/duck-lab ../duck.xsd ">
...
        <dl:data dl:data_len="1" dl:data_name="name uint" dl:data_type="uint16" dl:endianess="big-endian"/>

INVALID XML:

<duck xmlns="http://retis.sssup.it/duck-lab" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://retis.sssup.it/duck-lab ../duck.xsd ">
...
    <data data_len="1" data_name="name uint" data_type="uint16" endianess="big-endian"/>

--EDIT--

DUCK.XSD

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://retis.sssup.it/duck-lab"
    xmlns:dl="http://retis.sssup.it/duck-lab" elementFormDefault="qualified">

    <include schemaLocation="datatypes.xsd"/>
    <include schemaLocation="duck_message.xsd"/>

    <complexType name="DuckDefinitionType" block="#all" final="#all">
        <sequence>
            <element type="dl:MessageType" name="message_description" form="qualified"/>
        </sequence>
    </complexType>

    <element name="duck" type="dl:DuckDefinitionType" />

</schema>

DATATYPES.XSD

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://retis.sssup.it/duck-lab"
    xmlns:dl="http://retis.sssup.it/duck-lab" elementFormDefault="qualified">
        <attribute name="data_name" type="string"/>
    <attribute name="data_len" type="nonNegativeInteger"/>
    <attribute name="data_type" type="string"/>
    <attribute name="endianess" type="string"/>
        <element name="data">
        <complexType>
            <attribute ref="dl:data_name" use="required"/>
            <attribute ref="dl:data_len" use="required"/>
            <attribute ref="dl:data_type" use="required"/>
            <attribute ref="dl:endianess" use="required"/>
        </complexType>
    </element>
</schema>

DUCK_MESSAGE.XSD

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://retis.sssup.it/duck-lab"
    xmlns:dl="http://retis.sssup.it/duck-lab" elementFormDefault="qualified">

    <include schemaLocation="datatypes.xsd"></include>
    <complexType name="MessageType">
        <sequence maxOccurs="unbounded">
            <element ref="dl:data"></element>
        </sequence>
    </complexType>
</schema>

Obviously I can bypass the problem defining a non empty namespace, but I would like to understand what's wrong.

Thanks a lot.


error "main cannot be resolved or is not a field "

"MAIN CANNOT RESOLOVED OR NOT IN A FIELD"
It gives error in mainactivity at setcontentview "main cannot be resolved or not in field.

This is my code plz help me as i got tired to find a way out plz reomove this error
    "this is my mainactivity"

package com.exampl.goglemaps;

import android.os.Bundle;
import com.exampl.goglemaps.R;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class MainActivity extends MapActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        //fetch the map view from the layout
        MapView mapView = (MapView) findViewById(R.id.mapview);

        //make available zoom controls
        mapView.setBuiltInZoomControls(true);
    }

    @Override
    protected boolean isRouteDisplayed() {

        return false;

    }
}

my manfiestfile

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exampl.goglemaps"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14" />

    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
      <uses-library android:name="com.google.android.maps" />
    </application>
</manifest>

and that is my xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

       <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="Your Google Maps API key"
        android:clickable="true" />
</LinearLayout>

this call a error in mainactivity in  setContentView(R.layout.main); saying that "main cannot not be resoloved or in not a field" i have searched almost every foroum but failed to get through this, plz help me out to solve this error.

Heading

THANKs in Advance


Webpack file loade not displaying icon images on the browser

Well since my webpack expercise is not so good I having problem getting some icons to display on the browser. My setup looks like this on webpack:

      {
        test: /\.(ttf|eot|woff|woff2)$/,
        exclude: /node_modules/,
        loader: 'url?limit=100000?name=fonts/[name].[ext]',
      },
      {
        test: /\.(jpg|png|svg)$/,
        exclude: /node_modules/,
        loader: 'url?limit=100000',
      },

The icons I have are located here:


iPhone Development - Keyboard does not automatically adjust when taking input using TextField placed in a TableView

I just downloaded 2.2.1 and i've seen that my input view does not adjust itself when an input field (NSTextField) is selected. Earlier the view was adjusting itself w.r.t keyboard.

I was using 2.1. How can i achieve the same effect?


YouTube IFrame API generates mixed content warning with HTTPS + HTML5

When I embed youtube on an HTTPS page using the iframe api in HTML5 mode , it still pulls the actual stream using HTTP, which generates a mixed content warning. Is this usecase properly supported?

I found this discussion from 2011 which suggests it wasn't. However I just tried accessing the CDN server using HTTPS and it works - kind of - but it returns the wrong certificate (google.com instead of something for youtube.com).

Has anyone managed to embed a video on a HTTPS page using the IFRAME API in HTML5 without triggering a mixed content warning (ie. the lock with the yellow warning sign in Chrome)?

Thanks


Convert Array to JSON string php

I have an array like this

$prebook=array(
             'sourceCity'=>$_POST['source'],
             'destinationCity'=>$_POST['dest'],
             'doj'=>$_POST['doj'],
             'routeScheduleId'=>$_POST['routeid'],
              'boardingPoint'=>array(
                  'id'=>$id,
                  'location'=>$location,
                  'time'=>$time
              ),
              'customerName'=>$_POST['fname'],
              'customerLastName'=>$_POST['lname'],
              'customerEmail'=>$_POST['email'],
              'customerPhone'=>$_POST['mobileno'],
              'emergencyPhNumber'=>$_POST['emc-number'],
              'customerAddress'=>$_POST['address'],
              'blockSeatPaxDetails'=>array(array(
                  'age'=>$_POST['age'][$key],
                  'name'=>$value,
                  'seatNbr'=>$_POST['seat-no'][$key],
                  'Sex'=>$_POST['gender'.$no],
                  'fare'=>$_POST['base-fare'][$key],
                  'totalFareWithTaxes'=>$_POST['amount'][$key],
                  'ladiesSeat'=>$ladies,
                  'lastName'=>$_POST['plname'][$key],
                  'mobile'=>$_POST['mobileno'],
                  'title'=>'Mr',
                  'email'=>$_POST['email'],
                  'idType'=>$_POST['idtype'],
                  'idNumber'=>$_POST['id-number'],
                  'nameOnId'=>$value,
                  'primary'=>true,
                  'ac'=>$ac,
                  'sleeper'=>$sleeper
         )),
                'inventoryType'=>$_POST['invtype']
           )

From this i want to get Json string look like this

apiBlockTicketRequest:{"sourceCity":"Hyderabad","destinationCity":"Bangalore","doj":"2016-01-22","routeScheduleId":"6717","boardingPoint":{"id":"2889","location":"Mettuguda,Opp. Mettuguda Church","time":"04:50PM"},"customerName":"jj","customerLastName":"jjj","customerEmail":"shamonsha665@gmail.com","customerPhone":"7779","emergencyPhNumber":"7878","customerAddress":"gjgj","blockSeatPaxDetails":[{"age":"22","name":"hjhj","seatNbr":"G4","Sex":"F","fare":"900","totalFareWithTaxes":"945","ladiesSeat":false,"lastName":"hjhj","mobile":"7779","title":"Mr","email":"shamonsha665@gmail.com","idType":"Aadhar Card","idNumber":"jkjk","nameOnId":"hjhj","primary":true,"ac":false,"sleeper":false}],"inventoryType":"0"}

Here is my code

$data =json_encode($prebook);
$json='apiBlockTicketRequest:'.$data;
echo $json;

But when i Validate the JSON string using this I will get the following error

Expecting object or array, not string.[Code 1, Structure 1]

Error:Strings should be wrapped in double quotes.


Wowza Cloud - CORS (hls.js)

I'm trying to get a stream running into a website using hls.js from the wowza cloud, but keep getting a CORS error. I know I need to change the headers on the streaming server, but where do I do that using the Wowza Cloud? All documentation only shows how to change it on the Wowza Engine.

Thanks!
David


Concatenating value to a command line

I am making a program that uses the rasidal command to connect to a VPN server. Obviously this requires a login and this is stored in a notepad file.

Process.Start("rasdial.exe", """VPN Connection"" HardcodedUSERNAME HardCodedPassword")

This seems to work fine, however when I read this information from a notepad file and write it to the screen they are still exactly the same. Why is it that the login could be incorrect.

All I am doing is

Process.Start("rasdial.exe", """VPN Connection"" & Info")

Thanks


Drawing ROC from the given classifier

I have a classifier with the below quality information, but I don't have any data:

TP :325/TN :200/FP :275/FN :200

Is there any solution that assists me to find regression model based on above information. I need to draw ROC.


Stuck on a basic Lua writeInteger function

I am a newcomer to coding in general and I want to learn basic Lua scripting for my own hobby.
After working on a Lua script, the syntax all seems to be without error but I have come across one issue that I don't understand, I broke it down to this basic function:

{$lua}
 ID1 = "10"
 ID2 = "0"

if (ID1 ~= nil and ID1 == "10") then
  writeInteger(ID2,"25")
  end

print(ID2)

The issue is that the writeInteger does not seem to work at all, ID2 remains at value "0" while it should become "25".
Any help would be greatly appreciated.


Query results with the highest number

I wrote the following query that counts the "type" of subscription for each customer and displays the subscription name along with the number of customers associated with it.  It works.

For example:

Subscription A = 200 customers
Subscription B = 57

select
   subscription_name, count(subscription_name) as Num_of_Customers
from
  subscription
    join customer on subscription.subscription_number=customer.subscription_number
group by subscription_name;

What I can't figure out is how to display "ONLY" the subscription name that has the highest number of customers.

I would greatly appreciate your advice.  Thanks.


How does one set the stop word list on an App Engine Cloud SQL database using InnoDb?

I am using the MySQL 5.6 version of Cloud SQL on App Engine using InnoDB.

I want to enable full text search queries, but for my application it is essential to change the stop word list. Normally in MySQL this is possible by creating a table with the stop word list and using the innodb_ft_server_stopword_table config setting. See fulltext-stopwords.

How can this be done on Google Cloud SQL?

Thanks!


call read_text or read_multiple_texts function for multiple cID

I`ve been searching last days for how to call function read_text for multiple cID.Does anybody know how to do this for the code below: ? Thank you for your support.Now it works only when : cID = 'GRUN'. cObject = 'MATERIAL' and lTDNAME = lMVKE-MATNR. in know that function read_text can be called multiple times. Please provide an example if you know.

data: it_MVKE type standard table of MVKE initial size 0.

data: lMVKE like MVKE, lMAKT like MAKT, lT002 like T002 ,"lSTXL like STXL,
 lTDNAME like THEAD-TDNAME,"text header

 it_TLINE type standard table of TLINE,
 wa_TLINE type TLINE, lText type string.

types: begin of i_Report,
        MATNR(18) type c,
        MAKTX like MAKT-MAKTX,
        VKORG(5) type c,
        VTWEG(5) type c,
        SPRAS(2) type c,
        Text type string,
        "tdid type c,
       end of i_Report.

data: wa_Report type i_Report,
      it_Report type standard table of i_Report initial size 0.
data:  cObject(10) type c, cID(4) type c.

types: begin of cids,
         cid(4)      type c,
         cobject(10) type c,
       end of cids.

data: wa_cids type cids.
data: it_cids type standard table of cids.

wa_cids-cid = 'GRUN'.
wa_cids-cobject = 'MATERIAL'.

append wa_cids to it_cids.

   IF cID = '0001'. cObject = 'MVKE'.
  select * from MVKE into table it_MVKE
  where MATNR in Material." AND
    VKORG IN UnitLog.

 ELSE.
  select MATNR from MARA into corresponding fields of table it_MVKE
  where MATNR in Material order by MATNR.
      cID = 'PRUE'.  cObject = 'MATERIAL'. "Text verificare

    select MATNR from MARA into corresponding fields of table it_MVKE
##too_many_itab_fields
   where MATNR in Material order by MATNR.
      cID = 'GRUN'. cObject = 'MATERIAL'. "Basic View Text -text date principale "

endif.

wa_Report-MATNR = 'MATNR'.
wa_Report-MAKTX = 'MAKTX'.
wa_Report-VKORG = 'VKORG'.
wa_Report-VTWEG = 'VTWEG'.
wa_Report-SPRAS = 'SPRAS'.
wa_Report-Text = 'Text'.
append wa_Report to it_Report.

"https://archive.sap.com/discussions/thread/2084953
loop at it_MVKE into lMVKE.
  if cID = '0001'. cObject = 'MVKE'.
   "concatenate lMVKE-MATNR lMVKE-VKORG lMVKE-VTWEG into lTDNAME.
  else.
    lTDNAME = lMVKE-MATNR.
  endif.
  select spras from T002 into lT002. "where WERKS in Unitlog."SPRAS in s_SPRAS.

loop at it_cids into wa_cids.

  cID = 'GRUN'. cObject = 'MATERIAL'. "Basic View Text -text date principale

    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        CLIENT                  = SY-MANDT
        ID                      = cID
        LANGUAGE                = lT002-SPRAS
        NAME                    = lTDNAME
        OBJECT                  = cObject
       TABLES
        LINES                   = it_TLINE
      EXCEPTIONS
        ID                      = 1
        OTHERS                  = 8.

ENDLOOP.

    IF SY-SUBRC EQ 0.
      select single * from MAKT into lMAKT where MATNR eq lMVKE-MATNR.
      select single * from MAKT into lMAKT where MATNR eq lMVKE-MATNR
       and SPRAS eq lT002-SPRAS.  "p_SPRAS.

      wa_Report-MATNR = lMVKE-MATNR.
      wa_Report-MAKTX = lMAKT-MAKTX.
      wa_Report-VKORG = lMVKE-VKORG.
      wa_Report-VTWEG = lMVKE-VTWEG.
      wa_Report-SPRAS = lT002-SPRAS.  "p_SPRAS.
      "wa_report-tdid  = lSTXL-tdid.
      LOOP AT it_TLINE INTO wa_TLINE.
        wa_Report-TEXT = wa_TLINE-TDLINE.
        append wa_Report to it_Report.
      ENDLOOP.
    ENDIF.
  "endselect.
endloop.
loop at it_Report into wa_Report.
  write: / wa_Report-MATNR, wa_Report-MAKTX,
  wa_Report-VKORG, wa_Report-VTWEG, wa_Report-SPRAS, wa_Report-Text.
endloop.

Please click here for Output photo:


Building modules with linux kernel for custom flavor

I followed the instructions given in the link: http://blog.avirtualhome.com/how-to-compile-a-new-ubuntu-11-04-natty-kernel/  for building a custom kernel and booting it. Everything works fine, except that when building it, I used the option skipmodule=true (as given in this link), so I guess the modules are not built for this kernel. So I have two questions:

How do I build only the modules for my flavor, now that I have the rest of the kernel built? 'make modules' will build it for generic flavor only, if I'm not wrong.

Also does it require me to build the entire kernel source, 'fakeroot debian/rules binary-i5' (i5 is my custom falvor), each time I make a change to one of my modules?

Thanks.


Is there any way to check if pointer is dangling?

I have a code where I use a pointer to access some datablock. In some rare cases, a few members of the datablock are empty, and as a result the pointer becomes dangling. In fact, I get the correct pointer but the program crashes when trying to do something with the pointer.

The usual advice would be to avoid this type of usage. But sadly, the framework I use requires that I use this type of data access methods.

Is there a way I can "check" if the pointer is invalid before doing any operation with it? Checking that the pointer is not equal to NULL did not work, obviously. I also tried this:

try
{
    CString csClassName = typeid(*pMyPointer).name();  // Check error condition
    // The line below fails due to dangling pointer (data block is not valid).
    hr = pMyPointer->MyPointerMethod();
}
catch(bad_typeid)
{
    return E_FAIL;
}
catch(...)
{
    return E_FAIL;
}

Is it the correct way?


NSLocalizedStringFromTableInBundle : not getting values for key

I am not able to get values for keys from the InfoPlist.

label.text = NSLocalizedStringFromTableInBundle(@"keyone",
                                                nil,
                                                AppDelegateObj.langBundle, nil));

In the InfoPlist.strings there is a value

"keyone" = "value one";

When I am running my app it is showing UILabel value as keyone

Why?


office web apps server 2013 - Got an server error when open /op/generate.aspx

I set up an office web apps server 2013 in windows server 2012 R2, it is good to open this link http://localhost/hosting/discovery, means the office web apss server 2013 is running well.

But when I tried to open this link http://localhost/op/generate.aspx, it gives an error : A big red X, server error sorry for the mistake. We have recorded an error for the server administrator.

I was looking for some blogs, somesay that is causing by logging in the website with the system account, but I dont know what is the system account, and is that logging means the iis service?

I am not use WOPI and sharepoint, what I want is only use office web apps server 2013 to provide view & edit doc and docx files in browser.

Please help, thanks!

PS. If the question not meet the requirement, comment it, I will edit it.

eidt 1 :

I had solve this problem, I had installed AD and OWA in one server.

Install them in different server will ok.

But there is another problem :

When open a word file, It gave an alert:

Microsoft Word Web App

sorry, some problem had appeared, cant open this file.

How to fix this ...

update :

I finally solved it by changing another server to install OWA.


Formatting Countup Timer Javascript

I am using the following code to display a count up clock
The Minutes and Seconds are formatting fine, but Hours are being show as a negative number eg "-238"

     <script language="javascript" type="text/javascript">
        var startTime = new Date(2011,01,21,08,55, 0)

        $(document).ready(function () {
            setTimeout(updateClock, 1000);
        });
        function updateClock() {
            var timeField = $(".timeSince");
            var currentTime = new Date();
            var difference =  currentTime - startTime;
            timeField.html(MillisecondsToDuration(difference));
            setTimeout(updateClock, 1000);
        }
        function MillisecondsToDuration(n) {
            var hms = "";

            var dtm = new Date();
            dtm.setTime(n);
            var h = "000" + Math.floor(n / 3600000);
            var m = "0" + dtm.getMinutes();
            var s = "0" + dtm.getSeconds();

            hms = h.substr(h.length-4) + " hours, " + m.substr(m.length-2) + " mins, ";
            hms += s.substr(s.length-2) + " secs";
            return hms;
        }
       </script>


Changing language on the fly in swift

Now I know that apple does not recommend this.

In general, you should not change the iOS system language (via use of the AppleLanguages pref key) from within your application. This goes against the basic iOS user model for switching languages in the Settings app, and also uses a preference key that is not documented, meaning that at some point in the future, the key name could change, which would break your application.

However, this is an application that changing the language on the fly makes sense, just trust me on that. I also know this question was asked here: Changing language on the fly, in running iOS, programmatically. This however is getting old and I was wondering if there are any newer, better, or easier ways to do this. Currently in my app, I have a language choosing screen. Clicking on of the buttons in this view calls the following function with the language the button is associated with:

 func changeLang(language: String) {

    if language != (currentLang as! String?)! {
        func handleCancel(alertView: UIAlertAction!)
        {

        }
        var alert = UIAlertController(title: NSLocalizedString("language", comment: "Language"), message: NSLocalizedString("languageWarning", comment: "Warn User of Language Change Different Than Defaults"), preferredStyle: UIAlertControllerStyle.Alert)

        alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler:handleCancel))
        alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default, handler:{ (UIAlertAction) in

            NSUserDefaults.standardUserDefaults().setObject([language], forKey: "AppleLanguages")
            NSUserDefaults.standardUserDefaults().synchronize()
            println(self.currentLang)

            let alert = UIAlertView()
            alert.title = NSLocalizedString("language", comment: "Sign In Failed")
            alert.message = NSLocalizedString("languageChangeNotification", comment: "Notify of language change")
            alert.addButtonWithTitle(NSLocalizedString("ok", comment: "Okay"))
            alert.show()

            self.performSegueWithIdentifier("welcome", sender: AnyObject?())

        }))
        self.presentViewController(alert, animated: true, completion: {
        })
    } else {
        self.performSegueWithIdentifier("welcome", sender: AnyObject?())
    }

}

Example:

@IBAction func english(sender: UIButton) {
        changeLang("en")

    }

If the user picks a language different than their own, they get a confirmation alert, and then are requested to restart there device. This is what I want to change. It appears that this section of NSUSerDefaults is not synchronized until the app restarts. Evidence:

let currentLang: AnyObject? = NSLocale.preferredLanguages()[0]
println(currentLang)
// Prints english
changeLang("zh-Hans")
println(currentLang)
// Prints english still until restart

The current internationalization system apple has is great, and I plan on using it. However, how can I change the language on the fly, maybe by forcing an update on the NSUSerDefaults?

Edit: I recommend using this library to do this now. Best of luck!


Boostrap Datepicker performance issue on large number of date input items

I need to initialize large number of dynamically created datepicker input in UI but I only got bad performance and even crashing of browsers. I dynamically create more than 10 input field (10 to 100), and after that I call initialization of plugin. In that moment everything start lagging and even crashing.

I'm using this bootstrap plugin bootstrap-datepicker
Does anybody have some idea how to make this to work fine. Maybe some idea from different approach.


Child view controller in UICollectionViewCell

Suppose I want to achieve Pinterest's pin page, like this one:

This is my approach:

make a UICollectionViewController, pin's page is a UICollectionViewCell

cell is make of two components: pin info child vc && waterfall child vc

Then comes the problem: How can I reuse child view controller?

Some pseudo code:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
    Pin *pin = self.dataSource[indexPath.row];
    // i have to create a new childVC, based on different indexPath.
    UITableViewController *pinInfoViewController = [[pinInfoViewController alloc] initWithPin:pin];
    [cell updatePinViewWithPin:pin];
    [self addChildViewController:pinInfoViewController];

    // Add waterfall view controller
}

Every time this method is called, a new child view controller will be created, is it ok, or how to improve it?


C# - Using Linq to SQL with XML Serialization

There is something i don't quite understand when using Linq to SQL and XML serialization on some of my object's properties.

Regularly i'd create my tables, and then use Linq to SQL to generate all my classes. But now since i serialize some of my classes properties, when creating the database tables, i define these properties as varchar (for the XML string) instead of the actual type that they are. So the auto-generated classes are created with string typed properties instead of the actual classes.

Is there a way to tell Linq to apply my de/serialization automatically when inserting/fetching objects from the database? And keep the original type for my serialized properties in the Linq auto-generated classes?

A Class for example

Notice that classBProp is of type ClassB.

class ClassA
{
    private string name;
    public string Name
    {
        get { return name; }
        set { name = value; }
    }

    private ClassB classBProp; // <-- This is something i'm serializing
    public ClassB ClassBProp
    {
        get { return classBProp; }
        set { classBProp = value; }
    }

    public ClassA()
    {
        classBProp = new ClassB();
    }
}

The table for the class

Here ClassBProp is of type varchar. So Linq to SQL generates the class with a string property.

CREATE TABLE [dbo].[ClassA] (
[Id]         INT           NOT NULL,
[Name]       VARCHAR (50)  NULL,
[ClassBProp] VARCHAR (MAX) NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);


Directx application commercial distribution

Can I distribute any Directx based application commercially? Do I need to get any permission from Microsoft? Actually I'm developing a software such like "Rendering Engine". But I don't know much about the EULA.
I also have the same issue with OPENGL and Metal.
Note: I'm not using Visual Studio for the development.


initializing view holder for array list row widgets - is my approach wrong?

I'm adding view holder to the row of ListView to store widgets. Here is how I do it:

public View getView(int position, View row, ViewGroup parent) {
    // Check if an existing view is being reused, otherwise inflate the view
    if (row == null) {
        row = LayoutInflater.from(getContext()).inflate(R.layout.articles_list_row, parent, false);
        row.setTag(R.id.articles_list_row_widgets_holder, new TextListRowHolder(row));
    }

I'm also reading a book where an author initializes it like this:

ViewHolder holder=(ViewHolder)row.getTag();
if (holder==null) {
    holder=new ViewHolder(row);
    row.setTag(holder);
}

Here is the quote from the book:

If the call to getTag() on the row returns null, we know we need to
  create a new ViewHolder, which we then attach to the row via setTag()
  for later reuse.

Is my approach wrong? I assume that if row is null then there is no holder attached, and if the row is already created than the holder is already attached.


inline namespace and extension namespace

I read the section about namespace definition. Clause 7.3.1 of N3797 said:

The inline keyword may be used on an extension-namespace-definition
  only if it was previously used on the original-namespace-definition
  for that namespace.

Consider the following code snippet:

namespace M
{
    int h;
}

inline namespace M
{
    int j = 6;
}

It compiled successful both with the -std=c++11 and without that option. Can you explain that behavior? Is it a g++ bug?


HTML CSS Problem

please check this URL.
http://works.ebexsoft.com/destin/

There is an unexpected margin/padding in the bottom. I have used css like this:

@charset "utf-8";
body{margin:0; color:#232323; padding:0; background: #FDF8E4 url(images/bg.jpg) repeat-x;}
* {margin:0; padding:0}
html, body {margin: 0; padding: 0:}

But the space is not removing. What can I do? Please help.


Registration Error running code with Liquid-XML Lib

I have a problem running my Liquid-XML Project on production machine. The liquid xml license is ok. I recreated the class lib with liquid xml studio but no changes at the error front.

cmd line gives me these informations:

Ausnahmefehler: System.TypeInitializationException: Der
  Typeninitialisierer für "myLib.Registration" hat eine Ausnahme
  verursacht.
  ---> System.ArgumentException: Ein Element mit dem gleichen Schlüssel wurde bereits hinzugefügt. bei
  System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value,
  Boolean add) bei myLib.Registration.RegisterLicense() in
  [PATH]\coding\my.xsd.Output\SourceCodeVBNet\Enumerations.vb:Zeile 53.

Line 53 is the license register code:

LiquidTechnologies.Runtime.Net45.XmlObjectBase.Register("company xyz", "my.xsd","somecharshere")

Any ideas?


Relationship between struct s { T0 t0; T1 t1; ... } and std::tuple<T0,T1,...> t

In particular if Tj are built-in types or pointers to built-in types does anyone know of a compiler that does not lay out the memory so offsetof(s, tj) != &get<j>(t) - &get<0>(t)?


Dependant Observable Array in Knockout JS

I have started to play around with knockoutjs and do some simple binding/dependant binding.
My goal is to have 1 <select> list populated based on the value of another <select> list. Both are being loaded from an ajax call to my asp.net webservice.

So I have two <select> lists

<select id="make" data-bind="options: availableMakes, value: selectedMake, optionsText: 'text', optionsCaption: 'Choose a make'"></select>
<select id="model" data-bind="options: availableModels, value: selectedModel, optionsText: 'text', optionsCaption: 'Choose a model'"></select>

Then my javascript looks like this:

$(function () {

            // creating the model
            var option = function (text, value) {
                this.text = text;
                this.value = value;
            }

            // creating the view model
            var searchModel = {
                availableMakes: ko.observableArray([]),
                availableModels: ko.observableArray([]),
                selectedMake: ko.observable(),
                selectedModel: ko.observable()
            }

            // adding in a dependentObservable to update the Models based on the selected Make
            searchModel.UpdateModels = ko.dependentObservable(function () {
                var theMake = searchModel.selectedMake() ? searchModel.selectedMake().text : '';
                if (theMake != '') {
                    $.ajax({
                        url: "/data/service/auction.asmx/GetModels",
                        type: 'GET',
                        contentType: "application/json; charset=utf-8",
                        data: '{make:"' + theMake + '"}',
                        success: function (data) {
                            var makes = (typeof data.d) == 'string' ? eval('(' + data.d + ')') : data.d;
                            var mappedModels = $.map(makes, function (item) {
                                return new option(item.text, item.value);
                            });
                            searchModel.availableModels(mappedModels);
                        },
                        dataType: "json"
                    });
                }
                else {
                    searchModel.availableModels([]);
                }
                return null;
            }, searchModel);

            // binding the view model
            ko.applyBindings(searchModel);

            // loading in all the makes
            $.ajax({
                url: "/data/service/auction.asmx/GetMakes",
                type: 'GET',
                contentType: "application/json; charset=utf-8",
                data: '',
                success: function (data) {
                    var makes = (typeof data.d) == 'string' ? eval('(' + data.d + ')') : data.d;
                    var mappedMakes = $.map(makes, function (item) {
                        return new option(item.text, item.value);
                    });
                    searchModel.availableMakes(mappedMakes);
                },
                dataType: "json"
            });

        });

Currently this works as expected, but I think that I am doing this wrong as the code looks pretty long, and I could do this without using knockoutjs in less code.
Also the way that I am loading up the availableModels is obviously not correct because I am using a dependentObsevable called UpdateModels which I added in order to load up the availableModels based on the value of selectedMake().text

I hope this makes sense and you can point out an improved version of this? Or tell me simply How do I reload the Models based on the Make selection?

Many Thanks,


Value INSERT of type java.lang.String cannot be converted to JSONArray Android push notification

I am implementing gcm push notification. When the device is registered for the first time i get a warning Value INSERT of type java.lang.String cannot be converted to JSONArray
 shown in the log.

protected JSONArray doInBackground(Void... params) {
    try {
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("....registration?devicefamily=android");

        // Add your data
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);

        BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        sb.append(reader.readLine() + "\n");
        String line = "0";
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
        }
        reader.close();
        String result11 = sb.toString();

        System.out.println("URL RETURN "+result11);

        // parsing data
        return new JSONArray(result11);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

Logcat:

11-21 13:13:27.360: W/System.err(25760): org.json.JSONException: Value INSERT of type java.lang.String cannot be converted to JSONArray
11-21 13:13:27.360: W/System.err(25760):    at org.json.JSON.typeMismatch(JSON.java:111)
11-21 13:13:27.360: W/System.err(25760):    at org.json.JSONArray.<init>(JSONArray.java:91)
11-21 13:13:27.360: W/System.err(25760):    at org.json.JSONArray.<init>(JSONArray.java:103)
11-21 13:13:27.360: W/System.err(25760):    at packageutil.FetchTask.doInBackground(FetchTask.java:44)
11-21 13:13:27.365: W/System.err(25760):    at packageutil.FetchTask.doInBackground(FetchTask.java:1)
11-21 13:13:27.365: W/System.err(25760):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
11-21 13:13:27.365: W/System.err(25760):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
11-21 13:13:27.365: W/System.err(25760):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
11-21 13:13:27.365: W/System.err(25760):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
11-21 13:13:27.365: W/System.err(25760):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
11-21 13:13:27.365: W/System.err(25760):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
11-21 13:13:27.365: W/System.err(25760):    at java.lang.Thread.run(Thread.java:856)


Unable to find ant program

I am an experienced (but retired) Windows software developer, with more years experience than I care to admit, developing in C++, C#, VB and Java. I therefore decided to have a crack at Android development. My development machine is a Windows 7 box. My IDE of choice would be Microsoft Visual Studio but, for now, I am happy doing hand editing and launching tools from the command line.

I started by downloading the Android SDK and various additional items it suggested. I then started working my way through the tutorial at developer.android.com/training/basics/firstapp. Android list targets gave me a couple of choices (Android 4.2.2 and Google APIs:17). I then did Android create project from the command line and that appeared to do its stuff, creating MyFirstApp in my development folder. I then ran Android avd and created an emulator. I also added the android SDK's tools and platform-tools to my path. So far so good.

I fell at the next hurdle. The tutorial told me to change to the root folder of my project and run ant debug. At this point, Windows reports:
  'ant' is not recognized as an internal or external command,
  operable program or batch file.

I've searched around for ant.exe without success. Did I miss installing something or did I miss a vital step in the set-up? Any advice for this very green newbie would be greatly appreciated.


Why does the sequence of parameters matter in SQL

I think this is entry-level, but I haven't googled any answer out..

When building queries, do we have to use the :1, :2... stuff in an absolute sequence? From my tests, it seems yes. But doesn't calling stmt->setXXX(n, val) just set the nth parameter in the statement with val? How is it implemented?

Please see my example below:

    if (bNewContent)    //new
    {
        sql = "BEGIN PackProductManagement.procAddOTTContent(:1, :2, :3, :4, :5, :6, :7); END; ";
    }
    else                //update
    {
        sql = "UPDATE OTT_Content SET ContentID = :1, ContentType = :2, FingerPrint = :3, IsHighLevelSafe = :4, ";
        sql += "OutProtection = :5, OfflinePlayback = :6, ModifyTime = sysdate ";
        sql += "WHERE ContentID = :1";
    }
    try
    {
        OpenStatement(sql);
        stmt->setString(1, ac->ContentDesc.ContentID);
        stmt->setUInt(2, ac->ContentDesc.ContentType);
        stmt->setUInt(3, ac->ContentDesc.FingerPrint);
        stmt->setUInt(4, ac->ContentDesc.HighLevelSafe);
        stmt->setUInt(5, ac->ContentDesc.OutputProtection);
        stmt->setUInt(6, ac->ContentDesc.OfflinePlayback);
        if (bNewContent)
        {
            stmt->setUInt(7, 0);        //only used if new
        }
        stmt->execute();

        CloseStatement(true);
    }

In this example, bNewContent is always FALSE, so we're always running the update statement. The above query works OK. But if I change the update query like below (removed ContentID = :1, at the beginning of the update statement), I'll get an ORA-01722 INVALID_NUMBER. Why can't I do :2:3:4:5:6:1? If setXXX is implemented like a queue, why the above :1:2:3:4:5:6:1 work??

sql = "UPDATE OTT_Content SET  ContentType = :2, FingerPrint = :3, IsHighLevelSafe = :4, ";
sql += "OutProtection = :5, OfflinePlayback = :6, ModifyTime = sysdate ";
sql += "WHERE ContentID = :1";

Thanks in advance!

Edited:

Test results below: (based on ZZa's answer)

sql = "UPDATE OTT_Content SET ContentID = :x ContentType = :x, FingerPrint = :x, IsHighLevelSafe = :x, ";
sql += "OutProtection = :x, OfflinePlayback = :x, ModifyTime = sysdate ";
sql += "WHERE ContentID = :x";

Above code doesn't work with 6 parameters.

sql = "UPDATE OTT_Content SET ContentID = :1 ContentType = :x, FingerPrint = :x, IsHighLevelSafe = :x, ";
sql += "OutProtection = :x, OfflinePlayback = :x, ModifyTime = sysdate ";
sql += "WHERE ContentID = :1";

Above code works with 6 parameters.


White Background on the whole website length

I have a display problem in my web site content.
I am creating a website and it displays well on the browser (width 100%) But when I resize the browser screen and I made a transition to the right with the bottom scroll bar a white background appeared.
I'm not using the responsive technique.
I work with a fixed container width (width: 1170px; margin: 0 auto;)

the website: http://www.lemediterranee.com.tn/medet/


Prevent printing spaces in C# TextBox

I want to make a TextBox that doesn't allow entering spaces. I disabled typing spaces with the keyboard:

void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == (char)Keys.Space)
    {
        e.Handled = true;
    }
}

But if the user copies a string with spaces like "Hello world", he can paste it into the TextBox and there will be spaces in it.


Unexpected behaviour of pre increment operator in C

   #include <stdio.h>
    void main()
    {
      int i = -3, j=2, k=0, m;
      m=  ++i|| ++j && ++k;
      printf("%d%d%d%d", i, j, k, m);
    }

If we see order of evaluation in ++i|| ++j && ++k; we will come up with evaluation of ++j && ++k at first it will increment value of j and k and it will evaluate as 1 after that
++i || 1  will evaluate which will increment value of i and assign 1 to m so output should be -2 3 1 1 but it's giving output -2 2 0 1 I think i am missing some concept here.


change text in listbox without changing values

i have a listbox that adds the ids from a dictionary to the listbox but i need it to display the name and not the id but the value of the item has to be the id is there any way to do this heres the code i use

    public static Dictionary<int, CardInfos> CardDataeff = new Dictionary<int, CardInfos>();

    private void textBox2_TextChanged(object sender, EventArgs e)
    {
        lock (Searchlock)
        {
            if (textBox2.Text == "")
            {
                listBox2.Items.Clear();
                return;
            }
            if (textBox2.Text != "Search")
            {
                listBox2.Items.Clear();
                foreach (int card in CardDataeff.Keys)
                {
                    if (CardDataeff[card].Id.ToString().ToLower().StartsWith(textBox2.Text.ToLower()) ||
                        CardDataeff[card].Name.ToLower().Contains(textBox2.Text.ToLower()))
                    {
                        listBox2.Items.Add(CardDataeff[card].Id.ToString());
                    }
                }
            }
        }
    }

  public void listBox2_DrawItem(object sender, DrawItemEventArgs e)
    {
        e.DrawBackground();

        bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected);

        int index = e.Index;
        if (index >= 0 && index < listBox2.Items.Count)
        {
            string text = listBox2.Items[index].ToString();
            Graphics g = e.Graphics;

            CardInfos card = CardDataeff[Int32.Parse(text)];

            g.FillRectangle((selected) ? new SolidBrush(Color.Blue) : new SolidBrush(Color.White), e.Bounds);

            // Print text
            g.DrawString((card.Name == "" ? card.Id.ToString() : card.Name), e.Font, (selected) ? Brushes.White : Brushes.Black,
                listBox2.GetItemRectangle(index).Location);
        }

        e.DrawFocusRectangle();
    }

    private bool LoadCard(int cardid)
    {
        if (!CardDataeff.ContainsKey(cardid))
        {
            return false;
        }

        CardInfos info = CardDataeff[cardid];

        if (!string.IsNullOrEmpty(this.richTextBox1.Text))
        {
            if (MessageBox.Show("do you want to save? ", "Prompt", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
            {
                if (string.IsNullOrEmpty(this.filePath))
                {
                    this.saveFileDialog1.InitialDirectory = this.scriptFolderPath;
                    this.saveFileDialog1.FileName = this.getFileName();
                    if (this.saveFileDialog1.ShowDialog() != DialogResult.OK)
                        this.saveFile(this.saveFileDialog1.FileName);
                }
                else
                {
                    this.saveFile(this.filePath);
                }
            }
        }
        this.openFile(cdbdir + "\\script\\c" + cardid + ".lua");
        return true;
    }

    private void listBox2_DoubleClick(object sender, EventArgs e)
    {
        ListBox list = (ListBox)sender;
        if (list.SelectedIndex >= 0)
        {
            LoadCard(Int32.Parse(list.SelectedItem.ToString()));
        }
    }

i included all code that i think is necessary


node-forever seems not working as I expected

// test.js

var util = require('util');

setTimeout(function () {
    util.puts('Throwing error now.');
    throw new Error('User generated fault.');
}, 200);

$ forever start -l ./forever.log -o output.log -e err.log -m 5 -a start test.js

I run the above command, and get:

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: test_debug.js

I expect to get 5 error log, but actually I just get one in the err.log. It seems test.js just run one time other than 5 times.

Thanks a lot~


Show presentation timer on only one of two cloned displays

Is is possible to show an application on only one display, if the display is cloned? My goal is to develop a timer that is shown on the laptop display during a presentation but not on the projector.

I'm looking for something like windows' "Identify displays" feature, which displays numbers 1 and 2 on the different displays, even in cloned mode.

Thanks

Edit

I discovered a possible duplicate to this question. The accepted answer in this case was to use Screens.AllScreens to discover the number of screens. This is not enough in my case. A comment on the accepted answer links to a thread about directly painting on the desktop. I tried this with the following code, but the text appeared on both displays. The code to get the Hdc of the input is from an article about screen captures. I'm not sure what to set for the other parameters (they are IntPtr.Zero in the article)

[DllImport("gdi32.dll")]
static extern IntPtr CreateDC(IntPtr lpszDriver, string lpszDevice, IntPtr lpszOutput, IntPtr lpszInitData);

[DllImport("gdi32.dll")]
static extern IntPtr DeleteDC(IntPtr hdc);

private void PaintOnDesktop(string stringToPrint, Font font, Brush brush, PointF position) {
    string deviceName = Screen.AllScreens[0].DeviceName;
    IntPtr targetHdc = CreateDC(IntPtr.Zero, deviceName, IntPtr.Zero, IntPtr.Zero);
    using (Graphics g = Graphics.FromHdc(targetHdc)) {
        g.DrawString(stringToPrint, font, brush, position);
    }
    DeleteDC(targetHdc);
}

Edit 2

Apparently there is no way to do this in C#, so I changed the C# tag to device driver.


EF - Create missing SQL Table/Object from Entity Object

Is there any function in the .NET Entity Framework, that can create missing SQL table. Or stored procedure or any other SQL Object?

Have do some research and did not found anything yet.


How to add button in manifest xml

I want to add a button with link into my Joomla module/plugin config area.

Given image have some form field but I want to add one more option as a button . when user click that button then they go to to another link.


How to extract all footnotes from a MS Word file?

Is there a generic (Macro, XML Parser, ...) way to extract all footnotes in a MS Word file and also keep the corresponding number from the original text?


Save XML into list or array?

We have a 600K-line XML file with tons of data. Of all the data, what I need to read are the nodes <mv>, and the way to know which <mv> I want to read is because it has an element <mod> inside with text that begins with "ValueAssigned=1, Function=1, Id="

This is not a complete XML string by any means, but this would be some sort of example.

The end result would be to match each Id with its values in <t>.

<mv>
<mod>ValueAssigned=1, Function=1, Id=1</mod>
<t>123</t>
<t>20</t>
<t>10</t>
<t>40</t>
</mv>
<mv>
<mod>ValueAssigned=1, Function=1, Id=2</mod>
<t>300</t>
<t>21</t>
<t>56</t>
<t>30</t>
</mv>

The result would be to save this into a table. I don't need help saving the data into the table, but I do need help trying to save all those sections into some type of list:

ID  Value
1   123
1   20
1   10
1   40
2   300
2   21
2   56
2   30

I was thinking of something like this, but I haven't tried it yet:

string textToFind = "ValueAssigned=1, Function=1, Id=";
IEnumerable<XElement> query1 = doc.Descendants("mod").Where(c => c.Value == TextToFind).Ancestors("mv");

Thanks.


How can I do multi-dimensional matrix multiplication?

I have an array (A) 3500x7500x10.

And a matrix (B) 3500x7500.

So I want to do element-by-element multiplication B with each of the 10 pages of A.

Obviously, this doesn't work.

A = A(:,:,:).*B;

I know how to do it in a loop, but is there is a vectorized way of doing it?


Google login page - Sign in to continue to companyName

I have modified the user agent to be able to login to Google. When the user tries to login, he sees the following screen:

The company name I hid is clickable. Upon clicking it, there pops a small dialogue box with some Developer Info.

1) Is there any way to disable that link?

2) If not, is it possible to modify the text inside the dialogue box? Because currently, personal email id of a developer is displayed which we don't want.

Any help or relevant link would be appreciated.

EDIT:

Just like YouTube is disabled, I want my company's name to be disabled as well..


Django: how do I include the same field multiple times in a Django form?

I've got a basic friend invite form in my Django app that looks like this:

class FriendInviteForm(forms.Form):
    email = forms.EmailField()

It works perfectly when a user is inviting a single person, but I'd like to allow the user to invite as many of their friends as they'd like. The implementation I am trying to build would be to display the form with 3 email fields, and allow the user to dynamically add more fields on the client side using jQuery.

What is the best way to handle the creation of such a form, and how would I process the email fields in my view? Can I still use Django's built in forms for this?

Thanks!


Pointer to function taking abstract parameter

Let A be an abstract class in C++:

// legal
class A {
  virtual void m() = 0;
}

It is illegal, of course, to define a variable whose type is an abstract class:

A a; // illegal

Indeed, clang 3.6.0 complains thus:

wat.cc:5:3: error: variable type 'A' is an abstract class
A a;
  ^
wat.cc:2:16: note: unimplemented pure virtual method 'm' in 'A'
  virtual void m() = 0;
               ^
1 error generated.

Likewise, it is illegal to define a function with a parameter whose type is an abstract class:

void f(A a) {} // illegal

Indeed, clang complains thus:

wat.cc:5:10: error: parameter type 'A' is an abstract class
void f(A a) {}
         ^
wat.cc:2:16: note: unimplemented pure virtual method 'm' in 'A'
  virtual void m() = 0;
               ^
1 error generated.

On the other hand, it is legal, of course, to define a variable whose type is a pointer to values of an abstract class:

A * a_ptr; // legal

Even if that class never had any base classes defined, the type A * has at least one value, nullptr, so it is always possible to use such a variable in a type-correct way, even if it’s probably not very useful unless A at some point gets some concrete subclasses:

a_ptr = nullptr; // legal

Presumably, this reasoning applies to any pointer type.

Likewise, it is legal to define a function taking a parameter whose type is a pointer to values of an abstract class:

void f(A * a) {} // legal

Likewise, it is legal to define a function taking a parameter whose type is a pointer to functions taking a parameter whose type is a pointer to values of an abstract class:

void f(void (* g)(A *)) {} // legal

Both of these functions, of course, can be called legally:

f(nullptr); // legal

Presumably, the specific type of the function parameter is irrelevant to the correctness of the type as long as it’s a pointer type.  That call to f should be legal in either case.  In terms of type theory, well-formed pointer types are always legal and nullptr always inhabits them.  By this reasoning, this definition should be presumed legal:

void f(void (* g)(A)) {}

f is a function that takes a parameter whose type is a pointer to functions that take a parameter whose type is a value of the abstract class A.

Indeed, the only possible value for that parameter is nullptr, since no actual function can take a parameter whose type is an abstract class.

Is this legal per the C++ standard?

Clang complains:

wat.cc:5:20: error: parameter type 'A' is an abstract class
void f(void (* g)(A)) {}
                   ^
wat.cc:2:16: note: unimplemented pure virtual method 'm' in 'A'
  virtual void m() = 0;
               ^
1 error generated.

GCC doesn’t.

Update: This question was correctly answered, but the question itself is wrong in stating Clang accepts that function.  Both GCC and Clang yield similar errors with this code.  However, Clang accepts such functions if they are member functions.  This works:

#include <iostream>

struct A {
  virtual ~A() = 0;
};

struct B {
  void f(void (*g)(A)) {
    std::cout << "Works!" << std::endl;
  }
};

int main() {
  B().f(nullptr);
  return 0;
}

This seems to be simply a bug in Clang, though.  According to the language in the section of the standard cited in the accepted answer, this code should be rejected.


White space when hide bottom bar on push

I have a tabBarController and when I push a view controller I am hiding the bottom bar to not show the tabBar in the second view controller. The problem is that I see a white space for a moment.

This is de code I am using to push the view controller

VerResultadoViewController *controller = (VerResultadoViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"ver_resultado"];
controller.hidesBottomBarWhenPushed = YES ;
[self.navigationController pushViewController:controller animated:YES];

This is the white space:


Highcharts spacing issue on xAxis in column chart

When I create a simple column chart with at least 2 datapoints there is annoying spacing as you can see in the jsfiddle. The width of the spacing scales with the smallest distance between two datapoints. I can't find any other options besides the one I've already set (min, max, minRange) to prevent the spacing.

$(function () {
$('#container').highcharts({
    chart: {
        type: 'column'
    },
    xAxis: {
        tickInterval: 1,
        min: 0,
        max: 23,
        minRange: 23
    },
    series: [{
        data:[[0,10], [23,10]]
    }]
});
});

http://jsfiddle.net/f5JUU/2/ (Big spacing)

http://jsfiddle.net/f5JUU/3/ (No spacing. This is how the other Jsfiddle should look like too...)


What is with GWT and external libraries?

I am making a GWT application that involves users being able to upload files. My question is...

What is wrong with GWT?? It seems like every time I try to include a jar file in my project, it doesn't like it. I am using Eclipse. Everything compiles fine, but during runtime, UmbrellaExceptions happen, which get traced back to some ClassNotFoundException eventually (relating to whatever new jarrified class I just tried to use).

I read something about this somewhere else, but I can't remember exactly what the deal is; for whatever reason GWT just isn't compatible with some libraries..? Like java.io, for example. Pretty much everything in that package causes this to happen. Like, I can't even use FileNotFoundException for simple File I/O.

Again, just to clarify: everything imports and compiles fine, but GWT doesn't want to load certain classes for some reason.

My latest problem is trying to use Apache's Tika stuff for file validation. Attempting to instantiate any of their classes such as

Metadata metadata = new Metadata();

causes

java.lang.ClassNotFoundException: org.apache.tika.metadata.Metadata
at com.google.gwt.dev.shell.CompilingClassLoader.findClass(CompilingClassLoader.java:1061)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at gwtupload.client.Uploader$10.onSubmit(Uploader.java:454)
at com.google.gwt.user.client.ui.FormPanel$SubmitEvent.dispatch(FormPanel.java:178)
at com.google.gwt.user.client.ui.FormPanel$SubmitEvent.dispatch(FormPanel.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.user.client.ui.FormPanel.fireSubmitEvent(FormPanel.java:618)
at com.google.gwt.user.client.ui.FormPanel.submit(FormPanel.java:556)
at gwtupload.client.Uploader.submit(Uploader.java:1051)
at gwtupload.client.SingleUploader$1.onClick(SingleUploader.java:141)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)


Passing Data Between Two NSOperations

I watched with a great attention the WWDC 2015 sessions about Advanced NSOperations and I played a little bit with the example code.

The provided abstraction are really great, but there is something I may did not really good understand.

I would like to pass result data between two consequent Operation subclasses without using a MOC.

Imagine I have a APIQueryOperation which has a NSData? property and a second operation ParseJSONOperation consuming this property. How do I provide this NSData? intance to the second operation ?

I tried something like this :

queryOperation = APIQueryOperation(request: registerAPICall)
parseOperation = ParseJSONOperation(data: queryOperation.responseData)
parseOperation.addDependency(queryOperation)

But when I enter in the execute method of the ParseJSONOperation the instance in not the same as the same as in the initialiser.

What did I do wrong ?


iPhone programming-- UIView elements appear to be ignoring Hidden=NO calls

Using XCode 4.4 and Mountain Lion,

I have a UIImageView, and on that view, I have a UIProgressView and a UIButton.  When the app starts, the progress view and button are both hidden, as set in the storyboard.  I then try to unhide them, first the progress bar when I'm doing something, and then the button when I'm done.  I have called, for both items,

[self.view bringSubviewToFront:saveToCameraRoll];

to try to put them in front of the UIView.

Problem is, when I programmatically try to unhide them, it doesn't work.  I can call:

progressBar.hidden = NO;
[self.view bringSubviewToFront:progressBar];

And that does nothing.

So then I tried to set everything as visibile in the storyboard and then programmatically set everything to be invisible once the controller loads.  No deal; now my calls to hidden = YES seem to be ignored.

I then removed all actual programming, so that hitting buttons should just cause the button and progress bar to appear, reasoning that maybe the main thread was getting starved and couldn't update.

How can I force elements to pay attention to being hidden?

EDIT: I've now also tried programmatically modifying the alpha from 1 to 0.  No change.  It's like everything I'm doing is getting ignored.  I made these items via the ctrl-drag method into the @interface section of the .m file; maybe I don't have some more delegates or interfaces or whatever hooked up?


Problems with ASP.NET and custom events

I have a problem when handling the ReceiveCompleted event of a MessageQueue in ASP.NET.
It catches it successfully, but every changes applied to the Controls of the page have no effect.

This is what I've got:

.ASPX

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
   <ContentTemplate>
       <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
       <br />
       <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
   </ContentTemplate>
</asp:UpdatePanel>

<asp:Timer ID="Timer1" runat="server" Interval="3000" ontick="Timer1_Tick">
</asp:Timer>

.CS

private static System.Messaging.MessageQueue queue;
private static String messageContent;

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    queue = new MessageQueue(@".\Private$\MyQueue");
    queue.ReceiveCompleted += new ReceiveCompletedEventHandler(mq_ReceiveCompleted);
    queue.BeginReceive();
}

protected void mq_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e)
{

    System.Messaging.Message message = queue.EndReceive(e.AsyncResult);
    message.Formatter = new System.Messaging.XmlMessageFormatter(new string[] { "System.String,mscorlib" });

    Label1.Text = message.Body.ToString();      //Has no effect. The value updates without problem, but doesn't persist after finishing this method. And the Page doesn't refresh with this new value.
    Label2.Text = DateTime.Now.ToString();      //Has no effect too.
    Timer1.Interval = 99999;                    //And this one the same, no effect.
    messageContent = message.Body.ToString();   //.. But the value stored in this variable does persist

    queue.BeginReceive();
}

I don't why it fails updating those vars. It may be any nonesense, but I'm new to ASP.NET, so any clue will be welcome.

Thanks in advance!

Pablo


Play several videos using AVPlayer in a view

I have an UIView which contains some some texts and views. in each view I need to play a video with AVPlayer , but my problem is only the first view shows the video :

Here is my code :

func playVideo(name:String , onView:UIView) {

    let path = Bundle.main.path(forResource: name, ofType: "mp4")
    let videoURL = URL(fileURLWithPath: path!)
    let player = AVPlayer(url: videoURL)
    let playerLayer = AVPlayerLayer(player: player)
    playerLayer.frame = onView.frame
    playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill
    onView.layer.addSublayer(playerLayer)
    player.play()

}

Using the function :

override func viewDidLoad() {
        super.viewDidLoad()

//ScrollView
    scrollView.contentSize = menuView.frame.size
    scrollView.addSubview(menuView)

//Play videos
 playVideo(name: "pizza", onView: videoView1)
 playVideo(name: "salad", onView: videoView2)
 playVideo(name: "fries", onView: videoView3)
}

when I run the app video only play in videoView1 , any suggestion why this happens ?
 I also put my code in viewWillAppear , viewDidLayoutSubviews


Sql Query to group the data from two tables

I have two tables Department and Employee.

Department table looks like this:

   ID     DeptName
   1      IT
   2      CSE
   3      ECE

Employee table :

   ID     DeptID     EmployeeName    Salary
   1       1         John            10000
   2       1         Bob             15000
   3       2         Akon            12000
   4       2         Smith           20000

Now I want to group the data in such a way that I get the following results which include these columns :

  ID      DeptName      Employee
   1       IT            John,10000
                         Bob,15000

   2       CSE           Akon,12000
                         Smith,20000

Can we do something like this using SQL group functions or any other way?

Please help me.

Thanks,
Rajbir


"execution_count" error when running a job on a remote IPython cluster

I am running an IPython cluster (SSH) on a remote Linux machine, and I am using Mac OS X with IPython to use that cluster. In IPython on Mac I write:

from IPython.parallel import Client
c = Client('~/ipcontroller-client.json', sshserver="me@remote_linux_machine")
dview=c[:]
dview.scatter('m', arange(100))

where '~/ipcontroller-client.json' is the file copied from remote_linux_machine. Everything works up to this point.

When I try to use parallel magic %px I get an error:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/parallel/client/client.pyc
in __init__(self, msg_id, content, metadata)
     80         self.msg_id = msg_id
     81         self._content = content
---> 82         self.execution_count = content['execution_count']
     83         self.metadata = metadata
     84

KeyError: 'execution_count'

Same idea, but when I run the cluster on localhost it works perfectly.

Should parallel magic work at all for remote SSH cluster case?


number of rows in section, how to set this value after a parse query in the cell for row at index path function

So i need some help with controlling my code flow, i'm trying to make a list display cells that i query from my parse server, however i do not know the amount of cells until i make the query in

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
//Query goes here {rowCount = queryResult.count}

I have tried to create a global variable that will take the object count, but have no success since i have to set the value to something beforehand, like this:

var rowcount = 0

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

    return rowCount
}

Any good example on how to control this so that i get the right amount of rows from the query?

I did not find any similar question on Stack, thanks in advance!


Dynamically looping through URL parameters

I'm trying to write a bit of code that will loop through URL parameters that start with the word 'layer' followed by 1,2,3, etc. For example:

http://example.cfm?numLayers=2&layer1=somevalue,123&layer2=someothervalue,456

The number of layers in the URL will be different each time.

This is my code:

<cfif isDefined("url.numLayers") AND url.numLayers gt 0>
    <cfset session.structLayers = structNew() />
    <cfloop index="index" from="1" to="#url.numCustom#">
        <cfset layerElement = evaluate(url.layer#index#) /><!--- This is where I'm having trouble --->
        <cfset arrLayerElement = listToArray(layerElement)>
        <structInsert(session.structLayers, arrLayerElement[1], arrLayerElement[2])]>
    </cfloop>
</cfif>

I'm getting an 'Invalid CFML construct error' on the line marked above. I'm not doing this right.


I can not access my git project via Eclipse, after commit

I am new to github and I'm doing a project which is hosted on github.

But at the last(perhaps before) commit I made a mistake.

And now I can not access all my files via Eclipse..
I can not figure out where this problem is!!

This my project from Eclipse

http://i.stack.imgur.com/qbru7.png

Here is a .rar file of the project:

http://s000.tinyupload.com/index.php?file_id=01777472951924421639&gk=hotel


Spring Boot - "Path index.html does not start with a "/" character"

I am learning spring-boot and AngularJS, using Eclipse as an IDE, and Tomcat 8.0.30 (64 bits) as the container, running inside Eclipse. It is a Maven project.

Although the application is very basic and silly, I am getting an error when accessing the application via browser. The problem is, if I don't enter the URL with a slash (/) in the end, I got an error. The server logs throws this:

Url http://localhost:8080/app

java.lang.IllegalArgumentException: Path index.html does not start with a "/" character

However, if I enter the url like http://localhost:8080/app/ then the application runs fine.

As you may know, spring-boot applications don't rely on web.xml. In fact, spring-boot loads index.html as the welcome page, or it is supposed to.

I ran the application outside Eclipse, by deploying to a Tomcat container. I got a 404 without the slash, and with the slash, it works fine. By running in self-contained mode (embeeded Tomcat) it works just fine.

Why the application does not redirect to index.html without the slash in the end?

You can find the entire application here (I am tagged it):

https://github.com/ajkret/spring-boot-sample/tree/slash-problem

Here is my Application.java

@SpringBootApplication
@ComponentScan(basePackages = { "br.com.cinq.greet" })
@EnableAutoConfiguration
public class Application extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

    public static void main(String[] args) {
        new Application().configure(new SpringApplicationBuilder(Application.class)).run(args);
    }
}

Here my ResourceConfig, for Jersey.

@Configuration
@ApplicationPath("rest")
public class Config extends ResourceConfig {

    public Config() {
        register(GreetResource.class);
    }
}

Here is the GreetResource, a typical Jersey Resource:

@Path("/greet")
public class GreetResource {
    Logger logger = LoggerFactory.getLogger(GreetResource.class);

    // For now, store the information on a bean, in memory
    @Autowired
    Greet greet;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response greet() {
        logger.debug("Received GET requisition");
        return Response.ok().entity(greet).build();
    }

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    public Response greet(Greet greet) {
        try {
            this.greet.setMessage(greet.getMessage());
            logger.info("Greeting message updated {}",this.greet.getMessage());
        } catch (Exception e) {
            logger.error("An exception occurred during Greet message update", e);
            return Response.status(Status.INTERNAL_SERVER_ERROR).entity("exception").build();
        }

        return Response.ok().build();
    }
}

That is it, all Java classes that may interfere with the process are here.

Here are the dependencies for the POM:

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

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
    </dependency>

</dependencies>

UPDATE

I've installed Tomcat 8.0.24, and the problem was solved, apparently.

Are there new rules, RFCs, something new I don't know about the slash?


How to add rowspan with dynamic table values in this html table?

I have an AJAX that append tr to a table. The number of tr appended to the table is varies depend on the data returned. This is my AJAX:

success  : function(data)
{
   var tableData,t1,t2,t3,t4,t5,t6,t7;
   var no       = 1;

   $.each(data.result_brg, function(index, rows_minta) {
      t1    = "<tr><td><font size='1'>"+ no++ +"</font></td>";
      t2    =     "<td align='left'><font size='1'>"+ rows_minta.NamaOutlet +"</font></td>";
      t3    =     "<td class='barang' style='text-align:left; vertical-align:middle'>"+ rows_minta.NamaBarang +"</td>";
      t4    =     "<td class='j_minta' style='text-align:right; vertical-align:middle'>"+ rows_minta.jumlah_minta +"</td>";
      t5    =     "<td></td>";
      t6    =     "<td class='satuan' style='text-align:left; vertical-align:middle'>"+ rows_minta.Satuan +"</td>";
      t7    =     "<td></td></tr>";

      tableData += t1+t2+t3+t4+t5+t6+t7;

      $('#tbl_content tbody tr').remove();
      $('#tbl_content tbody').append(tableData);
   });

This is the table displayed:

No     outlet     item      stock     type       unit          invoice_no
1      outlet A   Book         45
2      outlet A   Pen          24
3      outlet A   Pencil       87
4      outlet A   Ruler        96
5      outlet B   Bag          57
6      outlet B   Shirt        32
7      outlet C   SSD          64

The Table I'm looking for:

No     outlet     item      stock     type       unit          invoice_no
1                 Book         45
2                 Pen          24
       outlet A
3                 Pencil       87
4                 Ruler        96
5                 Bag          57
       outlet B
6                 Shirt        32
7      outlet C   SSD          64

Note: The first column is should be centered (valign=middle and text_align=center)


Custom html with download data button in Shiny

I'm wondering how to make the Shiny downloadHandler work with a custom html UI.

In my index.html I have the following:

<a id="downloadproject" class="shiny-download-link shiny-bound-output">export</a>

And in the server.R I have:

output$downloadproject <- downloadHandler(
    filename = "test.csv",
    content = function(file) {
        test_data <- c(1,2,3,4,5,6,7)
        write.csv(test_data, file)
    }
 )

However, I can't get it working. I've noticed inspecting the source on the demo page: http://shiny.rstudio.com/gallery/file-download.html that the link there points to a resource:

<a id="downloadData" class="btn shiny-download-link shiny-bound-output" href="session/58c63083742fd00d75ac37732eb224bc/download/downloadData?w=299e8cd2e7b56a2507a31ddbe72446fd2ce5d51f5940ea0a" target="_blank">
      <i class="fa fa-download"></i>
      Download
</a>

However, I guess that this it to be set by the downloadHandler from the server side. My a-tag in however does not get any href at all. Is what I'm looking to do even possible? Am I'm making some mistake here? Any ideas on how to fix this would be much appreciated.


SQL count specific items for a cutomer

I need to render the following table in order to now how many burgers a customer has payed

Customer | Burger 1 Quantity | Burger 2 Quantity|

I have two tables :

customer table : with CustomerID, Name

Transaction order : with TransactionOrderID CustomerID and BurgerCode

I have 6 burger code, for each one I need to add a column, what is the best way to do that?


LISP Concatenate variable name with a string

I am wondering if i can do something like this in Lisp :

I need to declare n variables . So they will be n1,n2,n3...etc

(dotimes (i n) (setq (+ 'n i))

Is it possible ?


Can i use episerver CMS as identity provider for SSO using SAML?

I need to do SSO between episerver CMS and Liferay CMS using SAML. I know that LifeRay can act both as Service Provider as well as Identity Provider. I want to know that can Episerver CMS also act as Identity provider as well as service provider?