{"QuestionId": 18286477, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-08-17T07:51:42.777", "AcceptedAnswerId": null, "Title": "session conflict occurs in codeigniter", "Body": "

all users of my site will access it from behind proxy (using TMG application) so they appear to be have the same IP so when two or more users access my site from the same browser the user's data that is displayed for the user based on his session data sometimes is his actual data and some time is the data of one of the currently logged users and i do not know why this behavior occurs?

\n", "Lable": "No"} {"QuestionId": 18340075, "AnswerCount": 4, "Tags": "", "CreationDate": "2013-08-20T16:15:32.240", "AcceptedAnswerId": null, "Title": "Ruby gives \u201cNo such file or directory - text.txt (Errno::ENOENT)\u201d error", "Body": "

when am trying to run a ruby app ,it gives below error,

\n\n

Could anyone put some light in to it .

\n\n
ruby logger.rb\n/home/swapnasa/Downloads/irclogger-master\nlogger.rb:14:in `read': No such file or directory - ./tmp/logger.pid (Errno::ENOENT)\n        from logger.rb:14:in `<main>'\n
\n\n

Code goes here:

\n\n
#!/usr/bin/env ruby\n\nputs Dir.pwd\n\n$: << File.join(File.dirname(__FILE__), 'lib')\n\nrequire 'irclogger'\nrequire 'irclogger/cinch_plugin'\nrequire 'redis'\n\npidfile = File.join(File.dirname(__FILE__), 'tmp', 'logger.pid')\n\nbegin\n  old_pid = File.read(pidfile).to_i\n  Process.kill 0, old_pid\n\n  raise \"An existing logger process is running with pid #{old_pid}. Refusing to start\"\nrescue Errno::ESRCH\nend\n\nFile.open(pidfile, 'w') do |f|\n  f.write Process.pid\nend\n\nbot = Cinch::Bot.new do\n  configure do |c|\n    c.server   = Config['server']\n    c.channels = Config['channels']\n    c.user     = Config['username']\n    c.nick     = Config['nickname']\n    c.realname = Config['realname']\n\n    # cinch, oh god why?!\n    c.plugins.plugins = [IrcLogger::CinchPlugin]\n  end\nend\n\nIrcLogger::CinchPlugin.redis = Redis.new(url: Config['redis'])\n\nbot.start\n
\n", "Lable": "No"} {"QuestionId": 18344603, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-08-20T20:42:46.903", "AcceptedAnswerId": "18347272", "Title": "creating 2 columns from 1 main column in the same table", "Body": "
SELECT TOP 1000 [Value]                       \nFROM [OnlineQnres].[dbo].[tmp_DataSets]\nWHERE [VariableID] in ('1')\nUNION ALL\nSELECT TOP 1000 [Value]\nFROM [OnlineQnres].[dbo].[tmp_oDataSets]\nWHERE [VariableID] in ('4')\n
\n\n

Providing a more updated Detail

\n\n

Hi All, I have this select query above using UNION ALL. There is a column called Value and VariableID in tmp_datasets table. I need to create 2 separate columns and name them val1 for variableID is 1 and val2 if variableID is 4. If i use UNION ALL it works it creates 2000 records with the first 1000 as val1 records and next 1000 as val2 records but does not separate out into 2 sep columns. How do i separate this value column in 2 separate columns as stated above.

\n\n

I have 2 columns

\n\n
    \n
  • VALUE which has values TEST56,TEST57,230,245
  • \n
  • VARIABLEID = 1 and 4

  • \n
  • TEST56 AND TEST57 comes under variableid == 1

  • \n
  • 230 and 245 comes under variableid == 4
  • \n
\n\n

So based on this above example, I want to create a view where I have 2 columns called val1 if variableid == 1 and val2 if variable id == 4.

\n\n

So it should look something like this

\n\n
    \n
  • val1 = should show test56 and test57
  • \n
  • val2 = should show 230 and 245
  • \n
\n\n

Thanks in advance

\n", "Lable": "No"} {"QuestionId": 18381533, "AnswerCount": 2, "Tags": "", "CreationDate": "2013-08-22T13:14:43.303", "AcceptedAnswerId": "18382743", "Title": "How to insert an image in a HTML page?", "Body": "

Don't hit me too soon!

\n\n

I know how to add an image in a HTML page... But I want to add the actual image file in this HTML page.

\n\n

There it is, I want my html page standalone, without any folder or file with it. I put the css in the <style> balise for example. Now, I would like to do the same with an image.

\n\n

First question: Is it possible?

\n\n

Second question: Is the imported image file could be added more than once in the HTML?

\n\n

I don't know if I am understandable, so, there is an example of what I want:

\n\n
<html>\n    <head>\n        <file byte=\"A02AB46213F541F...ABCD542\" ref=\"my_ref\" />\n    </head>\n    <body>\n        <img src=\"my_ref\" />\n    </body>\n</html>\n
\n", "Lable": "No"} {"QuestionId": 18393571, "AnswerCount": 4, "Tags": "", "CreationDate": "2013-08-23T02:11:40.600", "AcceptedAnswerId": "23273254", "Title": "Deadlock graph showing unknown Index name", "Body": "

I get a deadlock situation in SQL Server 2012.

\n\n

After running SQL Server Profiler, I got a deadlock graph as below:

\n\n

\"Deadlock

\n\n

When moved mouse over the processes(oval), both processes showed identical PrepareStatement queries (I'm using JDBC).

\n\n

The query I'm using is as follow:

\n\n
MERGE INTO MA4TB_MT_LOG_MSG  USING (VALUES (1)) AS S(Num) ON ( MSG_ID = ? )\n            WHEN MATCHED THEN\n                UPDATE SET \n                    DIST_DATE   = ?,\n                    DIST_CODE   = ?\n            WHEN NOT MATCHED THEN\n                INSERT (\n                    MSG_ID, DIST_DATE, DIST_CODE\n                ) VALUES (\n                    ?,?,?\n                );\n
\n\n

The thing that bothers me is the Index name under the Key lock resource box.

\n\n

I don't have an index called '1' under the MA4TB_MT_LOG_MSG table.

\n\n

MSG_ID is the primary key of MA4TB_MT_LOG_MSG and there are no indexes on DIST_DATE, DIST_CODE.

\n\n

Any forms of advice on this deadlock situation would be appreciated.

\n\n

Thanks in advance,

\n", "Lable": "No"} {"QuestionId": 18436675, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-08-26T04:35:46.450", "AcceptedAnswerId": null, "Title": "Searching a custom listview using an ArrayAdapter in Android", "Body": "

I have a custom listview that has two TextViews and one ImageView in it. It uses a custom ArrayAdapter as it's adapter, and I wanted to add a search function to it. I've looked through every single tutorial I could find, with no luck. However with one tutorial I was able to search through a regular listview (not using a custom adapter), however this will not work for me because I need to show both TextViews and the ImageView. I only need to filter one of the TextViews though, so I don't see how much trouble it could be.

\n\n

Anyway, here is the MainActivity:

\n\n
public class ItemId extends Activity {\n\n    // List view\n    private ListView lv;\n\n    // Listview Adapter\n    ArrayAdapter<String> adapter;\n\n    // Search EditText\n    EditText inputSearch;\n\n\n    // ArrayList for Listview\n    ArrayList<HashMap<String, String>> productList;\n\n    @Override\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.testo);\n\n        Context ctx = getApplication();\n        Resources res = ctx.getResources();\n\n        String[] options = res.getStringArray(R.array.item_names);\n\n        lv = (ListView) findViewById(R.id.list_view);\n        inputSearch = (EditText) findViewById(R.id.inputSearch);\n\n        // Adding items to listview\n        adapter = new ArrayAdapter<String>(this, R.layout.list_item_test, R.id.product_name, options);\n        lv.setAdapter(adapter);\n\n        /**\n         * Enabling Search Filter\n         * */\n        inputSearch.addTextChangedListener(new TextWatcher() {\n\n            @Override\n            public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {\n                // When user changed the Text\n                ItemId.this.adapter.getFilter().filter(cs);   \n            }\n\n            @Override\n            public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,\n                    int arg3) {\n                // TODO Auto-generated method stub\n\n            }\n\n            @Override\n            public void afterTextChanged(Editable arg0) {\n                // TODO Auto-generated method stub                          \n            }\n        });\n    }    \n}\n
\n\n

And here is the custom adapter:

\n\n
public class ItemIDAdapter extends ArrayAdapter<String> implements Filterable {\n\n    public LayoutInflater mInflater;\n\n    public String[] mStrings;\n    public String[] mIds;\n    public TypedArray mIcons;   \n    public int mViewResourceId;\n\n    public ItemIDAdapter(Context ctx, int viewResourceId,\n            String[] strings, String[] ids, TypedArray icons) {\n        super(ctx, viewResourceId, strings);\n\n        mInflater = (LayoutInflater)ctx.getSystemService(\n                Context.LAYOUT_INFLATER_SERVICE);\n\n        mStrings = strings;\n        mIds = ids;\n        mIcons = icons;       \n        mViewResourceId = viewResourceId;\n    }\n\n    @Override\n    public int getCount() {\n        return mStrings.length;\n    }\n\n    @Override\n    public String getItem(int position) {\n        return mStrings[position];\n    }\n\n    @Override\n    public long getItemId(int position) {\n        return position;\n    }\n\n\n\n    @Override\n    public View getView(int position, View convertView, ViewGroup parent) {\n        convertView = mInflater.inflate(mViewResourceId, null);\n\n        ImageView iv = (ImageView)convertView.findViewById(R.id.option_icon);\n        iv.setImageDrawable(mIcons.getDrawable(position));\n\n        TextView tv = (TextView)convertView.findViewById(R.id.option_text);\n        tv.setText(mStrings[position]);\n\n        TextView tv1 = (TextView)convertView.findViewById(R.id.itemids);\n        tv1.setText(mIds[position]);\n\n        return convertView;\n    }\n\n\n}\n
\n\n

Hopefully someone can help me, as this has been a very tedious challenge because I'm new to Android development, and I'm out of options. Thanks for your help!

\n", "Lable": "No"} {"QuestionId": 18444233, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-08-26T12:36:07.490", "AcceptedAnswerId": "18444465", "Title": "Is it possible to set the process group of a child process with PCNTL?", "Body": "

The man page for pcntl_waitpid() documents the following option:

\n\n
\n

wait for any child process whose process group ID is equal to the absolute value of pid.

\n
\n\n

I'm interested by this feature (waiting for some child processes, but not all), but can't find any reference to how to set the process group ID of a child process.

\n\n

Is this possible at all with PCNTL?

\n", "Lable": "No"} {"QuestionId": 18479374, "AnswerCount": 3, "Tags": "", "CreationDate": "2013-08-28T04:18:03.373", "AcceptedAnswerId": "18479422", "Title": "creating an array of returned results to display in messagebox", "Body": "

I have this method that returns to the user a messagebox displaying the results. But for multiple results there is message window that appears for each result. How can i create it so that the results are put into an array and then at the end display all the results to the user in one messagebox?

\n\n
 foreach (KeyValuePair<string, int> kvp in Comparer)\n            {\n                if (kvp.Value != 0)\n                {\n                    mismatches++;\n                    string InWhich = kvp.Value > 0 ? firstFile : secondFile;\n                    MessageBox.Show(\"Extra value \\n\"+kvp.Key+\" \\nfound in file \" + InWhich);\n                    if (Math.Abs(kvp.Value) != 1)\n                        MessageBox.Show( Math.Abs(kvp.Value)+ \"times\");\n                }\n            }\n
\n", "Lable": "No"} {"QuestionId": 18525231, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-08-30T04:57:16.857", "AcceptedAnswerId": null, "Title": "didUpdateToLocation alert called only twice", "Body": "

Suppose in the starting the location services are off in the default settings page. I have a button in the app to turn on the location services if first time I click on that it shows the default alert to change the settings to turn on

\n\n
    locationmanager = [[CLLocationManager alloc]init];\n    [locationmanager setDelegate:self];\n    [locationmanager setDesiredAccuracy:kCLLocationAccuracyBest];\n    [locationmanager startUpdatingLocation];\n
\n\n

It is working fine two times. but if it got third time location services are in off condition and click on on button it doesn't show any alert. I am unable to know the CLLocation behavior. May b its not a good question to ask but still I want to clear this concept. if anyone has some idea then please help me out.

\n\n

Thank You.

\n", "Lable": "No"} {"QuestionId": 18568923, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-02T08:42:22.430", "AcceptedAnswerId": null, "Title": "how to search itunes with predefined search criteria (variable)", "Body": "

I was wondering if I have a song name and artist name as a variable in my app, is there a way when I click on a button (obviously have an event listener), I can open itunes with that song in the search bar being searched. I know in the past I've used \nti.open.platform(url) \nto open websites but I'm not sure if there's a way to automatically search this on itunes. All help appreciated

\n", "Lable": "No"} {"QuestionId": 18695696, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-09T09:54:52.003", "AcceptedAnswerId": "18695867", "Title": "Implicit Index for table", "Body": "

I am learning Postgresql and db in general. I have a simple query like this and I want to understand what it does

\n\n
CREATE TABLE adempiere.c_mom(\nc_mom_id NUMERIC(10,0) NOT NULL,\nisactive character(1) DEFAULT 'Y'::bpchar NOT NULL,\nstart_date date NOT NULL,\nstart_time timestamp without time zone NOT NULL,\nend_time timestamp without time zone NOT NULL,\nCONSTRAINT c_mom_pkey PRIMARY KEY (c_mom_id)\n);\n
\n\n

So after I execute this I got

\n\n
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index \"c_mom_pkey\" for table \"c_mom\"\n
\n\n
    \n
  1. Now I know that my PK is c_mom_id, but what is the purpose of creating an implicit index it under name c_mom_key?
  2. \n
  3. What does DEFAULT 'Y'::bpchar, or in general what does :: in psql do?
  4. \n
\n\n

Thank you

\n", "Lable": "No"} {"QuestionId": 18696605, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-09T10:52:55.173", "AcceptedAnswerId": "18696763", "Title": "Views inside rows of TableView in iOS", "Body": "

I am a new to iphone Application Development so maybe this might be an easy question. I have a table View whose contents are decided dynamically depending on some conditions. I have created a few views in the storyboard and are being used in other part of the application. Under one of the condition, I want the contents of the table to be those views (as in one view per row) with some one line text on top of the views and in some cases I want to write just some texts. Since the contents are decided dynamically I also have to set the height of the rows dynamically. Is this kind of UITableViewController possible? How do I execute this task. Thanks

\n", "Lable": "No"} {"QuestionId": 18701954, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-09T15:37:48.747", "AcceptedAnswerId": "18703756", "Title": "Get user email from Facebook SDK android", "Body": "

I am just starting out with the Facebook SDK, I currently have an app that has its own login system, the user enters their email and password and then the app checks a mysql database to find the user. \nIf the user is their it returns the user info and logs them into the app.

\n\n

What I am trying to do is allow the user to just press a Facebook button and have the Facebook SDK return the users email linked to their Facebook account. \nThen I can search my database for that email and log the user in or create an account for them if their is no account with that email.

\n\n

I have everything set up apart from having the Facebook SDK actually return the email for the user. I am not sure where to start with this and could really use some help!

\n", "Lable": "No"} {"QuestionId": 18704380, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-09T18:12:41.067", "AcceptedAnswerId": null, "Title": "How to add jogl panel in java swing", "Body": "

I am trying to write a java swing application that has buttons on one side and an openGL view (jogl)on the other side that displays things depending on what button is pressed. My problem is that when I split the JFrame into 2 sections, the first one takes the buttons fine, but I can't figure out how to add the OpenGL/jogl panel to the other side. I have a class that defines my jogl application, but how am I supposed to add it to a JFrame? I tried extending panel, GLJPanel, Frame (I didn't think that one would work to begin with), but have had no luck adding the jogl class to my frame. Any help or suggestions are appreciated!

\n", "Lable": "No"} {"QuestionId": 18789830, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-13T15:18:47.297", "AcceptedAnswerId": "18790337", "Title": "Setting thresholds values - Java - Static Code analysis - SonarQube Sonar", "Body": "

So we have Checkstyle, PMD, Findbugs as tools which performs static code analysis or work on bytecode to find various issues in code and using them in Jenkins/Hudson (under Post build actions), can turn a build to a unstable, failed, successful build depending upon what threshold values we set there.

\n\n

As SonarQube is the upcoming/future single dash for showing all such analysis in one page for a project/module, I was wondering where in SonarQube settings (I can set such threasholds) to make a build as a failed, unstable, successful i.e. Jenkins will launch the build (ANT/Maven/Gradle etc), calls, sonarRunner (task in Gradle) / sonar-runner (executable in Linux/Unix), then if threasholds are not good, then Jenkins will mark the build as unstable/failed/successful depending upon the set threashold values.

\n\n

Any ideas?

\n", "Lable": "No"} {"QuestionId": 18834779, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-16T18:25:48.897", "AcceptedAnswerId": "18835917", "Title": "how to calculate time complexity of for (int i = n - 1; i != 0; i /= 2) ?", "Body": "

for (int i = n - 1; i != 0; i /= 2) ++k;

\n\n

I am not able to understand how to calculate time complexity for above. I am unable to make out its behavior when n is negative. can anyone please help me to get there. I tried when n is positive.

\n\n
Statement            Code      Time \n1a                  i=n-1       1 \n1b                  i != 0    log2n+1\n1c                  i = i/2   log2n\n2                    ++k      log 2n\nTotal running time       3 log 2n+2\n
\n\n

I got these values when i analyzed the code for n to be positive . but i failed to get when n is negative

\n", "Lable": "No"} {"QuestionId": 18882683, "AnswerCount": 2, "Tags": "", "CreationDate": "2013-09-18T21:30:13.530", "AcceptedAnswerId": null, "Title": "How to mention persistenceUnitName when packagesToScan property", "Body": "

I have two datasources and two entityManagerFactory instance. I was trying to use the new feature of 3.1 (Bootstrapping JPA entityManagerFactory without persistence.xml by using packagesToScan property).

\n\n

In order to use the right entity manager factory instance, i have to distinguish using Persistence unit name and defining the PU name in persistence.xml is stopping the spring package scanning feature.

\n\n

How to give the PU name while using packagesToScan feature?

\n\n

My question is more duplicate of Is there a way to give persistenceUnitName for Spring's LocalContainerEntityManagerFactoryBean without persistence.xml?

\n\n

I couldn't find the answer or comment on the above post. So reposting as new question.

\n", "Lable": "No"} {"QuestionId": 18898131, "AnswerCount": 7, "Tags": "<64-bit>", "CreationDate": "2013-09-19T14:56:56.403", "AcceptedAnswerId": "18934650", "Title": "matplotlib 1.3.0 ImportError: DLL load failed: %1 is not a valid Win32 application", "Body": "

I have 2 pc (laptop and workstation), when I run code for version check I get on laptop:

\n\n
computer\nLAPTOP\nOS props\nWindows-7-6.1.7601-SP1\npython props\n('default', 'May 15 2013 22:44:16')\npython version\n2.7.5\nOS bit and OS type\n('64bit', 'WindowsPE')\ncheck if system is 32bit or 64bit\n('7fffffffffffffff', True)\nnumpy version\n1.7.1\nmatplotlib version\n1.3.0\n
\n\n

and on workstation:

\n\n
computer\nWORKSTATION\nOS props\nWindows-7-6.1.7601-SP1\npython props\n('default', 'May 15 2013 22:44:16')\npython version\n2.7.5\nOS bit and OS type\n('64bit', 'WindowsPE')\ncheck if system is 32bit or 64bit\n('7fffffffffffffff', True)\nnumpy version\n1.7.1\nmatplotlib version\n1.3.0\n
\n\n

the software is mainly the same except some additional packages. But when I try to run the following code on the workstation computer:

\n\n
import numpy as np\nimport matplotlib\n# matplotlib.use('QTAgg')\nfrom matplotlib import pyplot as plt\n
\n\n

I get the following error:

\n\n
Traceback (most recent call last):\n  File \"C:\\Users\\WORKSTATION\\python\\src\\gibljiv_kontakt_E11_vzmet\\preview_and_sort_measurement_data.py\", line 9, in <module>\n    from matplotlib import pyplot as plt\n  File \"C:\\Python27\\lib\\site-packages\\matplotlib\\pyplot.py\", line 98, in <module>\n    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()\n  File \"C:\\Python27\\lib\\site-packages\\matplotlib\\backends\\__init__.py\", line 28, in pylab_setup\n    globals(),locals(),[backend_name],0)\n  File \"C:\\Python27\\lib\\site-packages\\matplotlib\\backends\\backend_tkagg.py\", line 8, in <module>\n    import Tkinter as Tk, FileDialog\n  File \"C:\\Python27\\lib\\lib-tk\\Tkinter.py\", line 38, in <module>\n    import FixTk\n  File \"C:\\Python27\\lib\\lib-tk\\FixTk.py\", line 65, in <module>\n    import _tkinter\nImportError: DLL load failed: %1 is not a valid Win32 application\n
\n\n

I would like to know what is wrong and how can this be repaired? The code works (it does not return any error) if I uncomment the line:

\n\n

matplotlib.use('QTAgg')

\n\n

but as I use this for showing plots no plots are shown. Any suggestions what is wrong and how to fix this. \nI would like to add, that like a month ago before I updated python and python's packages on my workstation computer the matplotlib was working without problems, but now I get this error.

\n", "Lable": "No"} {"QuestionId": 18965798, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-09-23T17:59:05.057", "AcceptedAnswerId": null, "Title": "How to filter listview", "Body": "

I know this is not a new question and there are already lot of similar questions, but my problem is bit different. I am trying to implement search functionality on ListView. i have a listview as following:

\n\n
ListView list;\nList<HashMap<String, String>> myDataCollection;\n
\n\n

I am reading lot of data from XML and creating from it.

\n\n
BinderMyrData bindingData = new BinderMyData(this,  myDataCollection);    \nlist = (ListView) findViewById(R.id.list);\n// Adding items to listview\ninputSearch = (EditText) findViewById(R.id.inputSearch);\nlist.setAdapter(bindingData);\n/*** Enabling Search Filter * */\ninputSearch.addTextChangedListener(new TextWatcher() {\n        @Override\n        public void onTextChanged(CharSequence cs, int arg1, int arg2,\n                    int arg3) {\n                // When user changed the Text\n                    //Some code to be added no clue..\n                }\n\n                @Override\n                public void beforeTextChanged(CharSequence arg0, int arg1,\n                        int arg2, int arg3) {\n                    // TODO Auto-generated method stub\n\n                }\n\n                @Override\n                public void afterTextChanged(Editable arg0) {\n                    // TODO Auto-generated method stub\n                }\n            });\n
\n\n

I know I have to add some code there in onTextChanged. I have no clue what code... Any help is highly appreciated.

\n", "Lable": "No"}