Daily Archives

Articles indexed Wednesday June 26 2013

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

  • does adding static library need xcode project of static library for linking?

    - by mirdad
    I have seen some static library projects in iOS.I see two different types of linking static library. 1)adding .a static library to new xcode project and its header files only. 2)adding .a static library to new xcode project and adding the xcode project through which static library has created. when I remove the the xcode project through which static library has created from the 2nd project, it gives error.I tried first approach for 2nd one.But it is not working. Can you please explain why it is differed? Will it be differed by the xcode versions we use? is The second approach for old xcode versions?

    Read the article

  • Symfony2: update query with query builder

    - by Ichigo Kurosaki
    This is my query $id contains primary key and $status contains new status public function updateStatus($id,$status) { $qb=$this-createQueryBuilder('b') -update() -set('b.status',$status) -where('b.id='.$id); echo $qb; return $qb-getQuery() -getResult(); } Problem I am facing is [Semantical Error] line 0, col 56 near 'Complete WHERE': Error: 'Complete' is not defined.

    Read the article

  • Difference between following arrays?

    - by jayesh jain
    This is ARRAY1 var array_1 = ["51b59c162de88", [ ["parties", 0.0, 0.011] ]] ["51b59c1b4f52f", [ ["star-speak", 0.0, 0.006], ["parties", 0.0, 0.011] ]] This is ARRAY2 var array_2 = [{ key: "51b59c162de88", values: ["parties", 0.0, 0.011]] }, { key: "51b59c162de94", values: [ ["star-speak", 0.0, 0.006], ["parties", 0.0, 0.011] ] }, ]; What is the exact difference between array 1 and array 2. How do I access their data? I am new to json!!!!

    Read the article

  • Caller property of JS for "foo = function()" style of coding

    - by arvind
    I want to use the property of "caller" for a function which is defined here It works fine for this style of function declaration function g() { alert(g.caller.name) // f } function f() { alert(f.caller.name) // undefined g() } f() JSfiddle for this But then my function declaration is something like g = function() { alert(g.caller.name) // expected f, getting undefined } f = function() { alert("calling f") alert(f.caller.name) // undefined g() } f() and I am getting undefined (basically not getting anything) JSfiddle for this Is there any way that I can use the caller property without having to rewrite my code? Also, I hope I have not made any mistakes in usage and function declaration since I am quite new to using JS.

    Read the article

  • loading an image from a package in Java (JFrame)

    - by Shahar Kazaz
    i'm having a problem loading an image from a package i created in the project that was set to contain images, i have to write the whole picture location in the computer instead of just the package that contains it. i've tried several things but nothing seams to work... where is the command i use to load the image : searchBar = ImageIO.read(new File("C:\\Users\\ASUS\\Documents\\NetBeansProjects\\Project\\src\\Images\\search.jpg")); "Images" is a package in my project , this works, but when i try loading the image without the "C:\..." only with the "\Images..." it doesn't , so i have to change it every time i open this project in another computer. hopefully one of u has the answer for me , thanks in advance for any answer :)

    Read the article

  • Parsing XML elements with dynamic namespace prefix in PHP

    - by BugKiller
    I have the following XML ( you can say SOAP request ) : <SOAPENV:Envelope xmlns:SOAPENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:NS="http://xyz.gov/headerschema" > <SOAPENV:Header> <NS:myHeader> <NS:SourceID>223423</NS:SourceID> </NS:myHeader> </SOAPENV:Header> </SOAPENV:Envelope> I use the following code and it works fine : <?php $myRequest ='<SOAPENV:Envelope xmlns:SOAPENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:NS="http://xyz.gov/headerschema" > <SOAPENV:Header> <NS:myHeader> <NS:SourceID>223423</NS:SourceID> </NS:myHeader> </SOAPENV:Header> </SOAPENV:Envelope>'; $xml = simplexml_load_string($myRequest, NULL, NULL, "http://schemas.xmlsoap.org/soap/envelope/"); $namespaces = $xml->getNameSpaces(true); $soapHeader = $xml->children($namespaces['SOAPENV'])->Header; $myHeader = $soapHeader->children($namespaces['NS'])->myHeader; echo (string)$myHeader->SourceID; ?> The Problem I know the prefix ( SOAPENV + NS ) , but the clients could change the prefix to whatever they want, so they may send me xml document that has ( MY-SOAPENV + MY-NS) prefixes. My Question How can I handle this since the namespace prefixes are not static , how can I parse it ? Thanks

    Read the article

  • App is getting run in iOS 5.1.1 but crashed in iOS 6.1.3

    - by Jekil Patel
    I have implemented below code but app has been crashed in iPad with iOS version 6.1.3,while running perfectly in iPad with iOS version 5.1.1. when I am scrolling table view continuously it is crashed in ios version 6.1.3. what could be the issue. The implemented delegate and data source methods for the table view are as given below. #pragma mark - Table view data source -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [UserList count]; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 70; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; //cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell = nil; if (cell == nil) { // cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } UIImageView *imgViweback; imgViweback = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,0,0)]; imgViweback.image = [UIImage imageNamed:@"1scr-Student List Tab BG.png"]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 10, 32, 32)]; UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(12, 5, 50, 50)]; UILabel *lblName = [[UILabel alloc] initWithFrame:CGRectMake(110, 5, 200, 40)]; //cell.backgroundColor = [UIColor clearColor]; //cell.alpha = 0.5f; CountSelected = 0; flagQuizEnabled = NO; if ([[[checkedImages objectAtIndex:indexPath.row] valueForKey:@"checked"] isEqualToString:@"NO"]) { // cell.imageView.image = [UIImage imageNamed:@"Unchecked.png"]; //imageView.image = [UIImage imageNamed:@"Unchecked.png"]; } else { //imageView.image = [UIImage imageNamed:@"Checked.png"]; } NSString *pathTillApp=[[self getImagePath] stringByDeletingLastPathComponent]; NSLog(@"Path Till App %@",pathTillApp); NSString *makePath=[NSString stringWithFormat:@"%@%@",pathTillApp,[[UserList objectAtIndex:indexPath.row ]valueForKey:@"ImagePath"]]; NSLog(@"makepath=%@",makePath); imageView1.image = [UIImage imageWithContentsOfFile:makePath]; [cell.contentView insertSubview:imgViweback atIndex:0]; [cell.contentView insertSubview:imageView atIndex:0]; [cell.contentView insertSubview:imageView1 atIndex:2]; lblName.text =[NSString stringWithFormat:@"%@ %@",[[UserList objectAtIndex:indexPath.row] valueForKey:@"FirstName"],[[UserList objectAtIndex:indexPath.row] valueForKey:@"LastName"]]; lblName.backgroundColor = [UIColor clearColor]; lblName.font = [UIFont boldSystemFontOfSize:22.0f]; //lblName.font = [UIFont fontWithName:@"HelveticaNeue Heavy" size:22.0f]; lblName.font = [UIFont fontWithName:@"Chalkboard SE" size:22.0f]; [cell.contentView insertSubview:lblName atIndex:3]; [imgViweback release]; [imageView release]; [imageView1 release]; [lblName release]; imgViweback = nil; imageView = nil; imageView1 = nil; lblName = nil; //cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; return cell; } #pragma mark - Table view delegate -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Values : %@", Val); }

    Read the article

  • Xcode automatically converts the object to NSArray

    - by Farrukh Javeid
    I have been working on an app and during the development, I am facing a very strange problem. I have a NSMutableArray tempSortedArray, which is full of objects of Store types. All the objects are valid as I can see them in my GUI, the problem arises when I iterate through the array, at index 90, which can be generally anyone, the XCode converts the Store object to NSMutableArray object. Any idea, why this is happening. This is the code to check out what I am doing: NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"cashBack" ascending:NO]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor]; NSArray *sortedArray = [storesArray sortedArrayUsingDescriptors:sortDescriptors]; for (int i = 0; i < [tempSortedArray count]; i++) { Store *currentStore = [tempSortedArray objectAtIndex:i]; NSLog(@"store class: %@", [currentStore.class description]); if (currentStore.cashBackTypeString != (id)[NSNull null]) { //do whatever is required to do here }

    Read the article

  • Unable to run MR on cluster

    - by RAVITEJA SATYAVADA
    I have an Map reduce program that is running successfully in standalone(Ecllipse) mode but while trying to run the same MR by exporting the jar in cluster. It is showing null pointer exception like this, 13/06/26 05:46:22 ERROR mypackage.HHDriver: Error while configuring run method. java.lang.NullPointerException I double checked the run method parameters those are not null and it is running in standalone mode as well..

    Read the article

  • Procesing 16bit sample audio

    - by user2431088
    Right now i have an audio file (2 Channels, 44.1kHz Sample Rate, 16bit Sample size, WAV) I would like to pass it into this method but i am not sure of any way to convert the WAV file to a byte array. /// <summary> /// Process 16 bit sample /// </summary> /// <param name="wave"></param> public void Process(ref byte[] wave) { _waveLeft = new double[wave.Length / 4]; _waveRight = new double[wave.Length / 4]; if (_isTest == false) { // Split out channels from sample int h = 0; for (int i = 0; i < wave.Length; i += 4) { _waveLeft[h] = (double)BitConverter.ToInt16(wave, i); _waveRight[h] = (double)BitConverter.ToInt16(wave, i + 2); h++; } } else { // Generate artificial sample for testing _signalGenerator = new SignalGenerator(); _signalGenerator.SetWaveform("Sine"); _signalGenerator.SetSamplingRate(44100); _signalGenerator.SetSamples(16384); _signalGenerator.SetFrequency(5000); _signalGenerator.SetAmplitude(32768); _waveLeft = _signalGenerator.GenerateSignal(); _waveRight = _signalGenerator.GenerateSignal(); } // Generate frequency domain data in decibels _fftLeft = FourierTransform.FFTDb(ref _waveLeft); _fftRight = FourierTransform.FFTDb(ref _waveRight); }

    Read the article

  • bulls and cows game -- programming algorithm(python)

    - by IcyFlame
    This is a simulation of the game Cows and Bulls with three digit numbers I am trying to get the number of cows and bulls between two numbers. One of which is generated by the computer and the other is guessed by the user. I have parsed the two numbers I have so that now I have two lists with three elements each and each element is one of the digits in the number. So: 237 will give the list [2,3,7]. And I make sure that the relative indices are maintained.the general pattern is:(hundreds, tens, units). And these two lists are stored in the two lists: machine and person. ALGORITHM 1 So, I wrote the following code, The most intuitive algorithm: cows and bulls are initialized to 0 before the start of this loop. for x in person: if x in machine: if machine.index(x) == person.index(x): bulls += 1 print x,' in correct place' else: print x,' in wrong place' cows += 1 And I started testing this with different type of numbers guessed by the computer. Quite randomly, I decided on 277. And I guessed 447. Here, I got the first clue that this algorithm may not work. I got 1 cow and 0 bulls. Whereas I should have got 1 bull and 1 cow. This is a table of outputs with the first algorithm: Guess Output Expected Output 447 0 bull, 1 cow 1 bull, 1 cow 477 2 bulls, 0 cows 2 bulls, 0 cows 777 0 bulls, 3 cows 2 bulls, 0 cows So obviously this algorithm was not working when there are repeated digits in the number randomly selected by the computer. I tried to understand why these errors are taking place, But I could not. I have tried a lot but I just could not see any mistake in the algorithm(probably because I wrote it!) ALGORITHM 2 On thinking about this for a few days I tried this: cows and bulls are initialized to 0 before the start of this loop. for x in range(3): for y in range(3): if x == y and machine[x] == person[y]: bulls += 1 if not (x == y) and machine[x] == person[y]: cows += 1 I was more hopeful about this one. But when I tested this, this is what I got: Guess Output Expected Output 447 1 bull, 1 cow 1 bull, 1 cow 477 2 bulls, 2 cows 2 bulls, 0 cows 777 2 bulls, 4 cows 2 bulls, 0 cows The mistake I am making is quite clear here, I understood that the numbers were being counted again and again. i.e.: 277 versus 477 When you count for bulls then the 2 bulls come up and thats alright. But when you count for cows: the 7 in 277 at units place is matched with the 7 in 477 in tens place and thus a cow is generated. the 7 in 277 at tens place is matched with the 7 in 477 in units place and thus a cow is generated.' Here the matching is exactly right as I have written the code as per that. But this is not what I want. And I have no idea whatsoever on what to do after this. Furthermore... I would like to stress that both the algorithms work perfectly, if there are no repeated digits in the number selected by the computer. Please help me with this issue. P.S.: I have been thinking about this for over a week, But I could not post a question earlier as my account was blocked(from asking questions) because I asked a foolish question. And did not delete it even though I got 2 downvotes immediately after posting the question.

    Read the article

  • Get Checked RadioButtons using JavaScript

    - by Rudi
    so I’m trying to build a win 8 app, which includes a WebView. The WebView contains the HTML code (+JavaScript) below. <!DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' > <script type='text/javascript'> function get_radio_value() { for (var i=0; i < document.myForm.frage1.length; i++) { if (document.orderform.frage1[i].checked) { var rad_val = document.myForm.frage1[i].value; return rad_val; } } } </script> <title>Kundenfragebogen</title> </head> <body> <h1>Kundenfragebogen</h1> <div id='myDiv'>Hello</div> <form name='myForm' action=''> <table border='2'> <tr> <td></td> <td>sehr gut</td> <td>gut</td> <td>schlecht</td> </tr> <tr> <td>Wie geht es Ihnen?</td> <td><input type='radio' name="frage1" value='1'/>Mir ging es noch nie besser!</td> <td><input type='radio' name="frage1" value='2'/>Es geht mir so wie immer.</td> <td><input type='radio' name="frage1" value='3'/>Heute geht einfach gar nichts…</td> </tr> <tr> <td>Können Sie Auto fahren?</td> <td><input type='radio' name="frage2" value='1'/>Ja</td> <td></td> <td><input type='radio' name="frage2" value='3'/>Nein</td> </tr> <tr> <td>Möchten Sie unseren Newsletter abonnieren?</td> <td><input type='radio' name="frage3" value='1'/>Ja</td> <td></td> <td></td> </tr> </table> <input type='button' value='Formular absenden' onclick="return get_radio_value()"/> </form> </body> </html> So the html contains some radio buttons and a button. I’ve used JavaScript ~2 years ago (just a little), so I don’t really know how to write the exact code. I’ve found something on the internet, but it doesn’t do what I want. I want to have the following: The user can check the RadioButtons. When the user clicks the Button, the JavaScript function should return all the checked radio buttons (I only need to know which RadioButton is checked). Since I know the name of the RadioButtons in my Windows 8 App, I can do the following: var object = WebView.InvokeScript("JavaScriptFunctionNAME", NameOfRadiobutton); So the WebView invokes the script and should get as a return the VALUE of the RadioButton, which is checked. “JavaScriptFunctionNAME” = name of the function in Javascript NameOfRadiobutton = the name of the RadioButton as a parameter (for example “frage1”). Currently I’m returning the value of the radiobutton, which is checked in the RadioGroup “frage1”. How can I check every RadioButton by it’s parameter? By this I mean I have a parameter “frage1” and return the value of the checked RadioButton. After this, I call the function again with the parameter “frage2” and return the checked RadioButtons value. Could anyone help me out with the JavaScript-function?

    Read the article

  • onchange of FilteringSelect do not work

    - by vusan
    Same code I'm using of dojo documentation just downloaded code work fine but onchange event do not fire on my project. I have make it to work by firing onblur onBlur: function(){alert(3)} What thing may cause onchange event not fire? var filteringSelect = new FilteringSelect({ id: "stateSelect", name: "state", value: "CA", store: stateStore, searchAttr: "name", onChange: function(){alert(3)} }, "stateSelect");

    Read the article

  • realtime visitors with nodejs & redis & socket.io & php

    - by orhan bengisu
    I am new to these tecnologies. I want to get realtime visitor for each products for my site. I mean a notify like "X users seeing this product". Whenever an user connects to a product counter will be increased for this product and when disconnects counter will be decreased just for this product. I tried to search a lots of documents but i got confused. I am using Predis Library for PHP. What i have done may totaly be wrong. I am not sure Where to put createClient , When to subscribe & When to unsubscribe. What I have done yet: On product detail page: $key = "product_views_".$product_id; $counter = $redis->incr($key); $redis->publish("productCounter", json_encode(array("product_id"=> "1000", "counter"=> $counter ))); In app.js var app = require('express')() , server = require('http').createServer(app) , socket = require('socket.io').listen(server,{ log: false }) , url = require('url') , http= require('http') , qs = require('querystring') ,redis = require("redis"); var connected_socket = 0; server.listen(8080); var productCounter = redis.createClient(); productCounter.subscribe("productCounter"); productCounter.on("message", function(channel, message){ console.log("%s, the message : %s", channel, message); io.sockets.emit(channel,message); } productCounter.on("unsubscribe", function(){ //I think to decrease counter here, Shold I? and How? } io.sockets.on('connection', function (socket) { connected_socket++; socket_id = socket.id; console.log("["+socket_id+"] connected"); socket.on('disconnect', function (socket) { connected_socket--; console.log("Client disconnected"); productCounter.unsubscribe("productCounter"); }); }) Thanks a lot for your answers!

    Read the article

  • pagerAnchorBuilder - trying to add classes

    - by Bert Murphy
    I'm using Cycle2 to build a carousel gallery and I've run into a little problem regarding styling the pager buttons. What I've gathered is that Cycle2 creates its own pager span tags for each slide which is a bummer becaus I've already styled my the sub-nav markup. This should be a minor issue as long as I can assign individual classes to the spans and change my css accordingly. However, I can't get this to work. TLDR: I was hoping that I could use pagerAnchorBuilder to create individual classes for each span. I can't. Help. The original markup (pre Cycle2) looks like the following: <div id ="sub-nav" class="sub-nav"> <ul> <li><a id="available" class="available" href="#"></a></li> <li><a id="reliable" class="reliable" href="#"></a></li> <li><a id="use" class="use" href="#"></a></li> <li><a id="reports" class="reports" href="#"></a></li> <li class="last"><a id="software" class="software" href="#"></a></li> </ul> </div> With Cycle2 it looks like this (note the addition of the span tags) <div id ="sub-nav" class="sub-nav"> <ul> <li><a id="available" class="available" href="#"></a></li> <li><a id="reliable" class="reliable" href="#"></a></li> <li><a id="use" class="use" href="#"></a></li> <li><a id="reports" class="reports" href="#"></a></li> <li class="last"><a id="software" class="software" href="#"></a></li> </ul> <span class="cycle-pager-active">•</span><span>•</span><span>•</span><span>•</span><span>•</span></nav> </div> Cycle2 $('#sliding-gallery ul').cycle({ fx: 'carousel', carouselVisible: 1, speed: 'fast', timeout: 10000, slides: '>li', next: '.next', prev: '.prev', pager: '.sub-nav', pagerAnchorBuilder: function(idx, slide) { return '.sub-nav span:eq(' + idx + ')'; } });

    Read the article

  • MEF instance management

    - by Lawrence A. Contreras
    I am working on application that has multiple modules and sub modules. Here's what I need to do: ModuleA has a sub module SubModuleA, SubModuleB, SubModuleC. I want to export ModuleA, SubModuleA, SubModuleB, SubModuleC. ModuleA can have multiple instances. Whenever I import ModuleA inside the sub modules, I want to get the correct instance and also when I import SubModuleA,SubModuleB and SubModuleC inside other classes. How can I manage that scenario using MEF? Do I really need to use MEF. Updated: Here's a quick example: public class School { List<Classroom> classRooms { get; set; } } [Export] public class Classroom { List<Teacher> teachers { get; set; } } public class Teacher { List<Student> students { get; set; } } public class Student { [Import] Classroom classroom { get; set; } } As you can see, I want to export the classroom class because I need to import it in the Student class, let's just say that I really need the classroom class inside the student class. I want to skip the part where we pass the classroom to the teacher and from the teacher we'll pass it to the student. But when I import classroom, I want to have the correct instance where that class room contains the teacher of the student.

    Read the article

  • Naming selenium grid nodes. Spawning a specific node

    - by ???? ????
    I'm trying to implement a kind of default queues in selenium hub. There is a possibility to specify node's name (actually its environment, smth like "firefox on ubuntu" or "chrome on windows"). Selenium grid itself has a default queue, it works according to 'First In, First Out' principle. But I want to prioritize some of my tasks given to selenium server. I have no possibility to introduce custom queue (seems like there is no API for that), that's why I decided to separate queue's logic from selenium server. I'll only call a specific node with specific name (environment) for example "firefox important node" or smth like that. So, I want to know how to directly tell selenium which node to use for my task? And generally, am I thinking in a right way? Here are my configs: hubConfig.json.erb { "host": null, "port": <%= node[:selenium][:server][:port] %>, "newSessionWaitTimeout": -1, "servlets" : [], "prioritizer": null, "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent": true, "nodePolling": <%= node[:selenium][:server][:node_polling] %>, "cleanUpCycle": <%= node[:selenium][:server][:cleanup_cycle] %>, "timeout": <%= node[:selenium][:server][:timeout] %>, "browserTimeout": 0, "maxSession": <%= node[:selenium][:server][:max_session] %> } nodeConfig.json.erb { "capabilities": [ { "browserName": "firefox", "maxInstances": 5, "seleniumProtocol": "WebDriver" }, { "browserName": "chrome", "maxInstances": 5, "seleniumProtocol": "WebDriver" }, { "browserName": "phantomjs", "maxInstances": 5, "seleniumProtocol": "WebDriver" } ], "configuration": { "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession": <%= node[:selenium][:node][:max_session] %>, "port": <%= node[:selenium][:node][:port] %>, "host": "<%= node[:fqdn] %>", "register": true, "registerCycle": <%= node[:selenium][:node][:register_cycle] %>, "hubPort": <%= node[:selenium][:server][:port] %> } } And my Driver class: ... def remote_driver @browser = Watir::Browser.new(:remote, :url => "http://myhub.com:4444/wd/hub", :http_client => client, :desired_capabilities => capabilities ) end def capabilities Selenium::WebDriver::Remote::Capabilities.send( "firefox", :javascript_enabled => true, :css_selectors_enabled => true, :takes_screenshot => true ) end def client client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 360 client end ... I still don't know how to use specified node for my task. If I try to start a driver adding :name => "firefox important node" and extend nodeConfig.json.erb's configuration with environments: - name: "firefox important node" browser: "*firefox" - name: "Firefox36 on Linux" browser: "*firefox" selenium just starts random firefox browser on a random node. How can I control it?

    Read the article

  • TabHost disappears after locking the phone and reopening it:

    - by Emil Adz
    I have a weird issue with my TabHost in my FragmentActivity that contains a ViewPager. The problem is that when I close my phone (press the power button) while I use my application, and then I turn back the phone and my application gets reopened, at this point my TabHost is missing. So the closing of my phone is causes the TabHost to disappear. My guess would be that I need to save my tabHost state in the saveInstanceState object, and restore it in onResume I only have no idea how it's done. here is my code for the FragmentActivity: public class TabsViewPagerFragmentActivity extends FragmentActivity implements ViewPager.OnPageChangeListener, TabHost.OnTabChangeListener { static final String TAG = TabsViewPagerFragmentActivity.class.getSimpleName(); private TabHost mTabHost; private ViewPager mViewPager; private HashMap<String, TabInfo> mapTabInfo; public ViewPagerAdapter mPagerAdapter; private TextView tvReportName, tvTabTitle; private Button bBackToParameters; private Dialog progressDialog; private SGRaportManagerAppObj application; private int numberOfTabs = 0; private Display display; public static final int POPUP_MARGIN = 6; LeftSideMenu leftSideMenu; public void NotifyTabActivityViewPagerAdapter() { mPagerAdapter.notifyDataSetChanged(); } public ViewPagerAdapter getTabActivityViewPagerAdapter() { return mPagerAdapter; } public ViewPager getTabActivityViewPager() { return mViewPager; } public void setCurrentTabTitle (String title) { tvTabTitle.setText(title); Log.d(TAG, "set tab title from activity: "+title); } /** * Maintains extrinsic info of a tab's construct */ private class TabInfo { private String tag; private Class<?> clss; private Bundle args; private Fragment fragment; TabInfo(String tag, Class<?> clazz, Bundle args) { this.tag = tag; this.clss = clazz; this.args = args; } } /** * A simple factory that returns dummy views to the Tabhost */ class TabFactory implements TabContentFactory { private final Context mContext; /** * @param context */ public TabFactory(Context context) { mContext = context; } /** (non-Javadoc) * @see android.widget.TabHost.TabContentFactory#createTabContent(java.lang.String) */ public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; } } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); application = SGRaportManagerAppObj.getInstance(); display = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); // Inflate the layout setContentView(R.layout.tabs_screen_activity_layout); tvTabTitle = (TextView) findViewById(R.id.tvTabName); tvReportName = (TextView)findViewById(R.id.tvReportName); tvReportName.setText(application.currentReport.getName()+ " - "); bBackToParameters = (Button) findViewById(R.id.bBackToParameters); leftSideMenu = (LeftSideMenu) findViewById(R.id.leftSideMenu); applyOnClickListenerToLeftSideMenu(); findViewById(R.id.showLeftMenuButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Display d = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width = d.getWidth(); View panel = findViewById(R.id.leftSideMenu); View appPanel = findViewById(R.id.appLayout); if (panel.getVisibility() == View.GONE){ appPanel.setLayoutParams(new LinearLayout.LayoutParams(width, LayoutParams.FILL_PARENT)); panel.setVisibility(View.VISIBLE); applyOnClickListenerToLeftSideMenu(); }else{ ToggleButton button = (ToggleButton) findViewById(R.id.showLeftMenuButton); button.setChecked(false); panel.setVisibility(View.GONE); } } }); // Initialise the TabHost progressDialog = DialogUtils.createProgressDialog(this, this.getString(R.string.populating_view_pager)); progressDialog.show(); if (SGRaportManagerAppObj.getInstance().parametersRepository.getParametersRepository().size() == 0) { bBackToParameters.setText(R.string.back_to_report_list); } this.initialiseTabHost(savedInstanceState); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); //set the tab as per the saved state } // Intialise ViewPager this.intialiseViewPager(); progressDialog.dismiss(); } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle) */ protected void onSaveInstanceState(Bundle outState) { outState.putString("tab", mTabHost.getCurrentTabTag()); //save the tab selected super.onSaveInstanceState(outState); } /** * Initialise ViewPager */ public void intialiseViewPager() { List<Fragment> fragments = new Vector<Fragment>(); // TabInfo tabInfo = null; if (application.getCurrentDataSource().equals(DataSource.SSRS)) { numberOfTabs = application.currentReport.getTabsList().size(); } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { numberOfTabs = application.currentReport.getODTabsList().size(); Log.d(TAG, "CURRENT REPORT FROM VIEW PAGER: "+ application.currentReport.toString()); } Log.d(TAG,"Current Tabs number from TabsViewPager activity: " +numberOfTabs); if (application.getCurrentDataSource().equals(DataSource.SSRS)) { for (int i = 0; i < numberOfTabs; i++) { Tab tempTab = application.currentReport.getTabsList().get(i); if (tempTab.getTabTemplateId() == 7) { GridFragment gridFragment = new GridFragment(tempTab); fragments.add(gridFragment); } else if (tempTab.getTabTemplateId() == 8) { NewChartFragment chartFragment = new NewChartFragment(tempTab, this); fragments.add(chartFragment); } } } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { for (int i = 0; i < numberOfTabs; i++) { ODTab tempTab = application.currentReport.getODTabsList().get(i); if (tempTab.getTabType().equals(ODGrid.XML_GRID_ELEMENT)) { GridFragment gridFragment = GridFragment.newInstance(tempTab.getTabId()); fragments.add(gridFragment); } else if (tempTab.getTabType().equals(ODChart.XML_CHART_ELEMENT)) { NewChartFragment chartFragment = NewChartFragment.newInstance(tempTab.getTabId()); fragments.add(chartFragment); } } } Log.d(TAG, "Current report fragments set to adapter: "+fragments.toString()); /* if (this.mPagerAdapter == null) { this.mPagerAdapter = new ViewPagerAdapter(super.getSupportFragmentManager(), fragments); } else { this.mPagerAdapter.removeAllFragments(); this.mPagerAdapter.addFragmentsListToAdapter(fragments); } */ this.mPagerAdapter = new ViewPagerAdapter(super.getSupportFragmentManager(), fragments); this.mViewPager = (ViewPager)super.findViewById(R.id.pager); // this.mViewPager.setAdapter(null); this.mViewPager.setAdapter(this.mPagerAdapter); this.mViewPager.setOffscreenPageLimit(0); this.mViewPager.setOnPageChangeListener(this); Log.d(TAG, "Adapter initialized!"); } /** * Initialise the Tab Host */ public void initialiseTabHost(Bundle args) { mTabHost = (TabHost)findViewById(android.R.id.tabhost); /* //new edit if (mTabHost.getChildCount() > 0) { mTabHost.removeAllViews(); } */ mTabHost.setup(); TabInfo tabInfo = null; mapTabInfo = new HashMap<String, TabsViewPagerFragmentActivity.TabInfo>(); if (args != null) {} else { if (application.getCurrentDataSource().equals(DataSource.SSRS)) { int numberOfTabs = application.currentReport.getTabsList().size(); for (int i = 0; i < numberOfTabs; i++) { Tab tempTab = application.currentReport.getTabsList().get(i); if (tempTab.getTabTemplateId() == 7) { //GridFragment gridFragment = new GridFragment(tempTab); TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), GridFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } else if (tempTab.getTabTemplateId() == 8) { TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), NewChartFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } } } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { int numberOfTabs = application.currentReport.getODTabsList().size(); for (int i = 0; i < numberOfTabs; i++) { ODTab tempTab = application.currentReport.getODTabsList().get(i); // Log.d(TAG,"Crashed Tab type: "+ tempTab.getTabType()); if (tempTab.getTabType().equals(ODGrid.XML_GRID_ELEMENT)) { //GridFragment gridFragment = new GridFragment(tempTab); TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), GridFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } else if (tempTab.getTabType().equals(ODChart.XML_CHART_ELEMENT)) { TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), NewChartFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } } } } // Default to first tab //this.onTabChanged("Tab1"); // mTabHost.setOnTabChangedListener(this); } /** * Add Tab content to the Tabhost * @param activity * @param tabHost * @param tabSpec * @param clss * @param args */ private static void AddTab(TabsViewPagerFragmentActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) { // Attach a Tab view factory to the spec ImageView indicator = new ImageView(activity.getBaseContext()); indicator.setPadding(10, 10, 10, 10); indicator.setImageResource(R.drawable.tab_select_icon_selector); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(10, 10, 10, 10); indicator.setLayoutParams(lp); tabSpec.setIndicator(indicator); tabSpec.setContent(activity.new TabFactory(activity)); tabHost.addTab(tabSpec); } /** (non-Javadoc) * @see android.widget.TabHost.OnTabChangeListener#onTabChanged(java.lang.String) */ public void onTabChanged(String tag) { //TabInfo newTab = this.mapTabInfo.get(tag); int pos = this.mTabHost.getCurrentTab(); this.mViewPager.setCurrentItem(pos); } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrolled(int, float, int) */ @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageSelected(int) */ @Override public void onPageSelected(int position) { // TODO Auto-generated method stub this.mTabHost.setCurrentTab(position); } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrollStateChanged(int) */ @Override public void onPageScrollStateChanged(int state) { // TODO Auto-generated method stub } How would one save the state of the TabHost and restore it in onResume? Any help would be very appreciated.

    Read the article

  • Grunt usemin with templates

    - by gang
    Given the following directory structure: – Gruntfile.js – app |– index.php |– js |– css |– templates |– template.php – dist How can I configure grunt usemin to update the references to styles and scripts in my template file relative to the index.php which uses the template? currently the tasks look like this: useminPrepare: { html: '<%= yeoman.app %>/templates/template.php', options: { dest: '<%= yeoman.dist %>' } }, usemin: { html: ['<%= yeoman.dist %>/{,*/}*.php'], css: ['<%= yeoman.dist %>/css/*.css'], options: { dirs: ['<%= yeoman.dist %>'] } } And the blocks inside of the template look like this: <!-- build:js js/main.js --> <script src="js/script1.js"></script> <script src="js/script2.js"></script> <!-- endbuild -->

    Read the article

  • Android Show Map location when Longitude/ Latitude values are in DMS Format

    - by JibW
    In my Android application I need to load Google map and show the location according to the Latitude and the Longitude values provided. I referred the following tutorial and its completely ok. Work fine. Link to the tutorial I followed Problem is Latitude and Longitude values are stored in SQLite database in the DMS Fromat. If those values were in the Decimal Degrees format then No problem, as I can do the way it was in that tutorial. I need to Show the exact place by adding Overlay Item(I have given the Longitude and Latitude values by DMS Format). [Example values: 36°7'59''N, 5°25'59''W] Thanks...

    Read the article

  • PCI-E riser card prevents server from starting at all

    - by user68623
    I need to replace the RAID controller in a server, and the new one is PCI Express while the old one was 64bit PCI. The server has both slots, but the riser card that was installed does not contain the PCI Express part. So I bought a new 4x PCI Express riser card (Delock 89103), but the moment I put it into the slot the server does not start up at all. It does not even get to POST, at most the power LED flashed once but nothing else happens at all. It does not power up the server at all. If I remove the riser card it starts up fine. If I put the riser card into a regular desktop computer it seems to work in general. Is there anything else I have to pay attention to when buying a riser card? My naive assumption would be that any PCI Express riser card should work. Or is my riser card likely to be damaged or out-of-spec and the server is just more picky? How do I get it to work, or how can I at least find a riser card that will work with my server? The server mainboard is a Super Micro PDSMi+.

    Read the article

  • Routing not working correctly using the laravel framework

    - by samayres1992
    I'm using the book wrote by one of the guys that created laravel, so I'd like to think for the most part this code isn't horribly wrong. My server is setup with nginx serving all static files and apache2 serving php. My config for each are the following: apache2: <VirtualHost *> # Host that will serve this project. ServerName litl.it # The location of our projects public directory. DocumentRoot /var/www/litl.it/laravel/public # Useful logs for debug. CustomLog /var/log/apache.access.log common ErrorLog /var/log/apache.error.log # Rewrites for pretty URLs, better not to rely on .htaccess. <Directory /var/www/litl.it/laravel/public> <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> nginx: server { # Port that the web server will listen on. listen 80; # Host that will serve this project. server_name litl.it *.litl.it; # Useful logs for debug. access_log /var/log/nginx.access.log; error_log /var/log/nginx.error.log; rewrite_log on; # The location of our projects public directory. root /var/www/litl.it/laravel/public; # Point index to the Laravel front controller. index index.php; location / { # URLs to attempt, including pretty ones. try_files $uri $uri/ /index.php?$query_string; } # Remove trailing slash to please routing system. if (!-d $request_filename) { rewrite ^/(.+)/$ /$1 permanent; } # PHP FPM configuration. location ~* \.php$ { proxy_pass http://127.0.0.1:8080; include /etc/nginx/proxy_params; try_files index index.php $uri =404; include /etc/nginx/fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/php/$fastcgi_script_name; } # We don't need .ht files with nginx. location ~ /\.ht { deny all; } location @proxy { proxy_pass http://127.0.0.1:8080; include /etc/nginx/proxy_params; } error_page 403 /error/403.html; error_page 404 /error/404.html; error_page 405 /error/405.html; error_page 500 501 502 503 504 /error/5xx.html; location ^~ /error/ { internal; root /var/www/litl.it/lavarel/public/error; } } I'm including these server configs, as I feel this maybe the issue? Here is my incredibly basic routing file that should return "routing is working" on domain.com/test but instead it just returns the homepage. <?php Route::get('/', function() { return View::make('hello'); }); Route::get('/test', function() { return "routing is working"; }); Any ideas where I'm going wrong, I'm following this tutorial very closely and I'm confused why there is issue. Thanks!

    Read the article

  • Amazon AWS EC2 + Puppet, get Puppet to know AWS instance tags

    - by Piotr Jasiulewicz
    I am having a problem with my AWS deployment, fairly new to AWS and Puppet. So coming to my question - can you distinguish puppet nodes with AWS machine tags or CNAME domains? A little background about the plan: have multiple clusters of machines, one php cluster, one legacy php cluster, one java cluster, one perl cluster control configuration with puppet - still pretty new to puppet but as a developer I like the idea of being able to version control configuration of servers have autoscaling enabled on those clusters - obviously the main benefit of the cloud that makes the much hight cost when it comes to any reasonable performance worth it (those amazon machines are slower than my phone...) deployment controlled by Capistrano, this makes things a lot easier So in AWS you get those super nasty public/private machine dns's... no way you can identify machines on those. In order to easer the problem, seams like AWS want's you to tag everything - so I did. Found a script that makes a CNAME record for each machine with the tag "ShortName" thanks to the Route53 API. Every machine has a ShortName tag that becomes its CNAME, unfortunately puppet still resolves the private dns name. I'd like to have node 'perl-cluster'{} in puppet, anyone any clue ho to achieve this? Thanks

    Read the article

  • Best Guest OS for running freeswitch under Proxmox

    - by Frank Waller
    We have a lot of asterisk Systems running on dedicated machines and would like to use freeswitch to replace a number of them. One of the advantages of freeswitch is supposed to be that it is doing much better in a virtualized environment than asterisk is. However I can find very little information about people using it in Proxmox containers. I would like to know if anyone has seen any ready to run proxmox images that include freeswitch so we can test a number of things without having to deeply go into creating our own. Or at least a clue to which system images/distro images we can use to quickly get it installed not having to deal with too many dependency or different Linux version issues. Just to be clear: It should be for a more or less current Proxmox and current freeswitch. I am not looking forward to use the KVM mode but would consider it, if it is otherwise ready to run out of the box. I would rather use a real OpenVZ based container. Thanks for anyone helping!

    Read the article

  • Rsyslog : copy with change the facility

    - by Dom
    I have saslauthd with save the logs in LOG_AUTH in our rsyslogd server. It can't be changed without recompiling, and I don't want to do that. I would like to see all the LOG_AUTH in LOG_MAIL, because I do an export to an external machine, and I would like to see all the saslauthd logs in LOG_MAIL in the distant server. Of course, in local I can add "auth.* " in the mail.log file section, but the export will not be in the right file because I filter in export by syslog Facility/Priority. How can I export all the AUTH logs into MAIL logs ? Thanks

    Read the article

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