Daily Archives

Articles indexed Sunday November 3 2013

Page 4/16 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Ho can I tell when the background is touched on a UICollectionView?

    - by Mason Cloud
    I've tried subclassing UICollectionView and overriding touchesBegan:withEvent: and hitTest:WithEvent:, and both of those methods trigger when I touch a cell. However, if I touch the space between the cells, nothing happens at all. Here's what I've created: @interface WSImageGalleryCollectionView : UICollectionView @end ..and.. @implementation WSImageGalleryCollectionView - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Touches began"); [super touchesBegan:touches withEvent:event]; } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { NSLog(@"Hit test reached"); return [super hitTest:point withEvent:event]; } @end

    Read the article

  • Slow query. Wrong database structure?

    - by Tin
    I have a database with table that contains tasks. Tasks have a lifecycle. The status of the task's lifecycle can change. These state transitions are stored in a separate table tasktransitions. Now I wrote a query to find all open/reopened tasks and recently changed tasks but I already see with a rather small number of tasks (<1000) that execution time has becoming very long (0.5s). Tasks +-------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------+------+-----+---------+----------------+ | taskid | int(11) | NO | PRI | NULL | auto_increment | | description | text | NO | | NULL | | +-------------+---------+------+-----+---------+----------------+ Tasktransitions +------------------+-----------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+-----------+------+-----+-------------------+----------------+ | tasktransitionid | int(11) | NO | PRI | NULL | auto_increment | | taskid | int(11) | NO | MUL | NULL | | | status | int(11) | NO | MUL | NULL | | | description | text | NO | | NULL | | | userid | int(11) | NO | | NULL | | | transitiondate | timestamp | NO | | CURRENT_TIMESTAMP | | +------------------+-----------+------+-----+-------------------+----------------+ Query SELECT tasks.taskid,tasks.description,tasklaststatus.status FROM tasks LEFT OUTER JOIN ( SELECT tasktransitions.taskid,tasktransitions.transitiondate,tasktransitions.status FROM tasktransitions INNER JOIN ( SELECT taskid,MAX(transitiondate) AS lasttransitiondate FROM tasktransitions GROUP BY taskid ) AS tasklasttransition ON tasklasttransition.lasttransitiondate=tasktransitions.transitiondate AND tasklasttransition.taskid=tasktransitions.taskid ) AS tasklaststatus ON tasklaststatus.taskid=tasks.taskid WHERE tasklaststatus.status IS NULL OR tasklaststatus.status=0 or tasklaststatus.transitiondate>'2013-09-01'; I'm wondering if the database structure is best choice performance wise. Could adding indexes help? I already tried to add some but I don't see great improvements. +-----------------+------------+----------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +-----------------+------------+----------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | tasktransitions | 0 | PRIMARY | 1 | tasktransitionid | A | 896 | NULL | NULL | | BTREE | | | | tasktransitions | 1 | taskid_date_ix | 1 | taskid | A | 896 | NULL | NULL | | BTREE | | | | tasktransitions | 1 | taskid_date_ix | 2 | transitiondate | A | 896 | NULL | NULL | | BTREE | | | | tasktransitions | 1 | status_ix | 1 | status | A | 3 | NULL | NULL | | BTREE | | | +-----------------+------------+----------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ Any other suggestions?

    Read the article

  • Another Nim's Game Variant

    - by Terry Smith
    Given N binary sequence Example : given one sequence 101001 means player 0 can only choose a position with 0 element and cut the sequence from that position {1,101,1010} player 1 can only choose a position with 1 element ans cut the sequence from that position {null,10,101000} now player 0 and player 1 take turn cutting the sequence, on each turn they can cut any one non-null sequence, if a player k can't make a move because there's no more k element on any sequence, he lose. Assume both player play optimally, who will win ? I tried to solve this problem with grundy but i'm unable to reduce the sequence to a grundy number because it both player don't have the same option to move. Can anyone give me a hint to solve this problem ?

    Read the article

  • Does Github.com have to create a merge commit when you merge from a fork ?

    - by Nishant
    I cloned the master and started doing he my work . Due to permissions I push the branch to my fork . I then sent a pull request to my master and someone with permission does the merge . I notice that Github.com creates a merge commit snapshot which to me looks like just a diff of the entire changes which is actually not necessary but helpful in the sense I can just look at merge commit to see the entire diff . I can see the same sha has as my own branch - hence it looks like the merge is an extra commit which probably aint nexeccary since its a fast forward ? master - a myfork(computer) - a->b->c myfork(github) - a->b->c Pull request myfork - master (which it says I can automatically merge) shows the entire diff and then when I merge it , it shows up as master - a->b->c-d . The d is a merge commit which I think it not really required because it is a fast forward ? Can someone explain why does this happen ? I think this is the same scenario if I rebase master if master had gone ahead , but that has not happened . Master is still at when I merge .

    Read the article

  • is there a faster version of fminbnd in matlab?

    - by kloop
    I am now using fminbnd in Matlab, and I find it relatively slow (I am using it inside a nested loop). The function itself, its interface and the values it returns are great, but when looking into the .m file I see it is not optimized. As a matter of fact, I was hoping for something like that to be written as a mex. Anyone knows of an alternative to fminbnd which works much faster and does not have much overhead?

    Read the article

  • WPF Empty Row in ItemsControl Binding with ObservableCollection

    - by YoMo
    I have ItemsControl Binding with ObservableCollection, every think is oky excipt when ObservableCollection was empty the ItemsControl showing one empty row !! <ItemsControl Visibility="Visible" ItemsSource="{Binding ocItemsinInvoice,Mode=TwoWay}" x:Name="test" Margin="10,-32,0,207" Width="412" HorizontalAlignment="Left"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="1" VerticalAlignment="Top" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Button x:Name="btnOpenInvoice" Style="{StaticResource OpenInvoicesButton}" FontSize="12" Width="300" Height="60" Foreground="#ff252526"> <StackPanel Orientation="Vertical"> <TextBlock Text="{Binding Item.ItemName}" HorizontalAlignment="Center" VerticalAlignment="Center" /> </StackPanel> </Button> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> How can I remove it?

    Read the article

  • URLEncode Error

    - by user2949519
    I have an Android app. Basically what it does is that user can search a car reference no. in EditText for example:- 270/30 and retrieve all the details of the particular car with the same column value in the database. I'm encoding this editext value in Android using URLEncoder and decoding it back in php webservice code. But the decoded value im getting is 027/13 ....instead of 270/30. To make it clear more im here by pasting my java Encoding part EditText SearchField=(EditText)findViewById(R.id.editText1); String SearchValue= SearchField.getText().toString(); Now the encoding code in Asynctask is data +="&" + URLEncoder.encode("data", "UTF-8") + "="+SearchValue; Now the PHP part where i decoded this code $data = urldecode($_POST['data']); Please help me how to encode/decode this given format ... Thanks in Advance

    Read the article

  • IOS 7 Table cell not show

    - by user2855572
    I am getting very strange problem in my app. I am creating table view cell dynamically.My problem is that textlable is not showing. Code was working on ios 5 and ios 6 but not working on ios 7 it is giving problem.Anybody help me NSString *Str=[NSString stringWithFormat:@"%@",[dateCalcuArray objectAtIndex:indexPath.row]]; Str=[Str stringByReplacingOccurrencesOfString:@"(" withString:@""]; Str=[Str stringByReplacingOccurrencesOfString:@")" withString:@""]; Str=[Str stringByReplacingOccurrencesOfString:@"\"" withString:@""]; ipad_Cell.datelbl.text=Str; ipad_Cell.datelbl.textColor=[UIColor whiteColor];

    Read the article

  • Loading default value in a dropdown and calling onchange event

    - by J. Davidson
    Hi i have following dropdown <div class="fcolumn"> <label class="text" for="o_Id">Months:</label> <select class="textMonths" id="o_Id" name="periodName" > <option value="000">Select Period--</option> </select> </div> In the following jquery, first it loads fnLoadP() in a drop down list. Than as a default I am loading one of the values in drop down which is '10'. It loads too as default value. But it should be executing $("#o_Id").change.. which it doesn't. $(document).ready(function () { var sProfileUserId = null; $("#o_Id").change(function () { //---- }); fnLoadP(); $("select[name='pName']").val('10'); }); }); Basically my goal is. After dropdown values are loaded, to load '10' as default value and call onchange event in the dom. Please let me know how to fix it.

    Read the article

  • 'For' Loop Within a 'For' Loop and Then Another?

    - by BenjaminFranklin
    This has confused me quite a bit, but it's also really interesting! I want to loop through a grid of 9 elements in an array, multiply them all by 1/9. Then, I want to find the sum of those 9 elements and replace each individual element's with the value calculated as the sum. After I've done this, I want to move on to the next nine elements. To clarify, I want all 9 elements to be changed to myVal, in the code below. So far I've got the loop within a loop bit, but I don't know how to then go back and replace each of the values with the sum of all of them combined. Here's my code:- previousx = 0; previousy= 0; for (int x = previousx; x < previousx+4; x++) { for(int y = previousy; y < previousy+4; y++) { y = y*(1/9); yVal += y; } } Any advice would, of course, be greatly appreciated.

    Read the article

  • how to copy an array into somewhere else in the memory by using the pointer

    - by user2758510
    I am completely new in c++ programming. I want to copy the array called distances into where pointer is pointing to and then I want to print out the resul to see if it is worked or not. this is what I have done: int distances[4][6]={{1,0,0,0,1,0},{1,1,0,0,1,1},{1,0,0,0,0,0},{1,1,0,1,0,0}}; int *ptr; ptr = new int[sizeof(distances[0])]; for(int i=0; i<sizeof(distances[0]); i++){ ptr=distances[i]; ptr++; } I do not know how to print out the contents of the pointer to see how it works.

    Read the article

  • Vertically center CSS techniques don't work in Chrome

    - by at.
    I've gone through stackoverflow questions and a whole bunch of articles on vertically centering text like the following: http://blog.themeforest.net/tutorials/vertical-centering-with-css/ None of the techniques seem to work with the latest version of Chrome. Is that just the nature of Chrome? My text just always appears at the top. It seems that whenever I use 50% or 100% as values for CSS's height or top, nothing happens. I just need a single line of text vertically centered. line-height isn't helpful because I want it centered in the middle of the browser window... I don't know how tall the browser window is going to be. UPDATE: The problem is apparently Foundation 4. Once I delete the following everything works as expected: <link href="/assets/foundation_and_overrides.css?body=1" media="screen" rel="stylesheet" /> Any idea on how to make it work with Foundation 4?

    Read the article

  • Add Unique Key For Nullable Columns - SQL Server

    - by Ruby
    I'm using sql server 2008 R2 and would like to apply unique key constraint to nullable columns. This code works good, but if I have multiple columns to add this rule to, it would generate as many 'nullbuster' columns. ALTER TABLE tblBranch ADD nullbuster AS (CASE WHEN column1 IS NULL THEN BranchID ELSE NULL END); CREATE UNIQUE INDEX UK_Column1 ON tblBranch(column1,nullbuster); tblBranch is the table name, nullbuster would be the new column name, BranchId is the Primary key column of the target table, and Column1 is the column name of the target column. Is there any way that I could achieve the goal without generating new columns.

    Read the article

  • stting environment variables in powershell by calling python script that prints $env:myVar=myvalue

    - by leeg
    I have some legacy python scripts that manage my shell environment for all the programs and plugins I am running on Linux (bash) and windows (cmd.exe). I want to port this to powershell. How do I set environment variables in powershell by calling python script that prints $env:myVar=myvalue and causes my environment variable to persist in the powershell. In Bash I can use a bash function to call my python script which prints export var=value to stdout and the function will set the environment variables in my shell. This will also work in windows cmd shell by calling a .bat file. I cannot figure out how to do this in powershell. I think it should be something like this: setvar.ps1: function SETVAR {c:\python26\python.exe varconfig.py } varconfig.py: import sys print >> sys.stdout, '$env:myVar=foo'

    Read the article

  • Updateable Priority Queue

    - by user1427661
    Is there anything built into the C++ Standard Library that allows me to work in a priority queue/heap like data structure (i.e., can always pop the highest value from the list, can define how the highest value is determined for custom classes, etc.) but allows me to update the keys in the heap? I'm dealing with fairly simple data, pairs to be exact, but I need to be able to update the value of a given key within the heap easily for my algorithm to function. WHat is the best way to achieve this in C++?

    Read the article

  • Pygame camera follow in a 2d tile game

    - by Pipyaddict
    import pygame, sys from pygame.locals import * pygame.init() size = width, height = 480,320 screen = pygame.display.set_mode(size) r = 0 bif = pygame.image.load("map5.png") pygame.display.set_caption("Pygame 2D RPG !") x,y=0,0 movex, movey=0,0 character="boy.png" player=pygame.image.load(character).convert_alpha() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type==KEYDOWN: if event.key==K_a: movex=-1 elif event.key==K_d: movex=+1 elif event.key==K_w: movey=-1 elif event.key==K_s: movey=+1 if event.type==KEYUP: if event.key==K_a: movex=0 elif event.key==K_d: movex=0 elif event.key==K_w: movey=0 elif event.key==K_s: movey=0 x+=movex y+=movey screen.fill((r,0,0)) screen.blit(bif,(0,0)) screen.blit(player,(x,y)) pygame.display.flip() Everything works fine except I was wondering how on earth I was going to be able to move the camera where the player goes sorry that I can't show you the map file as you can't add images to it. But Thanks for your time The map is here: https://dl.dropboxusercontent.com/u/110087275/2d%20pygame/map5.png And finally the code is here: https://dl.dropboxusercontent.com/u/110087275/2d%20pygame/2d_pygame.py Thanks again for your time and effort!!!!!

    Read the article

  • Eclipse RCP setting classpath from workspace

    - by English Learner
    I am working one Eclipse RCP project where I have got one situation that I wanted to set classpath at runtime. So initially, I can set the classpath from project\lib\sample.jar file in order to avoid the compilation error. But once the Eclipse RCP application started, and click one update button, a new sample.jar file would be generated at workspace. Now I wanted to update the classpath for newly generated sample.jar from workspace. Which is the best option for setting such a runtime classpath ?

    Read the article

  • Resource id #45 [on hold]

    - by user2916506
    What is this error? I am trying to connect from PHP to Traffic Live mysql and do a POST and at some id's I get this error. With the biggest part of contacts my code works just fine but it keeps getting this trouble maker. What can I do? Here is the trouble making code:if ($sales_datemodified[$h] $traffic_datemodified[$t]) { //if ($traffic_id[$t] != 22033) { $postrequestclient = $clients - post("staff/employee", null, '{"@class": "com.sohnar.trafficlite.transfer.trafficcompany.TrafficEmployeeTO", "id": ' . $traffic_id[$t] . ',"locationId":' . $traffic_locationid[$t] . ', "departmentId": ' . $traffic_departmentid[$t] . ', "ownerCompanyId": ' . $traffic_ownercompanyid[$t] . ',"userId": ' . $traffic_userid[$t] . ',"userName": "' . $traffic_username[$t] . '","employeeDetails": {"id": ' . $traffic_id[$t] . ',"jobTitle": "' . $sales_title[$h] . '","costPerHour": { "amountString": ' . $traffic_amountString[$t] . ', "currencyType": "' . $traffic_currencyType[$t] . '"},"hoursWorkedPerDayMinutes": ' . $traffic_hwpdm[$t] . ', "personalDetails": {"id": ' . $traffic_persdetId[$t] . ', "firstName": "' . $sales_firstname[$h] . '","middleName": "' . $traffic_middleName[$t] . '","lastName": "' . $sales_lastname[$h] . '", "emailAddress": "' . $traffic_username[$t] . '","workPhone": "' . $sales_phone[$h] . '","mobilePhone": "' . $sales_mobilephone[$h] . '" }}}') - setAuth(user, password); $postresponseclient = $postrequestclient - send() - json(); I don't have any errors in my code. That commented "if" is for excluding the trouble making contact on which I get this error. If I uncomment that the program runs fine without any problems. The problem is that this test is made on a small number of contacts and if I add more contacts to the test I get more errors of this kind. this should be a synchronization job so excluding all the "bad" contacts won't work

    Read the article

  • leaflet/JSONobject. Marker onclick show only last record

    - by user2780898
    that my code <div id='map'></div> <div id="info"></div> [...] var markers1 = new L.MarkerClusterGroup( { showCoverageOnHover: true } ); $.ajax({ type: "GET", url: "db.php", success: function (result) { var JSONobject = JSON.parse(result); var jnCount = JSONobject.length; for (var i = 0; i < jnCount; i++) { var marker = new L.Marker(new L.LatLng(JSONobject[i]["lat"],JSONobject[i]["lng"]),{ icon: myIcon1 }); var id = JSONobject[i]["id"]; var list = "<dl>" + "<dt><b>CITTA':</b> " + JSONobject[i]["citta_"] + "</dt>"; marker.on('click', function() { {document.getElementById('info').innerHTML = list;} }); markers1.addLayer(marker); } map.addLayer(markers1); } }); Marker onclick shows only the last record! I think problem is in loop but I don't understand how fix it. Any idea? Thanks Nicola

    Read the article

  • measuring uncertainty in matlabs svmclassify

    - by Mark
    I'm doing contextual object recognition and I need a prior for my observations. e.g. this space was labeled "dog", what's the probability that it was labeled correctly? Do you know if matlabs svmclassify has an argument to return this level of certainty with it's classification? If not, matlabs svm has the following structures in it: SVM = SupportVectors: [11x124 single] Alpha: [11x1 double] Bias: 0.0915 KernelFunction: @linear_kernel KernelFunctionArgs: {} GroupNames: {11x1 cell} SupportVectorIndices: [11x1 double] ScaleData: [1x1 struct] FigureHandles: [] Can you think of any ways to compute a good measure of uncertainty from these? (Which support vector to use?) Papers/articles explaining uncertainty in SVMs welcome. More in depth explanations of matlabs SVM are also welcome. If you can't do it this way, can you think of any other libraries with SVMs that have this measure of uncertainty?

    Read the article

  • ZF: Form array field - how to display values in the view correctly

    - by Wojciech Fracz
    Let's say I have a Zend_Form form that has a few text fields, e.g: $form = new Zend_Form(); $form->addElement('text', 'name', array( 'required' => true, 'isArray' => true, 'filters' => array( /* ... */ ), 'validators' => array( /* ... */ ), )); $form->addElement('text', 'surname', array( 'required' => true, 'isArray' => true, 'filters' => array( /* ... */ ), 'validators' => array( /* ... */ ), )); After rendering it I have following HTML markup (simplified): <div id="people"> <div class="person"> <input type="text" name="name[]" /> <input type="text" name="surname[]" /> </div> </div> Now I want to have the ability to add as many people as I want. I create a "+" button that in Javascript appends next div.person to the container. Before I submit the form, I have for example 5 names and 5 surnames, posted to the server as arrays. Everything is fine unless somebody puts the value in the field that does not validate. Then the whole form validation fails and when I want to display the form again (with errors) I see the PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given Which is more or less described in ticket: http://framework.zend.com/issues/browse/ZF-8112 However, I came up with a not-very-elegant solution. What I wanted to achieve: have all fields and values rendered again in the view have error messages only next to the fields that contained bad values Here is my solution (view script): <div id="people"> <?php $names = $form->name->getValue(); // will have an array here if the form were submitted $surnames= $form->surname->getValue(); // only if the form were submitted we need to validate fields' values // and display errors next to them; otherwise when user enter the page // and render the form for the first time - he would see Required validator // errors $needsValidation = is_array($names) || is_array($surnames); // print empty fields when the form is displayed the first time if(!is_array($names))$names= array(''); if(!is_array($surnames))$surnames= array(''); // display all fields! foreach($names as $index => $name): $surname = $surnames[$index]; // validate value if needed if($needsValidation){ $form->name->isValid($name); $form->surname->isValid($surname); } ?> <div class="person"> <?=$form->name->setValue($name); // display field with error if did not pass the validation ?> <?=$form->surname->setValue($surname);?> </div> <?php endforeach; ?> </div> The code work, but I want to know if there is an appropriate, more comfortable way to do this? I often hit this problem when there is a need for a more dynamic - multivalue forms and have not find better solution for a long time.

    Read the article

  • Maintaining Selected Row of the DataGridView Control after refreshing Data

    - by user575219
    I am trying to Maintain Selected Row of the DataGridView Control after refreshing Data. This is my code public partial class frmPlant : Form { string gSelectedPlant; private void frmPlant_Load(object sender, EventArgs e) { dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = bindingSource1; FillData(); dataGridView1.DataMember = "Table"; } private void FillData() { ds = _DbConnection.returnDataSet(_SQlQueries.SQL_PlantSelect); bindingSource1.DataSource = ds.Tables[0]; } public DataSet returnDataSet(string txtQuery) { conn.Open(); sqlCommand = conn.CreateCommand(); DB = new SQLiteDataAdapter(txtQuery, conn); DS.Reset(); DB.Fill(DS); conn.Close(); return (DS); } private void dataGridView1_Selectionchanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { gSelectedPlant = dataGridView1.SelectedRows[0].Cells["PlantId"].Value.ToString(); } } private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { int selectedIndex; if (!string.IsNullOrEmpty(gSelectedPlant) && e.ListChangedType == ListChangedType.Reset) { if (ds.Tables.Count > 0) { selectedIndex = bindingSource1.Find("PlantId", gSelectedPlant); if (selectedIndex <= 0) selectedIndex = 0; dataGridView1.Rows[selectedIndex].Selected = true; } else { gSelectedPlant = string.Empty; } } } } It is still not able to maintain the rowindex of the selected row. It scrolls to row1. Here's the blog I used http://www.makhaly.net/Blog/9 Suppose, I select a row on Form1(where all this code is) and go on the next form, which shows me detailed info abt the particular Plant . If I come back to this first form again,by pressing the back button, the row is reset to 1. gSelectedPlant takes a value 1 and selectedindex = 0. This makes sense but I am not yet able to figure out how to maintain the value of gSelectedPlant. Yes it takes a null intitally but on databindingcomplete it becomes 1.

    Read the article

  • Java client listening to WebSphere MQ Server?

    - by user595234
    I need to write a Java client listening to WebSphere MQ Server. Message is put into a queue in the server. I developed this code, but am not sure it is correct or not. If correct, then how can I test it? This is a standalone Java project, no application server support. Which jars I should put into classpath? I have the MQ settings, where I should put into my codes? Standard JMS can skip these settings? confusing .... import javax.jms.Destination; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueReceiver; import javax.jms.QueueSession; import javax.jms.Session; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; public class Main { Context jndiContext = null; QueueConnectionFactory queueConnectionFactory = null; QueueConnection queueConnection = null; QueueSession queueSession = null; Queue controlQueue = null; QueueReceiver queueReceiver = null; private String queueSubject = ""; private void start() { try { queueConnection.start(); queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = queueSession.createQueue(queueSubject); MessageConsumer consumer = queueSession.createConsumer(destination); consumer.setMessageListener(new MyListener()); } catch (Exception e) { e.printStackTrace(); } } private void close() { try { queueSession.close(); queueConnection.close(); } catch (Exception e) { e.printStackTrace(); } } private void init() { try { jndiContext = new InitialContext(); queueConnectionFactory = (QueueConnectionFactory) this.jndiLookup("QueueConnectionFactory"); queueConnection = queueConnectionFactory.createQueueConnection(); queueConnection.start(); } catch (Exception e) { System.err.println("Could not create JNDI API " + "context: " + e.toString()); System.exit(1); } } private class MyListener implements MessageListener { @Override public void onMessage(Message message) { System.out.println("get message:" + message); } } private Object jndiLookup(String name) throws NamingException { Object obj = null; if (jndiContext == null) { try { jndiContext = new InitialContext(); } catch (NamingException e) { System.err.println("Could not create JNDI API " + "context: " + e.toString()); throw e; } } try { obj = jndiContext.lookup(name); } catch (NamingException e) { System.err.println("JNDI API lookup failed: " + e.toString()); throw e; } return obj; } public Main() { } public static void main(String[] args) { new Main(); } } MQ Queue setting <queue-manager> <name>AAA</name> <port>1423</port> <hostname>ddd</hostname> <clientChannel>EEE.CLIENTS.00</clientChannel> <securityClass>PKIJCExit</securityClass> <transportType>1</transportType> <targetClientMatching>1</targetClientMatching> </queue-manager> <queues> <queue-details id="queue-1"> <name>GGGG.NY.00</name> <transacted>false</transacted> <acknowledgeMode>1</acknowledgeMode> <targetClient>1</targetClient> </queue-details> </queues>

    Read the article

  • Changing path to basedir of mysql

    - by shantanuo
    When-ever I need to start mysql from command line, I need to cd to the base directory and then use mysql command as shown below: # cd /home/ec2-user/percona-5.5.30-tokudb-7.0.1-fedora-x86_64/ # ./bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 mysql> How do I start mysql simply by typing "mysql" at command prompt? I tried to export the path but it did not work. export path=$PATH:/home/ec2-user/percona-5.5.30-tokudb-7.0.1-fedora-x86_64/bin/

    Read the article

  • StrongSwan + xl2tpd client timeout between 2-5 minutes

    - by Howard Guo
    I run CentOS 6.4 on Amazon EC2, using xl2tpd-1.3.1 from EPEL repository together with StrongSwan 5.0.4. I setup a simple IPSec connection: conn l2tp type=transport keyexchange=ikev1 rekey=no authby=psk leftsubnet=0.0.0.0/0 rightsubnet=0.0.0.0/0 compress=yes auto=add And here is xl2tpd.conf: [global] ipsec saref = yes [lns default] ip range = 192.168.0.2-192.168.0.250 local ip = 192.168.0.1 ppp debug = yes pppoptfile = /etc/ppp/options.xl2tpd length bit = yes Here is options.xl2tpd: ms-dns 8.8.4.4 auth lock debug proxyarp There is only one client - Android 4.2 Android connects successfully: Oct 27 19:45:02 ip-172-31-17-30 xl2tpd[2706]: Connection established to x.x.x.x, 59578. Local: 18934, Remote: 29291 (ref=0/0). LNS session is 'default' Oct 27 19:45:02 ip-172-31-17-30 xl2tpd[2706]: Call established with x.x.x.x, Local: 36452, Remote: 29845, Serial: -1369754322 Oct 27 19:45:02 ip-172-31-17-30 pppd[2709]: pppd 2.4.5 started by howard, uid 0 Oct 27 19:45:02 ip-172-31-17-30 pppd[2709]: Using interface ppp0 Oct 27 19:45:02 ip-172-31-17-30 pppd[2709]: Connect: ppp0 <--> /dev/pts/0 Oct 27 19:45:02 ip-172-31-17-30 pppd[2709]: peer from calling number x.x.x.x authorized Oct 27 19:45:02 ip-172-31-17-30 pppd[2709]: Deflate (15) compression enabled Oct 27 19:45:03 ip-172-31-17-30 pppd[2709]: Cannot determine ethernet address for proxy ARP Oct 27 19:45:03 ip-172-31-17-30 pppd[2709]: local IP address 192.168.0.1 Oct 27 19:45:03 ip-172-31-17-30 pppd[2709]: remote IP address 192.168.0.2 Oct 27 19:45:03 ip-172-31-17-30 charon: 06[KNL] 192.168.0.1 appeared on ppp0 Oct 27 19:45:03 ip-172-31-17-30 charon: 06[KNL] 192.168.0.1 disappeared from ppp0 Oct 27 19:45:03 ip-172-31-17-30 charon: 06[KNL] 192.168.0.1 appeared on ppp0 Oct 27 19:45:03 ip-172-31-17-30 charon: 06[KNL] interface ppp0 activated In the meanwhile, Internet works perfectly on the Android client, the VPN connection is stable and fast. However, it always happens that within 2-5 minutes after the connection is established: Oct 27 19:47:07 ip-172-31-17-30 xl2tpd[2706]: Maximum retries exceeded for tunnel 18934. Closing. Oct 27 19:47:07 ip-172-31-17-30 xl2tpd[2706]: Connection 29291 closed to 95.91.227.224, port 59578 (Timeout) Oct 27 19:47:07 ip-172-31-17-30 charon: 06[KNL] interface ppp0 deactivated Oct 27 19:47:07 ip-172-31-17-30 charon: 06[KNL] interface ppp0 deleted Then the VPN connection is broken. So what might have gone wrong? The same L2TP service works flawlessly on iOS 7, MacOS 10.8, and Windows 7, there is no disconnection issue on those OSes. Thank you!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >