INFORMIX: UPDATE with ALIAS?

update prpcopycoins a set a.comtype=(
    select b.comtype from prpcopycoins b where b.policyno=a.policyno and b.serialno=a.serialno and b.applyno[1]='E')
where a.applyno in ('1461F00001', '1461F00002');

I'm trying to update several rows of table prpcopycoins with values from other rows of the same table. The above code got a syntax error because of the alias represented. How to correct it?

I'm using 'IBM Informix Dynamic Server Version 11.50.FC8W4'.


R creating a new column for a dataframe based on existing column using R

i am working with R and here is my dataframe

Died.At <- c(22,40,72,41)
Writer.At <- c(16, 18, 36, 36)
First.Name <- c("John", "John", "Walt", "Walt")
Second.Name <- c("Doe", "Poe", "Whitman", "Austen")
Sex <- c("MALE", "MALE", "MALE", "MALE")

writers_df <- data.frame(Died.At, Writer.At, First.Name, Second.Name, Sex)

i want to add a new column called id according to the name, so john and walt in this case, i know i can easily do this by

id<-c("1","1","2","2")

but i have a large data set to deal with , also, the name will not  appear again afterwards, so there will not be anymore john after walt, can anyone help me with this please


Running a standalone Hadoop application on multiple CPU cores

My team built a Java application using the Hadoop libraries to transform a bunch of input files into useful output.
Given the current load a single multicore server will do fine for the coming year or so. We do not (yet) have the need to go for a multiserver Hadoop cluster, yet we chose to start this project "being prepared".

When I run this app on the command-line (or in eclipse or netbeans) I have not yet been able to convince it to use more that one map and/or reduce thread at a time.
Given the fact that the tool is very CPU intensive this "single threadedness" is my current bottleneck.

When running it in the netbeans profiler I do see that the app starts several threads for various purposes, but only a single map/reduce is running at the same moment.

The input data consists of several input files so Hadoop should at least be able to run 1 thread per input file at the same time for the map phase.

What do I do to at least have 2 or even 4 active threads running (which should be possible for most of the processing time of this application)?

I'm expecting this to be something very silly that I've overlooked.

I just found this: https://issues.apache.org/jira/browse/MAPREDUCE-1367
This implements the feature I was looking for in Hadoop 0.21
It introduces the flag mapreduce.local.map.tasks.maximum to control it.

For now I've also found the solution described here in this question.


How to compile Scala source code into .Net

I create a scala source file test.scala:

// the source code in test.scala
import System.Console
object TestMain extends Application {
    override def main(args: Array[String]) = {
        Console.WriteLine("Hello .NET World!")
    }
}

Not that I import the System.Console which is from the .Net library.

Before compiling, I download a scala-msil package from http://www.scala-lang.org/downloads/packages/scala-msil-2.8.1.final.sbp and then install it by sbaz install -f scala-msil-2.8.1.final.sbp.

After that, some scripts, such as scalac-net.bat used to compile *.scala to *.msil, is created in %SCALA_HOME%\bin and dlls, such as microlib.dll, predef.dll and scalaruntime.dll, in %SCALA_HOME%. Unfortunately I got the error when scalac-net test.scala

Can anyone give me a suggestion ??

PS: My scala version  is 2.8.1


Trigger compiled but on firing gets ORA-01722 error

CREATE OR REPLACE TRIGGER ABC_TEST_TRIG
BEFORE UPDATE ON ABC_TEST
FOR EACH ROW
DECLARE
NAME_CH VARCHAR2(25);
NUM_CH NUMBER(5);
BEGIN
--SELECT NAME,NUM INTO NAME_CH, NUM_CH FROM ABC_TEST WHERE NAME ='KUNAL';

  INSERT INTO ABC_NEW (NEW_NAME,OLD_NAME,NEW_NUM,OLD_NUM)
    VALUES(':NEW.NEW_NAME',':OLD.NAME',':NEW.NEW_NUM',':OLD.NUM') ;
END;
/

UPDATE ABC_TEST SET NAME ='KUSH' , NUM=90 WHERE NAME = 'KUNAL';

error:

UPDATE ABC_TEST SET NAME ='KUSH' , NUM=90 WHERE NAME = 'KUNAL'
Error report -
SQL Error: ORA-01722: invalid number
ORA-06512: at "APPSREAD.ABC_TEST_TRIG", line 7
ORA-04088: error during execution of trigger 'APPSREAD.ABC_TEST_TRIG'
01722. 00000 -  "invalid number"
*Cause:    The specified number was invalid.
*Action:   Specify a valid number.


$ rails db fails with error, but database is working fine

My Rails 3.2 app is using a PostgreSQL database. It's working great locally. I can migrate and interact with the application through the browser or irb.

However when I run $ rails db, I get an error:

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

My Postgres socket is actually located at: /var/pgsql_socket/.s.PGSQL.5432

So how can I tell rails to look for it there when I use $ rails db


Why isn't the document with an exact match the first result in a Retrieve and Rank Solr query?

We have taken a large quantity of documents, broken them up into segments ("answer units") using Watson's Document Conversion service, and added them to a Retrieve and Rank Solr collection. If I run a query against the collection using a copy/paste of text (maybe 150 words) from one of the answer units, Retrieve and Rank will return a bunch of documents, and (as expected) the results include the answer unit from which the query text was copied.
However, that answer unit is not the very top result; it is usually 7 or 8 documents from the top.  If I surround the query text with quotes, then Solr rightfully considers that a phrase and returns only that single answer unit.
Without the quotes though, shouldn't the document with the exact wording in the query still be the top document in the results?


how to deploy Jsp Project In tomcat server

I have Successfuly Deploy my Jsp Project On Tomcat Server in Windows . But when i send my  Project to main server (we don't have Full access of Client  Tomcat server  They Gave me FTP for send ) so Using File Zila i am sending My Project to client server then file deployed But only client side code run please check this [http://www.incometaxindiapr.gov.in/incometaxindiacr/cbdt-cir-not/Home.jsp ] when i try to serch any thing from serch Box then  Project gives org.apache.jasper.JasperException: Unable to compile class for JSP:  Exception . please help me.

NOTE: CLIENT have Linux server in that install Tomcat Server .


magento add multiple products to cart from wishlist through check box

Scenario:
 Want to add multiple products to cart from wishlist through check box, such that the selected products along with their quantity are transferred to cart and the selected items are removed from the wishlist table.

Referred many blogs.

I tried to implement it by (applying) adding related-products javascript (logic).
But still not getting.

[updated]

This is the checkbox column (time being hard code)

<input type="checkbox" class="checkbox related-checkbox" id="related-checkbox7" name="related_products[]" value="7">

Added Javascript for this part:

<script type="text/javascript">
    //<![CDATA[
    $$('.related-checkbox').each(function(elem){
        Event.observe(elem, 'click', addRelatedToProduct)
    });

    var relatedProductsCheckFlag = false;
    function selectAllRelated(txt){
        if (relatedProductsCheckFlag == false) {
            $$('.related-checkbox').each(function(elem){
                elem.checked = true;
            });
            relatedProductsCheckFlag = true;
            txt.innerHTML="unselect all";
        } else {
            $$('.related-checkbox').each(function(elem){
                elem.checked = false;
            });
            relatedProductsCheckFlag = false;
            txt.innerHTML="select all";
        }
        addRelatedToProduct();
    }

    function addRelatedToProduct(){
        var checkboxes = $$('.related-checkbox');
        var values = [];
        for(var i=0;i<checkboxes.length;i++){
            if(checkboxes[i].checked) values.push(checkboxes[i].value);
        }
        if($('related-products-field')){
            $('related-products-field').value = values.join(',');
        }
    }
    //]]>
    </script>

Add to cart
 <button type="button" title="Add to Cart" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span>Add to Cart</span></span></button>

And javascript for this part:

<script type="text/javascript">
    //<![CDATA[
        var productAddToCartForm = new VarienForm('product_addtocart_form');
        productAddToCartForm.submit = function(button, url) {
            if (this.validator.validate()) {
                var form = this.form;
                var oldUrl = form.action;

                if (url) {
                   form.action = url;
                }
                var e = null;
                try {
                    this.form.submit();
                } catch (e) {
                }
                this.form.action = oldUrl;
                if (e) {
                    throw e;
                }

                if (button && button != 'undefined') {
                    button.disabled = true;
                }
            }
        }.bind(productAddToCartForm);

        productAddToCartForm.submitLight = function(button, url){
            if(this.validator) {
                var nv = Validation.methods;
                delete Validation.methods['required-entry'];
                delete Validation.methods['validate-one-required'];
                delete Validation.methods['validate-one-required-by-name'];
                // Remove custom datetime validators
                for (var methodName in Validation.methods) {
                    if (methodName.match(/^validate-datetime-.*/i)) {
                        delete Validation.methods[methodName];
                    }
                }

                if (this.validator.validate()) {
                    if (url) {
                        this.form.action = url;
                    }
                    this.form.submit();
                }
                Object.extend(Validation.methods, nv);
            }
        }.bind(productAddToCartForm);
    //]]>
    </script>

Thanks in advance


Logging in an application with different social networks

I am being approached by a client who (among other things) wants to implement social network login to his application in addition to his/her API, aiming at Facebook, twitter, and FourSquare. My client is setting up a web service.

Is there any 3rd party Library that will help for this? I know that for Facebook there exists the Facebook connect framework, but what about Twitter API and foursquare? Is there any decent iOS library for those? (for twitter, MGtwitterEngine seems a bit old, not having an update for over a year). I need to support iOS versions 4.3+, so Apple's twitter integration is not an option.

In addition, the web server's native HTTP API is based on tokens (login with the valid credentials, receiving a token, and make further requests to the server using HTTP with the token as a parameter). Will he need to do some extra work for supporting tokens received from Facebook, twitter, or anything else apart from the token from his own service during the login process?

Thank you in advance.


Reuse a TcpClient in c#

We have a device that accepts ascii messages over a wireless network, and then responds with a value and I have successfully implemented this in a Windows Forms 2010 solution in c#.

I wrote this as a test solution to prove the technology and the actual calls to the device will be made on a Motorola MC55 handheld device.

I have now written an additional test solution in Visual Studio 2008 and installed this onto a device, but the connection to the TcpClient takes around 30 seconds every time its called on the mobile device, where as on the windows solution it's almost instant.

This is far too slow, so I have started looking at reusing the TcpClient, but not had any success and wondered if anyone else has had similar issues and to ask how they got around it, or if anyone can offer any advice on how to reuse a TcpClient so I don't have to create a new one every time I want to make my call.

The code for the connection is shown below...

     public static string GetValueFromDevice(string deviceIPAddress, int devicePort, string messageSentToDevice)
    {
        string returnValue = "";

        try
        {
            TcpClient client = new TcpClient(deviceIPAddress, devicePort);

            byte[] inData = System.Text.Encoding.ASCII.GetBytes(messageSentToDevice);
            NetworkStream stream = client.GetStream();
            stream.Write(inData, 0, inData.Length);

            byte[] outData = new Byte[256];
            int bytes = stream.Read(outData, 0, outData.Length);
            returnValue = System.Text.Encoding.ASCII.GetString(outData, 0, bytes);

            stream.Close();
            client.Close();
        }
        catch (Exception ex)
        {
            returnValue = ex.Message;
        }

        return returnValue;
    }


AFNetworking: secure handshake no longer works after certificate renewal

My app uses AFNetworking.

What type of certificate extension does AFNetworking look for?
I was given a .crt file by GeoTrust but I have read here that AFNetworking specifically looks for .cer files.

I ask because my https in a browser works fine with my new certificate chain, and using a tool called SSLDetective I can see that the whole chain is trusted, but for some reason my app no longer accepts the bundle for a trusted handshake. Any other time I had issues, SSLDetective showed me that a part of the chain was not trusted. In this case, I can't seem to find anything wrong. Not much changed in my ssl certificate configuration other than overwriting the old key and crt files with the new files with the exact same name. Help is appreciated. Thanks!

EDIT:

I now know for sure that AFNetworking does use and automatically detects .cer files in the app bundle. I also know that the certificate attached in the bundle must match the same public key as the certificate on my web server. With public key pinning, AFNetworking simply extracts the public key from the local certificate and compares it to the one on the server. If the one on the server matches, it uses the server's certificate.

In my case, in the beginning, the keys did not match, but now I made sure that they do. The chain is still trusted and good according to SSLDetective. I downloaded a .cer version of the certificate from the server using SSLDetective and attached it to my app bundle. However, now that I know for sure the public keys match as well, I still can't seem to get a secure handshake. This question is somewhat related to the question asked here.


Using Numpy arrays for looping

How would one go about converting p = img.ptr<uchar>(row); which is written using OpenCV in C++, into OpenCV's Python bindings?

From what I understand, since images are represented as NumPy arrays in OpenCV Python - does this mean that it could be represented as p = img[row, 0, :] or perhaps p = img[row, 0] for a grayscale image?

This construction of p is in a for loop, and it is in order to facilitate looping through every pixel row by row.

I tried a simple for loop to loop through every pixel in the image, but I also need to implement functionality such as blanking out a given row after looping through it.

If I can understand what p would translate into in Python, I am confident it can be done easily. I looked at solutions that involved linking Python code with C++ files, but I am a beginner and want to keep things simple.

I was also considering using SKImage, would anyone recommend that library?
Thanks


Coercing a LINQ result list of KeyValuePair into a Dictionary - Missing the Concept

I wanted to write this LINQ statement:

Dictionary<int, ItemBO> result = ( Dictionary<int, ItemBO> )
    ( from item in originalResults where item.Value.SomeCriteria == true
    select item );

originalResults is of type Dictionary<int, ItemBO>.

I get that item is of type KeyValuePair<int, ItemBO>, but would have thought that the cast from a list of that type to a Dictionary of that type would have been... er... "Natural".

Instead, to get the compiler to shut up, I needed to write this:

Dictionary<int, ItemBO> result =
    ( from item in originalResults where item.Value.SomeCriteria == true
    select item.Value ).ToDictionary( GetItemKey );

Which, although not entirely counter-intuitive, suggests that a lot of unnecessary work unpackaging and repackaging the Dictionary is going on under the covers. Is there a better solution? Is there a concept I'm missing out on?


Pairwise list modification in Haskell

I want to write a modifyList function which takes a list of data structures, modifies them using a function modify and return that modified list.
The problem I’m having is, that my modify function takes pairs of elements from a list and applies changes to both elements.

This is my (simplified) code so far:

import qualified Data.Vector as V
import Data.List

data Structure = Structure{ factor :: Double
                          , position :: V.Vector Double
                          } deriving (Show)

-- Calculates a factor with values from both structures
calculateFactor :: (Structure, Structure) -> Double
calculateFactor (p, q) = (factor p) + (factor q) -- This calculation is simplified

modify :: (Structure, Structure) -> (Structure, Structure)
modify (a, b) = ( a { position = V.map (+ structureFactor) (position a) }
                , b { position = V.map (subtract structureFactor) (position b) })
            where structureFactor = calculateFactor(a,b)

modifyList :: [Structure] -> [Structure]
modifyList l = [ ??? | (p, q) <- (map (modify) pairs)] -- What do I need to do here?
             where pairs = [(x, y) | (x:ys) <- tails l, y <- ys]

How can I make these modifications so that subsequent function calls can work with the updated values?

As an example, I define some data like this:

p = Structure 2 (V.replicate 3 1.0)
q = Structure 3 (V.replicate 3 1.0)
u = Structure 4 (V.replicate 3 1.0)
list = [p, q, u]

Now modifyList list should call modify for each element pair in my list: (p, q) (p, u) (q, u) which gives me a result list of pairs:

[(Structure {factor = 2.0, position = [6.0,6.0,6.0]}, -- Modified p
  Structure {factor = 3.0, position = [-4.0,-4.0,-4.0]}), -- Modified q
  (Structure {factor = 2.0, position = [7.0,7.0,7.0]}, -- Also modified p
  Structure {factor = 4.0, position = [-5.0,-5.0,-5.0]}), -- Modified u
  (Structure {factor = 3.0, position = [8.0,8.0,8.0]}, -- Also q
  Structure {factor = 4.0, position = [-6.0,-6.0,-6.0]})] -- Also u

But what I actually want to end up with is the same list with [p, q, u] where p has position = [12.0, 12.0, 12.0] as if I had manually called p' = fst(modify (p, q)) and then call p = fst(modify(p', u)) to give the original position p a new value. Respectively q should have position = [3.0, 3.0, 3.0] and u, position = [-12.0, -12.0, -12.0].

A pseudocode for an imperative language could look like this:

Structure = {Double factor, Vector position};
Structure[] list = {p, q, u};
for i = 0; i < list.length; i++;
    for j = i+1; j < list.length; j++;
        structureFactor = calculateFactor(list[i], list[j]);
        //Destructive updates
        list[i].position += structureFactor; //Add factor to each vector value
        list[j].position -= structureFactor;

I've tried experimenting with Mutable Vectors but failed trying to include these in my data structure, since my understanding of Haskell is too basic and I'm not even sure if this approach makes sense.

Is there any easy way to do this?


How to retry transaction after a deadlock using Doctrine?

I am writing a PHP function which store/updates large sets of data into a table and that may cause a deadlock. I tried investigating how to retry a failed transaction with Doctrine but sadly could not find any info online. I eventually wrote the following code

 $retry = 0;
 $done = false;
 while (!$done and $retry < 3) {
     try {

         $this->entityManager->flush();
         $done = true;

     } catch (\Exception $e) {
         sleep(1);

         $retry++;
     }
 }

 if ($retry == 3) {
     throw new Exception(
         "[Exception: MySQL Deadlock] Too many people accessing the server at the same time. Try again in few minutes"
     );
 }

My question: is there a chance this approach will insert duplicates in the database? if so, how can I force Doctrine to roll back the transactions?


Fabric JS set backgroundImage from fabric object

I want to create an artboard like sketch's artboard in fabric canvas elemet
like this:

let app = new Vue({
  el: '#app',
  computed: {
   canvasSize() {
      let VM = this
      let  el, width, height
      el = VM.$refs.canvasBoxWrap
      width = el.clientWidth
      height  = el.clientHeight
      return  { width, height }
    }
  },
  data: {
    dSize: ''
  },
  mounted() {
    let VM = this

    VM.dSize = VM.canvasSize

    let fabricCanvasInit = () => {
      let canvas = new fabric.Canvas(VM.$refs.facanvas , {
        enableRetinaScaling: true
      })
      canvas.set({
        'enableRetinaScaling': true,
        'backgroundColor': '#dddddd'
      })
      canvas.setWidth( VM.canvasSize.width)
      canvas.setHeight(VM.canvasSize.width / 16 * 9)
      // canvas.set('enableRetinaScaling', true)
      // canvas.set('backgroundColor' , '#dddddd')

      let artBoard = new fabric.Rect({
        stroke: '#000',
        strokeWidth:1,
        fill: 'rgba(255,255,255,1)',
        width: VM.canvasSize.width  - 80,
        height: VM.canvasSize.width  / 16 * 9 - 80
        ,
        shadow : {
          color: 'rgba(0,0,0,0.5)',
          blur: 20,
          offsetX: 0,
          offsetY: 10,
          opacity: 0.6,
          fillShadow: true
        }
      })

      canvas.add(artBoard)
      canvas.artBoard = artBoard
      canvas.artBoard.center()
      canvas.artBoard.set({
        'selectable' : false
      })
      canvas.renderAll()
      console.log( canvas );
    }

    fabricCanvasInit()
  }
})

but in this demo, the "artboard" was created by a fabric rect object.
 When I change other object , like 'sendToBack()', I will reset the "artboard" object sendToBack()
I want add the rect with shadow like fabricCanvas.setBackgroundImage(...)
how to do that?

jsfiddle.net demo


Event listener not working - proper placement or syntax?

In a Flash object I have an item (called widgit1) that I'm trying to attach an event listener to. I just want Flash to execute a JavaScript alert though no matter where I place it on the time line, regardless of which layer and regardless of what syntax I've found none of the many MANY combinations I have tried have worked.

Here is the ActionScript I have...

widgit1.addEventListener(MouseEvent.mouseOver,ohhai);

function ohhai() {getURL("javascript:alert('oh hai!')");}


How to do right relationships between objects Django

I have two models: Category and Item. Item can have 2 or more categories so I need to have a relationship on categories(maybe one-to-many) from the item I create. But, I also need to fetch that items related to a category(or categories), maybe like this:
http://example.com/api/items?category_id=5

Can anyone advice how can I achieve that? Thanks.


Why doesn't getActivity() on a listfragment work when ran from a dialogfragment

My ListFragment is in a viewpager and the actionbar has a button that opens a dialogfragment. Then I'm trying to call a function with non-static methods to update my simple adapter from that dialogfragment like this:

MyDialogFragment.java

public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.dialogtitle);
    builder.setSingleChoiceItems(R.array.items, indx, new DialogInterface.OnClickListener() {

MyListFragment updateItems = new MyListFragment();

               public void onClick(DialogInterface dialog, int id) {
                   updateItems.updater();
                   dialog.dismiss();
                   ...
}
}

MyListFragment.java

public void updater(){
      ArrayList<Map<String, String>> list = buildData();

String[] from = { "name", "address", "postalcode", "item", "item2", "item3" };
int[] to = { R.id.title, R.id.address, R.id.postalcode, R.id.item1, R.id.imageView1, R.id.item3 };

ListAdapter adapter = new SimpleAdapter(getActivity(), list,
    R.layout.rowlayout, from, to);
setListAdapter(adapter);
}

ListAdapter adapter = new SimpleAdapter(getActivity(), list, R.layout.rowlayout, from, to) line gives me null pointer exception.

Fragment should be attached since I tried the lifecycle of that fragment by adding System.out.println("onAttach") (or onResume and etc.) to every step to make sure that the status of the fragment isn't changed when the dialog box is opened.

I also added a button to that listfragment to do "updater();" and it works as supposed to.

Any good ideas why this doesn't work when run from a different fragment?

Thank you for your help!

EDIT

Managed to get rid of the null pointer exception by adding
    Context context; to the start of the ListFragment and context = getActivity(); to the onCreate method and using that context instead of getActivity on the updater function. I added a couple of System.out.printlns to that function which are printed out just fine, but the listview itself still isn't updated. Can't understand why because the fragment as I know seems to be active (or attached) and the function works fine when ran from the fragment itself.


AngularJS - 2 selects for a range of years. Options in second one have to be greater or equal than first one selected

I have 2 selects where I need to choose a range of years. The year of the second select has to be greater or equal than the first one. So if I select a year in the first select, the second select should change and show just the years greater or equal than the year selected in the first select.

This is what I have right now:

<div ng-app="">
    <div ng-controller="appCtrl">
        <select  id="id_year_1">
            <option ng-repeat="year in years1 | filter:dateRangeFilter1" value="{{year}}">{{year}}</option>
        </select>
        <select  id="id_year_2">
            <option ng-repeat="year in years2 | filter:dateRangeFilter2" value="{{year}}">{{year}}</option>
        </select>
    </div>
</div>

angular.module('app', ['ngResource'])

function appCtrl($scope) {
    var years = [2010, 2011, 2012];
    $scope.years1 = years;
    $scope.years2 = years;
    $scope.year1 = years[0];
    $scope.year2 = years[years.length - 1];

    $scope.$watch('years1', function(value, oldValue) {
        $scope.dateRangeFilter2 = function (value) {
            return value >= $scope.year2;
        };
    });
    $scope.$watch('years2', function(value, oldValue) {
        $scope.dateRangeFilter1 = function (value) {
            return value <= $scope.year1;
        };
    });
}

I have it also in this fiddle: http://jsfiddle.net/d3sb4hky/

Thanks.


Filter using HBase REST API

Does anyone know anything about the HBase REST API? Im currently writing a program which inserts and reads from HBase using curl commands. When trying to read I use the curl get command, e.g.

curl -X GET 'http://server:9090/test/Row-1/Action:ActionType/' -h 'Accept:application/json'

This returns the column Action:ActionType from Row-1. If I want to do the equivalent of a WHERE clause using the GET command I am stuck however. Im not sure its even possible? If I want to find all records where Action:ActionType =1 for example.
Help is appreciated!


How can prevent show a view in custom cursor adapter without re query

I Use custom cusrsor adapter for ListView.

I want known how can prevent show a view (row) without using changeCursor, swapCursor or requery.(only local)

For example: if(mylist.contains(position)) skip row;

Please help me, Thanks so much


Adding bibliography to appendices in latex

I am writing my thesis and i am using the chapterbib option, while it makes beautiful bibliographies for my chapters, i can't get it to do the same thing for my appendices

premable:

\documentclass[pdftex, 11pt, onecolumn, openany]{report}

  \usepackage{amsmath}

\usepackage[pdftex]{graphicx}

\usepackage{appendix}

\usepackage[sectionbib]{chapterbib}

\usepackage{chapterbib}

\begin{document}

...

\include{background}

\include{ATRPcomp}

\include{CCTcomp}
\appendix

\include{AppCCT}

\end{document}

in each of my chapter sections and appendix I have:

\chapter{Compartmentalization in Catalytic Chain Transfer}

...

\bibliography{references}

Does the chapterbib work also for appendices or is there another option that will help it?

Thank you!!!!!!


ExtJs: Search / Filter within a ComboBox

I've the following problem / question in ExtJs 2.3:

I'd like to do a search within a combobox.
I'll give you an example:

Ext.comboData.names = [['Peter', 'Paul', 'Amanda']];

var store = new Ext.data.SimpleStore({
     fields: ['name'],
     data: Ext.comboData.names
});

var combo = new Ext.form.ComboBox({
     name: '...',
     id: '...',
     store: store,
     displayField: 'name',
     typeAhead: true,
     mode: 'local',
     forceSelection: false,
     triggerAction: 'all',
     emptyText: '-',
     selectOnFocus: true,
     applyTo: '...',
     hiddenName: '...',
     valueField: 'name'
     enableKeyEvents: true,
     lastQuery: '',
     listeners: {
         'keyup': function() {
               this.store.filter('name', this.getRawValue(), true, false);
         }
     }
});

When I would type in an 'a', there only should be 'Paul' and 'Amanda' in the "dropdown". So in other words I'm looking for a solution to filter the data not only by the entries' first letter, but maybe by using something like a regular expression (?) (like in SQL ... LIKE '%a%')...I also would need type of "onKeyDown"-event for my comboBox in order to filter the results on every single letter I add.
How can I do that? Any ideas?

Tanks a lot in advance :)

Schildi

PS: Unfortunately I have to use my current version of ExtJs (2.3), so if there's a solution for my problem just in later versions, I would have to look for an other way...


Email sending control

I would like to implement email sending with my own mail server.

Is there any java script control/library that available that has similar functionality to gmail sending popup.

It shoudl be pretty somple including multiple recipients, subject, body text and send button.

Of course i can implement all this functionality by myself but maybe someone out there already did something similar.


How do I center text in the Tkinter Text widget?

I am learning python and I'm completing mini projects. I've made an 8-ball program and it is almost done. One thing that is annoying me is that the text output to the user is not centred.

How do I do this? I've tried the following but still no luck.

T1.tag_configure("center", justify='center')
T1.tag_add("center", 1.0, "end")

My code is here. Thanks for your help!


Remove all HTML with Jsoup but keep the lines

I have a String which contains some of the content of an e-mail, I want to remove all the HTML coding from this String.

This is my code at the moment:

public static String html2text(String html) {

   Document document = Jsoup.parse(html);
   document = new Cleaner(Whitelist.basic()).clean(document);
   document.outputSettings().escapeMode(EscapeMode.xhtml);
   document.outputSettings().charset("UTF-8");
   html = document.body().html();

   html = html.replaceAll("<br />", "");

   splittedStr = html.split("Geachte heer/mevrouw,");

   html = splittedStr[1];

   html = "Geachte heer/mevrouw,"+html;

   return html;
}

This method removes all HTML, keeps lines and most of the layout. But it will also return some &amp; and nbsp; tags, which aren't completely removed. See the output below, as you can see there are still some tags and even parts of it in the String. How do I get rid of these?

  Loonheffingen       &amp;n= bsp; Naam
 nr         in administratie         &amp;nbs= p;           meldingen
  nummer

 1          &amp;n= bsp;            = ;     0            &amp;= nbsp;           &amp;nbs= p;           1
           123456789L01

Edit:

<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">De afgekeurde meldingen zijn opgenomen in de bijlage: Afgekeurde meldingen.</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Wilt u zo spoedig mogelijk zorgdragen dat deze</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">meldingen gecorrigeerd worden aangeleverd?</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">mer</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Volg &nbsp; &nbsp; Aantal verwerkt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Aantal afgekeurde</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">&nbsp;Loonheffingen &nbsp; &nbsp; &nbsp; &nbsp; Naam</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">nr &nbsp; &nbsp; &nbsp; &nbsp; in administratie &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; meldingen</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">&nbsp;nummer</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

This is a part of the HTML I am trying to parse. I want to remove all the HTML, but keep the layout of the original e-mail.

Any help is appreciated,

Thanks!

Solved

        Document xmlDoc = Jsoup.parse(file, "", Parser.xmlParser());
        Elements spans= xmlDoc.select("span");

        for (Element link : spans) {
            String html = textPlus(link);
            System.out.println(html);
        }

 public static String textPlus(Element elem) {
    List<TextNode> textNodes = elem.textNodes();
    if (textNodes.isEmpty()) {
        return "";
    }

    StringBuilder result = new StringBuilder();
    // start at the first text node
    Node currentNode = textNodes.get(0);
    while (currentNode != null) {
        // append deep text of all subsequent nodes
        if (currentNode instanceof TextNode) {
            TextNode currentText = (TextNode) currentNode;
            result.append(currentText.text());
        } else if (currentNode instanceof Element) {
            Element currentElement = (Element) currentNode;
            result.append(currentElement.text());
        }
        currentNode = currentNode.nextSibling();
    }
    return result.toString();
}

Code was provided as an answer on this question.


OOP C# - Design pattern for MMO mechanics simulator

I've been working on a simulator for FFXIV;

I keep getting really close to finishing, then I get walled into an object access issue that doesn't let me access the stats of the main player. My project can be found at: https://github.com/eein/chocobro

There's plenty of things i can optimize, I know. :P

Basically i'm kind of brute-force winging it to have objects gain access to the objects they need, but i'm looking for the right way to do things.

I'm going to start rewriting it so don't clutch too hard to the example code but its there to see the issue i'm having. :(

Ideally in the next attempt, this is what i'd like to do:
Start with a player class that contains all of the informatin about the player object (in the future, i'd like to create multiples for full group simulation).

Something like:

int main(){
Player p = new Player();

public void setJob()
{
  if (job == "bard"){ Player p = new Bard(); }
  if (job == "warrior"){ Player p = new Warrior(); }
}

public class Player
{
    private string name {get;set;}
    private string job {get;set;}
    private string STR;
    private string DEX;
    private string VIT;
    //etc..

    public virtual void rotation()
    {
    }
}

//I want to make the program a bit modular for jobs (roles/classes)
//So..

public class Bard : Player
{
    public override void rotation()
    {
        heavyshot.execute();
        //etc.
    }

    Ability heavyshot = new Heavyshot();

    public class Heavyshot : Ability
    {
        public Heavyshot()
        {
            name = "Heavy Shot";
            potency = 150;
            dotPotency = 0;
            recastTime = 2.5;
            TPcost = 60;
            animationDelay = 0.8;
            abilityType = "Weaponskill";
            castTime = 0.0;
            duration = 0.0;
        }

        public override void impact()
        {
            //add heavier shot buff activation here
            base.impact();
        }
    }
}

public class Ability{
public int cooldown;
public int cost;

public virtual void impact()
{
    public virtual void impact()
    {
      //Deal some damage.
      // !! - the key problem is here, i want to initiate a roll to compare to the players CRIT rating versus the roll to determine the bonus damage. But I can't access the initiated players crit from here. The rating may change depending on abilities used so I can't create a new object. I know i need an object reference but I can't figure it out...
      log(time.ToString("F2") + " - " +  name +
          " Deals " + potency +
          " Potency Damage. Next ability at: " + nextability);
    }
}

I'm probably not being too clear, but basically I want to be able to access the player's crit from ability, and i'm assuming ability can't be set up this way in order for it to work. Does anyone have a good idea what kind of design pattern I should be using so that the virtual functions in ability can access the parent classes players stats?

Ideally, I want the bard class to contain all of the abilities and stat updates pertaining to the bard job, once bard inherits player and the object is changed to reference the Bard object, how do I make it so abilities created by the Ability class dont need an object reference to the parent at the time of creation when accessing that function.

I'm confusing myself, but many thanks to whoever understands my gibberish and can help!


Best structure setup to resize tool using kineticjs

I am making a drawing/designing tool in canvas using kineticjs library.

I can't figure out which is the best way for the objects structure order (groups, shapes, layers).
I need to resize an object with dragging the selection nodes.

Here is what I have tried so far and the problem with it:

I have the rectangle (grey fill, black border) as the object I need to resize and I have the 8 selection nodes (brown rectangles). The problem with this setup is that rectangle needs to be draggable but the selection nodes must be positioned in the same time with the rectangle. So I have put all these in a single layer. The problem is that only layer can be draggable, not groups and shapes, so when I press the selection node to resize, it acts like I am dragging the whole layer.

What do you suggest, what setup should I use?
Thanks!


Sigabrt error xcode, and viewcontrollers

Im not going to post my code because i dont think that its an error with that but im going to ask some question about viewcontrollers because i think my lack of understanding of them is what is causing it.

So i have a multipage registration page in my app, the first page asks for email the second page is name and so on. I get this error when trying to present the same view controller across all the pages.

Attempt to present <Safisa.RegPageViewController: 0x7f9c085e4130>  on
<Safisa.RegPageViewController: 0x7f9c0a23a920> which is already
presenting <UIAlertController: 0x7f9c0842b0b0>
2016-07-06 11:23:14.820 Safisa[6027:265977] *** Terminating app due to
uncaught exception 'NSUnknownKeyException', reason:
'[<Safisa.RegPageViewController 0x7f9c0a278f00>
setValue:forUndefinedKey:]: this class is not key value coding-
compliant for the key passwordRegButton.'

I also get an error that is Thread 1: signal Sigabrt for the pre built class

class AppDelegate: UIResponder, UIApplicationDelegate {

Any tips on how i can fix this guys?


Which association to use in this has_many with three resources in Rails?

I have the following resources:

-> Corporation has_many companies

-> Company belongs_to corporation

-> Company has_many state (so, the same company can be in many states)

-> State has_many companies

My problem here is that a Company have the following attributes: name and description.

There is also a phone number for a company, but that phone number varies depending on the state where the company is located.

Here is how I see it from a table point of view:

States
id
name

Corporation
id
name

Company
id
name

Company_states
id
company_id
state_id
phone_number

How should I set the associations to acomplish this? Thanks.


RealmConfiguration in other class

I am having trouble in opening and writing realm files in my android code.

Below is example code.

public class FirstActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {

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

        RealmConfiguration realmA = new RealmConfiguration.Builder()
                .name("A.realm")
                .schemaVersion(1)
                .build();

        RealmConfiguration realmB = new RealmConfiguration.Builder()
                .name("B.realm")
                .schemaVersion(25)
                .build();

        Realm.init(this);

        Realm realm_A = Realm.getInstance(realmA);
        // Do some jobs with realm_A
    }
}

I make two configuration named realmA and realmB for example instance. But, I want to open them in another activity, named SecondActivity.

I know Realm.getDefaultInstance() but, there is two configuration so, I cannot use Realm.setDefaultInstance()

You can say that declare realmA and realmB in SecondActivity. But, the problem is that I should modify RealmConfiguration every time after modifying schema like updating schemaVersion 1 to 2 etc. And that bother me.. :( (If there are tons of activities, I should modify tons of it..)

Is there any good way to use RealmConfiguration in other class?


java cannot handle a 32 bit number

I am trying to assign 4294967295 to a long. That is (2^32-1)
java(netbeans) gives the following error message
"integer number too large"

in fact I tried to figure out the largest number that an int can handle(did it manually by hand)
and found that it is 2147483647 (of course as obvious it is 2^31-1)

But surprisingly I found out that even the long type cannot handle a number larger than that.
Isn't there any difference between int and long?java doc says long is 64 bit

Am I missing something?


How does a Web browser differentiate between HTML5 and HTML4?


INVALID_USERID error code when trying to retrieve recipient view using REST API

I am trying to retrieve the recipient view for an envelope using the REST API, and I am getting the INVALID_USERID error code in my response.

Request:

POST https://demo.docusign.net/restapi/v2/accounts/<redacted>/envelopes/<redacted>/views/recipient HTTP/1.1
Authorization: bearer <redacted>
Content-Type: application/json
Host: demo.docusign.net
Content-Length: 124
Expect: 100-continue

{"authenticationMethod":"userId","clientUserId":"2","returnUrl":"<redacted>","userId":"1"}

Response:

HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Content-Length: 70
Content-Type: application/json; charset=utf-8
Date: Fri, 11 Apr 2014 13:48:42 GMT
Strict-Transport-Security: max-age=7776000; includeSubDomains

{
  "errorCode": "INVALID_USERID",
  "message": "Invalid UserId."
}

As you can see, I am trying to authenticate the recipient view request using the option to provide the clientUserId and userId (since they are an embedded signer) sent in original POST to create the envelope as opposed to using the email/username method.  The API documentation does not indicate what authenticationMethod value to use to indicate that I am doing this; it only lists that "email" should be used for the email/username method.  Therefore, I'm making my best guess and using "userId" for that value.

I have verified that the clientUserId and userId (recipientId from the envelope request) match what I'm sending in here.

Envelope Request:

POST https://demo.docusign.net/restapi/v2/accounts/<redacted>/envelopes HTTP/1.1
Authorization: bearer <redacted>
Content-Type: multipart/form-data; boundary="AAA"
Host: demo.docusign.net
Content-Length: 309312
Expect: 100-continue
Connection: Keep-Alive

--AAA
Content-Type: application/json; charset=utf-8
Content-Disposition: form-data

{"documents":[{"name":"EOS.pdf","documentId":"1","order":1}],"emailBlurb":null,"emailSubject":"Subject","recipients":{"signers":[{**"clientUserId":"2"**,"email":"asdf@asdf.com",**"recipientId":"1"**,"Name":"John Doe","Tabs":{"signHereTabs":[{"anchorString":"Anchor","anchorIgnoreIfNotPresent":true,"anchorUnits":null,"anchorXOffset":-10,"anchorYOffset":-15}]}}]},"status":"sent"}
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename=EOS.pdf; documentid=1

<snip>

--AAA--

Is there anything I need to do to the request to get it to submit correctly?


Script to remove letters

I need an Excel VB script to remove all letter a-z A-z and () from cell.

I want to keep all numbers and periods (.).

For example SDF dsfsd dfS SD ( dfd ))) sdf 2.1 mg uf g will become 2.1

This is what I have but it is not working:

Function strClean(strtoclean)
Dim objRegExp, outputStr
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "(([0-9]).)"
outputStr = objRegExp.Replace(strtoclean, "-")
objRegExp.Pattern = "\-+"
outputStr = objRegExp.Replace(outputStr, "-")
strClean = outputStr
End Function


netbeans jar build file not opening

I have build my project using OpenCV. When I run my project through netbeans it runs fine.. but when I create its jar file via Clean and Build it doesn't open.
it displays a message in output screen when it is build that is..

 To run this application from the command line without Ant, try:
 java -jar "C:\Users\Rafi Abro\Documents\NetBeansProjects\WebCam\dist\WebCam.jar"

I also tried to open my project through this command..

 java -jar WebCam.jar

but it displayed error below:

 Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java2410 in
 java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at javaanpr.Main.main(Main.java:154)

please can anyone help me through out this problem..

Thanks


Expression blend photoshop effects

I'm new to using blend, I've discovered when I import my photoshop file blend takes my effects away. Can anyone tell me why blend doesn't recognize my effects?


createsample.exe crashes every time

Hi I am trying to create samples using opencv_createsamples.exe but it crashes every time. I've checked different builds, opencv2 and opencv3. I don't know how to overcome this. My command looks like this

opencv_createsamples.exe -img C:/Users/dpach/Pictures/Interfejsy/img/1.jpg -maxxangle 15 -maxyangle 15 -maxzangle 1 -w 80 -h 40 -vec test.vec -bgtresh 0 -bgcolor 0 -show

The windows to show samples is opening but after that I receive info that program is not responding. Any ideas ?

// EDIT
I've tried to start it from a pseudo unix bash and I receive then Segmentation fault

// EDIT2
It crush after that Create training samples from single image applying distortions...


javascript recursive function - not understanding what is going on

I was reading javascript documentation on 'functions' and came across this code that I am not following how it's working step by step, specifically the inner recursive function.

function factorial(n){
  if ((n == 0) || (n == 1))
    return 1;
  else
    return (n * factorial(n - 1));
}

var a, b, c, d, e;
a = factorial(1); // a gets the value 1
b = factorial(2); // b gets the value 2
c = factorial(3); // c gets the value 6
d = factorial(4); // d gets the value 24
e = factorial(5); // e gets the value 120

I am not following the logic beyond the first if statement. Could someone spell it out. I have already ran the code and works just as specified.


Textarea maxlength and SQL Server nvarchar does not match with breakline

I set attribute maxlength of textarea as 10 and I set nvarchar(10) for a column in a table. I am using SQL Server 2014.

The problem is when I type enter, textarea will count length as 1 but SQL Server count it as 2.

When I type enter 10 times and then I save the textarea value in database, it throws error "truncated".

What should I do in this situation? How can I set maxlength of textarea and set length of nvarchar in database?

Should I modify string in server before saving to database?


Indicating a matrix element of an image by a color

I am trying to attach a color code to a specific element of a matrix. But unable to do so. Specifying the color should surface in the new image.

I=imread('1.tif')
J=rgb2gray(I)
M=imresize(J,[156 156])
H=imread(M,M(120,134),'red')

Kindly help. Thanks in advance.


android - java - WeakReferences with an ArrayList?

I know that with a WeakReference, if I make a WeakReference to something that unless there's a direct reference to it that it will be Garbage Collected with the next GC cycle. My question becomes, what if I make an ArrayList of WeakReferences?

For example:

ArrayList<WeakReference<String>> exArrayList;
exArrayList = new ArrayList<WeakReference<String>>();
exArrayList.add(new WeakReference<String>("Hello"));

I can now access the data with exArrayList.get(0).get().

My question becomes: This is WeakReference data, will the data located at exArrayList.get(0) be GC'd with the next GC cycle? (even IF I don't make another direct reference to it) or will this particular reference stick around until the arraylist is emptied? (eg: exArrayList.clear();).

If this is a duplicate I haven't found it with my keywords in google.


Creating a recursive BuildUpAll method in a base class not filling out all the dependency properties

I am using Unity for my dependency injection and have a rather large class structure with each level inheriting from a base class.  For various reasons I am using the dependency properties feature of Unity and am trying to create a single method that will go down through the structure and build up all the objects without me having to manually manage that code anymore.  My base class looks like this so far

public class Base
{
    [Dependency]
    public IEventAggregator EventAggregator { get; set; }

    [Dependency]
    public ILoggerFacade LoggerFacade { get; set; }

    public void BuildUpDependencies(IUnityContainer container)
    {
        var currentType = this.GetType();

        container.BuildUp(this);

        PropertyInfo[] properties = currentType.GetProperties();

        foreach (var propertyInfo in properties)
        {
            var propertyType = propertyInfo.PropertyType;

            // if property type is part go one level further down unless it has an attribute of GetValidationMessagesIgnore
            if (TypeContainsBaseType(propertyType, typeof(Base)))
            {
                ((Base)propertyInfo.GetValue(this)).BuildUpDependencies(container);
            }
        }
    }
}

This works great for building up the 2 dependencies that are inherited by all the classes, this does not build up any dependencies that are not in the base class though.  i.e.

public class InterestingClass : Base
{
    [Dependency]
    public IRegionManager RegionManager { get; set; }
}

in this case the InterestingClass would have the 2 base dependencies built up, but the RegionManager would remain null.

I believe it is because in the BuildUpDependencies method the 'this' that is being passed is of type Base and not of type InterestingClass but I am not sure how to ensure the derived class type is passed to the BuildUp method.  Is there an easier way to do this?  How can I pass the correct type to BuildUp to get it to BuildUp all the correct dependencies?


Rewrite Rule - Remove numbers after forward slash

I have a bunch of 404 links, close to 500 resulting from a link looking like:

http://www.domain.com/component/k2/item/192-file-sharing-options-to-consider.html

The link needs to be shown as follows, except the ID 192 and portion after is an ALIAS for a blog item.

http://www.domain.com/component/k2/item/file-sharing-options-to-consider.html

We essentially need to remove the '192-' from the link, and have this happen to all blog links (the number can be anything from 1, 2, or 3 digits)

I've tried something of this sorts

    RewriteCond /component/k2/item/
    RewriteRule ^([0-9]+)$ /component/k2/item/$1

I know this may not be proper, but I am slowly trying to learn how this all works.

Also /component/k2/item/ can be found as /blog/item/ in some links

Updated for htaccess:

    ##
    # @version $Id: htaccess.txt 21064 2011-04-03 22:12:19Z dextercowley $
    # @package Joomla
    # @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
    # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
    # Joomla! is Free Software
    ##

    #####################################################
    #  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
    #
    # The line just below this section: 'Options +FollowSymLinks' may cause problems
    # with some server configurations.  It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url's.  If they work,
    # it has been set by your server administrator and you do not need it set here.
    #
    #####################################################

    ##  Can be commented out if causes errors, see notes above.
    Options +FollowSymLinks

    #
    #  mod_rewrite in use

    RewriteEngine On

    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    ## Deny access to extension xml files (uncomment out to activate)
    #<Files ~ "\.xml$">
    #Order allow,deny
    #Deny from all
    #Satisfy all
    #</Files>
    ## End of deny access to extension xml files
    # Block out any script trying to set a mosConfig value through the URL
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    # Block out any script trying to base64_encode data within the URL
    RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Return 403 Forbidden header and show the content of the root homepage
    RewriteRule .* index.php [F]
    #
    ########## End - Rewrite rules to block out some common exploits

    ########## Begin - Custom redirects
    #
    # If you need to redirect some pages, or set a canonical non-www to
    # www redirect (or vice versa), place that code here. Ensure those
    # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
    #
    #K2 to new blog plugin redirect

    #Strips blog ID- from URL and rewrites to blog/item
    RewriteRule ^(component/k2/item)/[0-9]+-(.+)$ /$1/$2 [L,NC]
    Redirect /component/k2/item/ http://www.managemyitinc.com/blog/item/

    redirect 301  /blog/entry/ http://www.managemyitinc.com/blog/item/
    redirect 301  /blog/categories/listings/ http://www.managemyitinc.com       /blog/categories/categories/listings/

    #Non www to www
    RewriteCond %{HTTP_HOST} ^managemyitinc.com$
    RewriteRule (.*) http://www.managemyitinc.com/$1 [R=301,L]

    ########## End - Custom redirects

    #  Uncomment following line if your webserver's URL
    #  is not directly related to physical file paths.
    #  Update Your Joomla! Directory (just / for root)

    # RewriteBase /

    ########## Begin - Joomla! core SEF Section
    #
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    #
    # If the requested path and file is not /index.php and the request
    # has not already been internally rewritten to the index.php script
    RewriteCond %{REQUEST_URI} !^/index\.php
    # and the request is for root, or for an extensionless URL, or the
    # requested URL ends with one of the listed extensions
    RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw))$ [NC]
    # and the requested path and file doesn't directly match a physical file
    RewriteCond %{REQUEST_FILENAME} !-f
    # and the requested path and file doesn't directly match a physical folder
    RewriteCond %{REQUEST_FILENAME} !-d
    # internally rewrite the request to the index.php script
    RewriteRule .* index.php [L]
    #
    ########## End - Joomla! core SEF Section


How do you add GPUImage to an iOS project?

I am trying to make a camera/photo app that will add a filter on an image. I have heard of Brad Larson's GPUImage and so I downloaded it and tried to manipulate it to be more familiar with the code.

Now, I made a new project in Xcode and added it on my frameworks, but i don't have any idea how to use it on a new project.

How can I properly use GPUImage in my new project?


Calculating Timespan using asp.net

Possible Duplicate:

  How do I calculate relative time?

I would like to use asp.net c# to calculate the timespan for when a file was uploaded. Example, if i uploaded a file two weeks ago my text will say 'uploaded 2 weeks ago' or if i have upload a file 4 month's ago my text will say 'uploaded 4 months ago'

Can anyone please give me some tips on how i can go about this.

Thanks


MSSQL subquery result to show and calculate

I need show a subquery result and use this same result to calculate other value, is possible set this value in a variable in MS SQL 2008 or something like this?
exemple:

SELECT
    @test = (SELECT COUNT(*) FROM [tableTest] WHERE [tableTest].[columnA] = [tableA].[columnA]) as 'Counter'
    , (@test * 50) as 'Calc'
    , [tableA].[columnA]
FROM tableA


intel xdk browsertab - fails

Our main project relies heavily on popups. Now it must come into an "app-wrapper" for android and ios. Besides the popups it runs well on mobile devices.
The popups must open inside the app and not in main browser. They must also open separately from 'opener' - opener must persist until the popup is closed.

I am using intel XDK. Inappbrowser is installed as normal plugin, browsertabs is installed as third-party plugin from npm repository.

Solutions that work partially are:

iframe - displays content, does not help to manage popups and is not recognized by humans as something "different" from the main app.

inappbrowser delivers best results, but pop-ups are opened in same "window", which is not intended (they should open in something tab-like).

both methods work:

cordova.InAppBrowser.open('https://www.google.com', '_blank');

and

window.open('https://www.google.com', '_blank')

The inappbrowser has an extension: browsertab. This would (probably) solve all our issues, however, I cannot get it to work properly.

cordova.plugins.inappbrowsertab.openUrl('https://www.google.com');

does not give any results. The browsertabs is in the plugins folder of the project.

If this info is not enough - tell me what I else is needed. I hope there is a solution.


JTextArea.append() taking a few seconds

I know this is a dumb question, but I'm not sure what I can do.
My program is to simply send a message through some servers. My program also has a "console", which is just a JTextArea, to let the user know what's going on. For some weird reason, calling the append() method takes a few seconds. In fact, it doesn't actually append until the message has been sent through the servers. That's where I'm lost. At the same time I append, I also use System.out.println() to log, and the log is printed instantly in the console, whereas appending the JTextArea does not. The only reason I came up with was that maybe the gui thread is different than an action thread. I send this message at a click of a JButton:

submit.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
                console.append("Sending POST to GCM\n");
                System.out.println((String) textField.getSelectedItem());

                String apiKey = "...";
                Content content;

                try {
                    content = createContent("test");
                    POST2GCM.post(apiKey, content);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        });

As you see, I append, then log. My log shows up instantly, but the append() doesn't show up until the POST2GCM.post(apiKey, content) method has ran.

Can someone explain why this is, and if there is any workaround?


Is there a word or term that encompasses all of "Language", "Library", "Framework", "Platform" etc.?

I'm trying to find a succinct word that describes all of these things used in software development (mostly for a resume but also for categorical purposes of a bunch of textbooks/resources I'm trying to organize). Pretty much just a word for something that is used as a part of your code/software. Could optionally also include development "tools" like IDEs, compilers, build automation, debuggers, etc.

So it would be used to describe any of these: JavaScript (language), jQuery (library), Express.js (framework), Node.js (platform)

"Technologies" is sometimes used but I don't think it's a good choice. What else could you call them? Modules? Artifacts? Resources?


Preload next and previous pages and fade in on cursor keys

I am seeing many websites implementing seamless browsing between pages and I am wanting to implement this on a number of my sites. I am using WordPress, but that doesn't really affect this as such. I've never gone down the route of using Javascript to load new pages so this is new terratory for me. However I believe HTML5 does have page preloading capabilities.

I am looking for the first page to fade in from a blank screen and preload the previous and next pages. The next or previous page will fade (or slide) in seamlessly having previously been preloaded when the visitor...

Clicks on the prev or next links

Presses the left or right arrow keys

if on a tablet, mobile or other touch device swipe left or right

The address bar should also show the next/previous page's url once loaded and browser history updated.

The best implementation of this that I have seen is The Next Web- http://thenextweb.com/

On their announcement page they talked about this feature...

Thanks to the brilliance of HTML5, readers can now browse the website
  with fewer refreshes and near instant switching between articles. Try
  it out, click the next button on this article or use…

I don't want to reinvent the wheel. Is there a jQuery plugin or an easy way for me to achieve the above?

Thanks.


I have this code written under a command button, the sheet is protected. The command button acts as a reset button and deletes data from many cells and changes font property. Here is the code:
The ranges that I am changing using this button are already added to exception

Range("C10:c18") = ""
Range("C20:c24") = ""
Range("c5:c6") = "_"
Range("c11:c12") = "Optional"
With Range("c11:c12")
    With .Font
         .Italic = True        '"Line 1"
         .ColorIndex = 48      '"Line 2"
    End With
End With

It throws the VBA Error: Unable to to set the italic property of the font class for line 1 and

Application defined or object defined error for line 2


Is there anyway to link to your homepage without the index (somesite.com vs somesite.com/index)?

I uploaded a site, and I'm trying to get the links to redirect to somesite.com instead of somesite.com/index. I've tried putting blank spaces, but it seems to stay on the current page. Is there anyway to accomplish this without putting the full URL?


Python - where to initialize a player inventory?

I'm having a bit of a problem in python. It's not with the syntax or anything like that but, I am making a text rpg. I have a save/load feature within the game using pickle. It works just fine. But the problem is when I load the game, the inventory variable is set back to what I defined it as in the init of the main class. its like this:

            class Main():
                def __init__(self):
                    self.inventory = []

and the load command is in the main class as well. But for some reason when I load the variables with pickle, it resets the inventory to whatever it is set as in the main class. How can I stop this?


ViewController with several behaviour models

Assume I have two viewcontrollers. On the first viewcontroller I need to select one of N options and depending on this option second viewcontroller has a different behaviour. In practice I can call same methods, but with different implementations, but I don't want to pass argument (enum) describing the current mode of viewcontroller in every method or making a switch everytime. What is the most relevant design solution for this case?


2d heat equation : TDMA solver

I am trying to solve a 2d transient heat equation using the 2d TDMA solver. However, i found difficulties in defining the field of temperature and implementing the solver.
I used the following code (LBL function: line by line method) but it didn't work.

Thank you in advance for your help.

void LBL (int n, int m, int n1, int m1,int m2,
          double dt, double dx, double dy,
          vector <double> &x, vector<double> &y,
          vector< vector<double> > &aw,
          vector< vector<double> > &b,
          vector< vector<double> > &ap,
          vector< vector<double> > &ae,
          vector< vector<double> > &an,
          vector< vector<double> > &as,
          vector< vector<double> > &ap0,
          vector< vector<double> > &P,
          vector< vector<double> > &Q,
          vector< vector<double> > &Td,
          vector< vector<double> > &d,
          vector< vector<double> > &T0)
{
  double ERROR;
  double t=0;
  double r[n][m];

  for(int j=0; j<m; j++)
  {
    for(int i=0;i<n;i++)
    {
      d[i][j] =Tin;
      r[i][j]=Tin;
      T0[i][j]=Tin;
    }
  }

  int s=0;
  mi =100000;
  while (t<tm)
  {
    cout << " \n t=" << t<<endl;
    /****************calculation of dij****************/
    bi(t,n,m,dx,dy,dt,ap0,T0,b);
    do
    {
      for (int j=0; j<m; j++)
      {
        for (int i=0; i<n; i++)
        {
          d[i][j] = an[i][j] * r[i][j+1] + as[i][j] * r[i][j-1] + b[i][j];
        }
      }

      MAXI=  fabs(d[0][0]-r[0][0])/d[0][0];
      for ( int j =0; j < m; j++)
      {
        for(int i= 0; i<n; i++)
        {
          ERROR=fabs(d[i][j]-r[i][j])/d[i][j];
          if (MAXI < ERROR)     MAXI =ERROR;

        }
      }
      cout << " \n MAXI=" << MAXI<<endl;
      for ( int j =0; j < m; j++)
      {
        for(int i= 0; i<n; i++)
        {
          r[i][j]=d[i][j];
        }
      }

      s++;
    } while (MAXI>eps && s<mi );

    /***********calculation tdma******************/
    for (int j=0; j<m; j++)
    {
      P[0][j]=ae[0][j]/ap[0][j];
    }
    for (int j=0; j<m; j++)
    {
      Q[0][j]=d[0][j]/ap[0][j];
    }

    for (int j=0; j<m; j++)
    {
      for(int i=1; i<n; i++)
      {
        P[i][j]=an[i][j]/(ap[i][j]- (aw[i][j]*P[i-1][j]));
        Q[i][j]= (d[i][j] + (aw[i][j]*Q[i-1][j]) ) / (ap[i][j]-(aw[i][j]*P[i-1][j]));
      }
    }

    for(int j =0; j<m; j++)
    {
      Td[n-1][j]=Q[n-1][j];
    }

    for(int j =0;j<m;j++)
    {
      for (int i=n-2; i>=0; i--)
      {
        Td[i][j]=P[i][j]*Td[i+1][j] + Q[i][j];
      }
    }

    for (int j=0; j<m; j++)
    {
      for (int i =0; i<n; i++)
      {
        T0[i][j] =Td[i][j];
      }
    }

    t+=dt;
  }
}


Center unknown (responsive) number of images that are floated

I am creating a list of employees, with their photos in a grid format (5 wide). As the number of employees fluctuates I need to be able to center floated elements that don't fill a whole row, without using a containing div for each row. I really feel like it's unlikely I'm the first to want to do this and is struggling, but every solution I've found is to create a container, or some suggest the inline-block solution, however these images need to be flush, and as they are % width on some browsers some space can be visible between them, even with the margin-right: -4px solution; this is why I am depending on floats. Thanks!

What I have

http://pasteboard.co/1u9iCIRy.jpg

What I want

http://pasteboard.co/1u9lKgCh.jpg


Checking that user input is an int (python)

Have been stuck on this for about an hour.  Currently trying to teach myself Programming using Python.  I am using a textbook for the programming stuff which walks me through pseudocode and then I attempt to convert this into python to learn the syntax.  While to program runs and adds as it is supposed to, it will not print what I want it to if the user enters anything but an integer.

Pseudocode I am looking at:

1  Declare Count As Integer
2  Declare Sum As Integer
3  Declare Number As Float
4  Set Sum = 0
5  For (Count = 1; Count <=10; Count++)
6    Write “Enter an integer: “
7    Input Number
8    If Number != Int(Number) Then
9      Write “Your entry is not an integer.”
10      Write “The summation has ended.”
11      Exit For
12    Else
13 Set Sum = Sum + Number
14    End If
15  End For
16  Write “The sum of your numbers is: “ + Sum

This is the code i have written to this point:

sum = 0
for count in range(0, 10):
    number = int(input("Write an integer: "))
    if number != int(number):
        print ("Your entry is not an integer.")
        print ("The summation has ended.")
        break
    else:
        sum = sum + number
    continue
print("The sum of your numbers is: " + str(sum))


How do I render a Dundas bar chart from most to least?

How does one order the bar chart series to render from most to least? Ordering the data before binding does not seem to help.

My code:

chart.Series.Add("port");
chart.Series["port"].Type = SeriesChartType.Bar;
chart.Series["port"]["PointWidth"] = "0.6";
chart.Series["port"]["BarLabelStyle"] = "Center";
chart.Series["port"].ShowLabelAsValue = true;
chart.Series["port"].Points.DataBind(myData, "Key", "Value", "Label=Value{p2}");
chart.Series["port"].BorderStyle = ChartDashStyle.Solid;
chart.Series["port"].BorderColor = Color.White;
chart.Series["port"].BorderWidth = 1;
chart.Series["port"].ShowLabelAsValue = true;
chart.Series["port"].Font = myfont;

chart.ChartAreas.Add("Default");
chart.ChartAreas["Default"].BackColor = Color.Transparent;
foreach (var axis in chart.ChartAreas["Default"].Axes)
{
    axis.LabelStyle.Font = myfont;
    axis.MajorGrid.Enabled = false;
}
chart.ChartAreas["Default"].AxisX.Interval = 1;
chart.ChartAreas["Default"].AxisY.LabelStyle.Format = "p0";


android sqlite foreign key update fails

I wonder if someone has stumbled upon strange behavior of sqlite foreign keys.

My problems occurs when I update a key variant (parcours_id) that points to another tables primary key parcours (eid) and is declared a foreign key.

The involved tables are:

CREATE TABLE parcours(
    eid character varying(36) PRIMARY KEY,
    name character varying(50),
    comment text,
    location_id character varying(36),
    owner_id character varying(36),
    change_id integer NOT NULL,
    change_flag smallint NOT NULL DEFAULT 1,
    CONSTRAINT fk_location_id FOREIGN KEY (location_id)
      REFERENCES location (eid)
      ON UPDATE CASCADE
      ON DELETE RESTRICT
)

CREATE TABLE variant (
    eid character varying(36) PRIMARY KEY,
    parcours_id character varying(36) NOT NULL,
    name character varying(50),
    comment text,
    created TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
    active smallint NOT NULL DEFAULT 1,
    selected smallint NOT NULL DEFAULT 0,
    tgt_count integer NOT NULL,
    owner_id  character varying(36)
      DEFAULT '687baa6e-556f-43f2-897a-f1dfb371541a',
    change_id integer NOT NULL,
    change_flag smallint NOT NULL DEFAULT 1,
    CONSTRAINT fk_parcours_id FOREIGN KEY (parcours_id)
    REFERENCES parcours (eid)
      ON UPDATE CASCADE
      ON DELETE RESTRICT
)

The foreign key relationship from of variant( parcours_id ) to parcours( eid ) works perfectly on insert but fails on update with

android.database.sqlite.SQLiteException: foreign key mismatch: , while compiling: UPDATE variant SET parcours_id=?,name=?,comment=?,created=?,active=?,selected=?,tgt_count=?,owner_id=?,change_id=?,change_flag=? WHERE eid=?

Now this problem is slightly philosophical because at this point I do not need to update the key variant (parcours_id) because it has not changed. I decided to implement the update funtion only once allways updating all fields except for the primary key. Generally I do not expect the problematic value to ever change so I could just leave it out  of the update.

It looks to me like my implemention is ok, because if I disable foreign keys on the database without changing anything else it works, the foreign key is updated correctly and the integrity of the database is intact after the update.

To me this proves that the problem is not caused by my implementation but seems to be a general misunderstanding of how sqlite handles foreigng key updates.

Any suggestions ?

EDIT:
After removing the key variant( parcours_id) from the update I still get an SQLITE exception:

android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed

The SQL Statement is:

UPDATE variant SET name=?,comment=?,created=?,active=?,selected=?,tgt_count=?,owner_id=?,change_id=?,change_flag=? WHERE eid=?


Users cannot update/install my app from Google Play(error -505)!

I uploaded an update to Google Play and it seems many people cannot update or reinstall. When they try to update, they get error something with number 4, if they try to clean install it, they get error -505. I just tried it on emulator and it worked fine, what the heck? Many people report an error. What is wrong?


How to integrate Mustache template engine into Phalcon PHP application?

How to integrate Mustache template engine into Phalcon PHP 3 application to use it instead of built-in volt?


TTURLNavigation: Is it efficient?

So I'm having a hard time wrapping my head around TTURLNavigation from the three20 framework.

Are the views being pushed onto a stack? I don't understand how one could just jump around an application without pushing and poping. I feel like if i just keep jumping to urls I am constantly pushing views onto my stack.

How exactly does TTURLNavigation accomplish this.


My mail server using IRedMail (postfix, dovecot, etc.) is only sending and receiving local emails?

I recently set up a mail server using IRedMail on a home server running Debian 8, using OpenLDAP, nginx in the installer. We got everything set up and configured to where we can access our mail server with roundcube (which I can access through mail.sterango.com) and Thunderbird and login to accounts just fine. We can send emails to and from accounts that are on the domain (seb@sterango.com can send and receive from postmaster@smail.sterango.com), but I am not able to send or recieve email with either of these accounts from outside sources such as my gmail account.
Here is my main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/iRedMail.crt
smtpd_tls_key_file = /etc/ssl/private/iRedMail.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.sterango.com
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
myorigin = mail.sterango.com
mydestination =
relayhost =
mynetworks = 127.0.0.1
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
transport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf, proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf
inet_protocols = ipv4
virtual_alias_domains =
mydomain = mail.sterango.com
allow_percent_hack = no
swap_bangpath = no
mynetworks_style = host
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_tls_protocols = !SSLv2 !SSLv3
smtp_tls_protocols = !SSLv2 !SSLv3
lmtp_tls_protocols = !SSLv2 !SSLv3
smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3
smtp_tls_mandatory_protocols = !SSLv2 !SSLv3
lmtp_tls_mandatory_protocols = !SSLv2 !SSLv3
smtpd_tls_mandatory_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA
smtpd_tls_dh1024_param_file = /etc/ssl/dhparams.pem
smtp_tls_security_level = may
smtp_tls_CAfile = $smtpd_tls_CAfile
smtp_tls_loglevel = 0
smtp_tls_note_starttls_offer = yes
smtpd_sender_restrictions = reject_unknown_sender_domain, reject_non_fqdn_sender, reject_unlisted_sender, permit_mynetworks, reject_sender_login_mismatch, permit_sasl_authenticated
delay_warning_time = 0h
maximal_queue_lifetime = 4h
bounce_queue_lifetime = 4h
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions
smtp_data_init_timeout = 240s
smtp_data_xfer_timeout = 600s
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_helo_access pcre:/etc/postfix/helo_access.pcre
queue_run_delay = 300s
minimal_backoff_time = 300s
maximal_backoff_time = 4000s
enable_original_recipient = no
disable_vrfy_command = yes
home_mailbox = Maildir/
allow_min_user = no
message_size_limit = 15728640
virtual_minimum_uid = 2000
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/catchall_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
recipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
relay_domains = $mydestination, proxy:mysql:/etc/postfix/mysql/relay_domains.cf
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_auth_only = yes
smtpd_recipient_restrictions = reject_unknown_recipient_domain, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_tls_security_level = may
smtpd_tls_loglevel = 0
smtpd_tls_CAfile = /etc/ssl/certs/iRedMail.crt
tls_random_source = dev:/dev/urandom
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/dovecot-auth
content_filter = smtp-amavis:[127.0.0.1]:10024
smtp-amavis_destination_recipient_limit = 1
default_transport = smtp

Also here are my DNS records: http://i.imgur.com/gR2LAIZ.png
Should the A one point to a local IP like that?
I will also gladly post any logs or files. Thanks!


GridView: getCheckedItemPositions() return no values or wrong values

I implemented a gallery with a Grid View that includes check boxes but i have problems with getCheckedItemPositions() method.

(1) If i launch the Activity with GridView, select some items and ask which items have been selected, the method getCheckedItemPositions() doesn't return any value.

(2) If i launch another Activity, i return to Activity with the GridView and ask what items have been selected, the method getCheckedItemPositions() returns wrong values .

I think first of all that the implementation of getView() is wrong, for (1) probably the GridView doesn't know which items are selected. I have no ideas for the (2) instead.

Here the code:

GalleryFragment getCheckedItemOnGridView():

private void getCheckedItemOnGridView() {
    if(D) Log.d(TAG, "getCheckedItemOnGridView(): called");
    SparseBooleanArray checkedItemPositions = mGalleryGridView.getCheckedItemPositions();
    for (int i=0 ; i<checkedItemPositions.size() ; i++) {
        if(D) Log.d(TAG, "checkedItemPositions : " + checkedItemPositions.valueAt(i) + " index " + checkedItemPositions.keyAt(i));
    }
}

Adapter extends BaseAdapter getView():

private SparseBooleanArray checked;

public View getView(final int position, View convertView, ViewGroup parent) {
        if(D) Log.d(TAG, "Called: getView");
    ViewHolder holder;

    if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.listitem_gallery, null);

        holder = new ViewHolder();
        holder.thumbnailView = (ImageView) convertView.findViewById(R.id.imageview_thumbnail);
        holder.checkBoxView = (CheckBox) convertView.findViewById(R.id.checkbox);

        holder.checkBoxView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (((CheckBox) view).isChecked()) {
                    checked.put((Integer) view.getTag(), true);

                } else {
                    checked.put((Integer) view.getTag(), false);
                }
            }
        });

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

    BitmapFileImageLoader bitmapLoader = new BitmapFileImageLoader();
    bitmapLoader.loadBitmap(getItem(position), holder.thumbnailView);

    holder.checkBoxView.setTag(position);
    holder.checkBoxView.setChecked(checked.get(position));

    return convertView;
}


Metal shading (like silver) on iphone opengl?

Does anyone know a tutorial hat explains how to shade an object to look like
silver metal? (on iphone)?
Maybe starting with a spere like in this:
http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-part-5-living.html

Or can this not be accomplished without the new shaders in 2.0?

Thanks
Sebastian


Should I use thread local storage for variables that only exist in a {class,method}?

I am implementing a relatively simple thread pool with Python's Queue.Queue class.  I have one producer class that contains the Queue instance along with some convenience methods, along with a consumer class that subclasses threading.Thread.  I instantiate that object for every thread I want in my pool ("worker threads," I think they're called) based on an integer.

Each worker thread takes flag, data off the queue, processes it using its own database connection, and places the GUID of the row onto a list so that the producer class knows when a job is done.

While I'm aware that other modules implement the functionality I'm coding, the reason I'm coding this is to gain a better understanding of how Python threading works.  This brings me to my question.

If I store anything in a function's namespace or in the class's __dict__ object, will it be thread safe?

class Consumer(threading.Thread):
    def __init__(self, producer, db_filename):
        self.producer = producer
        self.conn = sqlite3.connect(db_filename)  # Is this var thread safe?
    def run(self):
        flag, data = self.producer.queue.get()

        while flag != 'stop':
            # Do stuff with data; Is `data` thread safe?

I am thinking that both would be thread safe, here's my rationale:

Each time a class is instantiated, a new __dict__ gets created.  Under the scenario I outline above, I don't think any other object would have a reference to this object.  (Now, perhaps the situation might get more complicated if I used join() functionality, but I'm not...)

Each time a function gets called, it creates its own name space which exists for the lifetime of the function.  I'm not making any of my variables global, so I don't understand how any other object would have a reference to a function variable.

This post addresses my question somewhat, but is still a little abstract for me.

Thanks in advance for clearing this up for me.


remove session in javascript and jquery

we all know that we can set and get session using javascript like below:

session.setItem("name", "value");

session.getItem("name");

I need to know how to destroy particular and all session variable in javascript.

I used google but I'm unable to get exactly what I need. Please help me to find the solution. jQuery answers are also welcome (without plugin)

Thank you in advance


Ignore all .axd file from MVC routing

In my application, Both mvc and web form is present.

But when I open any .aspx page then in Application_Error error is thrown.

The controller for path '/WebResource.axd' was not found or does not implement IController.

The controller for path '/ScriptResource.axd' was not found or does
  not implement IController.

I tried all these method, but none of them is working.

Added at top in RegisterRoutes method.

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
 routes.IgnoreRoute("{*allaspx}", new { allaspx = @".*\.aspx(/.*)?" });

Create a FileTypeConstraint class to check file ext.

.

public class FileTypeConstraint : IRouteConstraint
    {
        private readonly string[] MatchingFileTypes;

        public FileTypeConstraint(string matchingFileType)
        {
            MatchingFileTypes = new[] { matchingFileType };
        }

        public FileTypeConstraint(string[] matchingFileTypes)
        {
            MatchingFileTypes = matchingFileTypes;
        }

        public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
        {
            if (values["url"] != null)
            {
                string path = values["url"].ToString();
                return MatchingFileTypes.Any(x => path.ToLower().EndsWith(x, StringComparison.CurrentCultureIgnoreCase));
            }
            else
            {
                return false;
            }
        }

And added this line at top and bottom both

 routes.MapRoute(
     "Defaultaxd",
      "{*url}",
       new { controller = "Home", action = "Index", id = UrlParameter.Optional },
        new { myCustomConstraint = new FileTypeConstraint(new[] { "axd" }) }
          );

Tried all these links.

HttpHandlers with ASP.NET MVC

ASP.NET MVC routing issue?

Using URL Routing for Web Forms and StopRoutingHandler for Favicon


Jquery - settimeout

I have a jquery function that i need to delay 1 second.
I've searched here, and I need to use the settimeout function which I have no idea how to put in the jquery.

Here's my code:

<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery('.animacao').addClass("hidden").viewportChecker({
        classToAdd: 'visible animated fadeInDown', // Class to add to the elements when they are visible
        offset: 100
       });
});
</script>

Can someone help me, please?


How to set the size of a QCheckBox's indicator?

This code:

QCheckBox* selection = new QCheckBox(backgroundEditor);
selection->setGeometry(
            0               ,   //Left
            0               ,   //Top
            buttonHeight    ,   //Width
            buttonHeight        //Height
            );
selection->setStyleSheet(QString(
                      "background-color: white;"
                      "           color: black;"
                      "QCheckBox::indicator "
                      "{"
                      "     width: %1px;"
                      "    height: %1px;"
                      "}"
                      ).arg(buttonHeight));

produces:

The white area has the correct geometry, but I want the indicator box (and thus the click-target) to fill it.  How do I do that?

A bit of experimenting shows that the color specification wipes out the size.  Removing it makes the size correct, but of course the colors are wrong.  How can I have both?