Daily Archives

Articles indexed Sunday October 28 2012

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

  • Android : Connecting to MySQL using PHP

    - by user1771128
    I followed the following article http://blog.sptechnolab.com/2011/02/10/android/android-connecting-to-mysql-using-php/ I am able to execute my php file. I executed it individually and its working fine. The problem is in the android execution part. Am posting the Log Cat for the error am facing. Tried putting in a List View with id "list" but the error stil 10-28 16:08:27.201: E/AndroidRuntime(664): **FATAL EXCEPTION: main** 10-28 16:08:27.201: E/AndroidRuntime(664): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.city/com.example.city.City}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.ActivityThread.access$600(ActivityThread.java:123) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.os.Handler.dispatchMessage(Handler.java:99) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.os.Looper.loop(Looper.java:137) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.ActivityThread.main(ActivityThread.java:4424) 10-28 16:08:27.201: E/AndroidRuntime(664): at java.lang.reflect.Method.invokeNative(Native Method) 10-28 16:08:27.201: E/AndroidRuntime(664): at java.lang.reflect.Method.invoke(Method.java:511) 10-28 16:08:27.201: E/AndroidRuntime(664): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 10-28 16:08:27.201: E/AndroidRuntime(664): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 10-28 16:08:27.201: E/AndroidRuntime(664): at dalvik.system.NativeStart.main(Native Method) 10-28 16:08:27.201: E/AndroidRuntime(664): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.ListActivity.onContentChanged(ListActivity.java:243) 10-28 16:08:27.201: E/AndroidRuntime(664): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:254) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.Activity.setContentView(Activity.java:1835) 10-28 16:08:27.201: E/AndroidRuntime(664): at com.example.city.City.onCreate(City.java:35) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.Activity.performCreate(Activity.java:4465) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 10-28 16:08:27.201: E/AndroidRuntime(664): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 10-28 16:08:27.201: E/AndroidRuntime(664): ... 11 more

    Read the article

  • Solid Principle examples anywhere?

    - by user231465
    We all write code with some patterns even when we dont realise it. I am trying to really understand some of the solid principles and how you apply this principles in the real world. I am struggling with the "D" my understanding on Dependency Inversion I sometimes confuse with Dependency Injection is that as long as you keep things depending on abstraction (IE:interfaces) you are done. Has anybody got a small c# sample that explains it? thanks

    Read the article

  • PHP: Is there an elegant way to foreach through multiple items (groups) at a time?

    - by acheong87
    Given an array of N items: $arr = array('a', 'b', 'c', 'd', 'e', 'f'); What's the most elegant way to loop through in groups of M items (assuming N is divisible by M)? I tried foreach (array_chunk($arr, 2) as list($first, $second)) { // do stuff with $first and $second } but this resulted in a syntax error. In other words, I want to emulate what in Tcl would look like this: set arr [a b c d e f] foreach {first second} $arr { // do stuff with $first and $second } For now I've resorted to the obvious measure: foreach (array_chunk($arr, 2) as $group) { $first = $group[0]; $second = $group[1]; // do stuff with $first and $second } But I'm hoping someone has a more elegant method...

    Read the article

  • After resolving and calling host via ipv6 with curl, next ipv4 request fails and vice versa

    - by Ranty
    I need to request the same host with different methods (using IPv4 and IPv6) from the same script. First request is always successful (no matter IPv4 or IPv6), but the second always fails with curl error 45 (Couldn't bind to IP). I'm using the following curl config: function v4_google() { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1'); curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/search?q=Moon'); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_INTERFACE, 'My IPv4 address'); $c = curl_exec($ch); $result = !curl_errno($ch) ? 'Success' : '<b>' . curl_error($ch) . '; #' . curl_errno($ch) . '</b>'; echo '<p>v4_google:<br>Response length: ' . mb_strlen($c) . '<br>Result: ' . $result . '</p>'; curl_close($ch); } function v6_google() { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1'); curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/search?q=Moon'); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6); curl_setopt($ch, CURLOPT_INTERFACE, 'My IPv6 address'); $c = curl_exec($ch); $result = !curl_errno($ch) ? 'Success' : '<b>' . curl_error($ch) . '; #' . curl_errno($ch) . '</b>'; echo '<p>v6_google:<br>Response length: ' . mb_strlen($c) . '<br>Result: ' . $result . '</p>'; curl_close($ch); } v6_google(); v4_google(); So long story short, if I query v6_google(); first, then all consecutive calls of v4_google(); are failing with the curl error 45 (Couldn't bind to IP). And vice versa. As you can see, I separated code into different functions and added CURLOPT_FORBID_REUSE and CURLOPT_FRESH_CONNECT plus curl_close($ch), but it didn't help at all. It looks like curl is caching the resolving method of every host you request, and even if you specify another resolving method the next time you call that host, the cached one is used instead. I would appreciate any help with this issue.

    Read the article

  • grailsApplication not getting injected in a service , Grails 2.1.0

    - by vijay tyagi
    I have service in which i am accessing few configuration properties from grailsApplication I am injecting it like this class MyWebService{ def grailsApplication WebService webService = new WebService() def getProxy(url, flag){ return webService.getClient(url) } def getResponse(){ def proxy = getProxy(grailsApplication.config.grails.wsdlURL, true) def response = proxy.getItem(ItemType) return response } } When i call getProxy() method, i see this in tomcat logs No signature of method: org.example.MyWebService.getProxy() is applicable for argument types: (groovy.util.ConfigObject, java.lang.Boolean) values: [[:], true] Possible solutions: getProxy(), getProxy(java.lang.String, boolean), setProxy(java.lang.Object) which means grailsApplication is not getting injected into the service, is there any alternate way to access configuration object ? according to burtbeckwith's post configurationholder has been deprecated, can't think of anything else. Interestingly the very same service works fine in my local IDE(GGTS 3.1.0), that means locally grailsApplication is getting injected, but when i create a war to deploy to a standalone tomcat, it stops getting injected.

    Read the article

  • PHP Array to CSV

    - by JohnnyFaldo
    I'm trying to convert an array of products into a CSV file, but it doesn't seem to be going to plan. The CSV file is one long line, here is my code: for($i=0;$i<count($prods);$i++) { $sql = "SELECT * FROM products WHERE id = '".$prods[$i]."'"; $result = $mysqli->query($sql); $info = $result->fetch_array(); } $header = ''; for($i=0;$i<count($info);$i++) { $row = $info[$i]; $line = ''; for($b=0;$b<count($row);$b++) { $value = $row[$b]; if ( ( !isset( $value ) ) || ( $value == "" ) ) { $value = "\t"; } else { $value = str_replace( '"' , '""' , $value ); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim( $line ) . "\n"; } $data = str_replace( "\r" , "" , $data ); if ( $data == "" ) { $data = "\n(0) Records Found!\n"; } header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=your_desired_name.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$data"; Also, the header doesn't force a download. I've been copy and pasting the output and saving as .csv

    Read the article

  • MySQL Database || Tables Issue

    - by user1780103
    I'm trying to write up a script where the user is able to purchase an amount of points for dollars. I want the transaction to be inserted into MySQL. I keep facing a: "Column count doesn't match value count at row 1" error. And I have no idea what I'm doing wrong. I have written up this: mysql_query("INSERT INTO paypal_donations VALUES (NULL, ".$account_id.", ".$char_id.", ".$price.", ".$dp.", NOW(), NOW(), 'Started', 0, 0, '', '');") or die(mysql_error()); But I don't know what to execute in MySQL, since I've never worked with it before. Could anyone write up a quick script that I can insert into MySQL for it to work.

    Read the article

  • Show UIAlertView that is same as UIRemoteNotification when app is running in foreground

    - by Sidwyn Koh
    I understand that we can handle push notifications via the method: - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo and we can check if the app was running in the foreground: if (application.applicationState == UIApplicationStateActive ) { ... } How do we show the exact same notification with localisation? NSString *message = [[[userInfo valueForKey:@"aps"] valueForKey:@"alert"] valueForKey:@"loc-key"]; NSString *trueMessage = NSLocalizedString(message, nil); UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert" message:trueMessage cancelButtonItem:@"OK" otherButtonItems:@"Show", nil]; [alertView show]; This shows the raw unlocalized text, e.g. "You have a new alert from %1@ on %2@." My question is, how can we place the loc-args inside the UIAlertView as well, when the app is running in the foreground?

    Read the article

  • Binding not working correctly in silverlight

    - by Harsh Maurya
    I am using a DataGrid in my silverlight project which contains a custom checkbox column. I have binded its command property with a property of my ViewModel class. Now, the problem is that I want to send the "selected item" of DataGrid through the command paramter for which I have written the following code : <sdk:DataGrid AutoGenerateColumns="False" Margin="10,0,10,0" Name="dataGridOrders" ItemsSource="{Binding OrderList}" Height="190"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn Header="Select"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <CheckBox> <is:Interaction.Triggers> <is:EventTrigger EventName="Checked"> <is:InvokeCommandAction Command="{Binding Source={StaticResource ExecutionTraderHomePageVM},Path=OrderSelectedCommand,Mode=TwoWay}" CommandParameter="{Binding ElementName=dataGridOrders,Path=SelectedItem}" /> </is:EventTrigger> <is:EventTrigger EventName="Unchecked"> <is:InvokeCommandAction Command="{Binding Source={StaticResource ExecutionTraderHomePageVM},Path=OrderSelectedCommand,Mode=TwoWay}" CommandParameter="{Binding ElementName=dataGridOrders,Path=SelectedItem}" /> </is:EventTrigger> </is:Interaction.Triggers> </CheckBox> But I am always getting null in the parameter of my command's execute method. I have tried with other properties of DataGrid such as Width, ActualHeight e.t.c. but of no use. What am I missing here ?

    Read the article

  • AspectFit Not Working for Transformed UIImageView

    - by Dex
    I have a UIImageView inside a subview and I'm trying to get an AspectFit content mode working how I want for a 90 degree transformation. Here is a demo app of what I mean https://github.com/rdetert/image-scale-test If you run the app and hold it in a landscape orientation (app runs in landscape) you'll see that the image does not stretch from left edge to right edge. What seems to be happening is that the AspectFit works correctly for the portrait/default orientation, but then the image simply gets rotated the image after the fact. How can I make it auto stretch? I think the fact that it is inside a subview may have something to do with it?

    Read the article

  • Detect if 2 HTML fragments have identical hierarchical structure

    - by sergzach
    An example of fragments that have identical hierarchical structure: (1) <div> <span>It's a message</span> </div> (2) <div> <span class='bold'>This is a new text</span> </div> An example of fragments that have different structure: (1) <div> <span><b>It's a message</b></span> </div> (2) <div> <span>This is a new text</span> </div> So, fragments with a similar structure correspond to one hierarchical tree (the same tag names, the same hierarchical structure). How can I detect if 2 elements (html fragments) have the same structure simply with lxml? I have a function that does not work properly for some more difficult case (than the example): def _is_equal( el1, el2 ): # input: 2 elements with possible equal structure and tag names # e.g. root = lxml.html.fromstring( buf ) # el1 = root[ 0 ] # el2 = root[ 1 ] # move from top to bottom, compare elements result = False if el1.tag == el2.tag: # has no children if len( el1 ) == len( el2 ): if len( el1 ) == 0: return True else: # iterate one of them, for example el1 i = 0 for child1 in el1: child2 = el2[ i ] is_equal2 = _is_equal( child1, child2 ) if not is_equal2: return False return True else: return False else: return False The code fails to detect that 2 divs with class='tovar2' have an identical structure: <body> <div class="tovar2"> <h2 class="new"> <a href="http://modnyedeti-krsk.ru/magazin/product/333193003"> ?????? ?/? </a> </h2> <ul class="art"> <li> ???????: <span>1759</span> </li> </ul> <div> <div class="wrap" style="width:180px;"> <div class="new"> <img src="shop_files/new-t.png" alt=""> </div> <a class="highslide" href="http://modnyedeti-krsk.ru/d/459730/d/820.jpg" onclick="return hs.expand(this)"> <img src="shop_files/fr_5.gif" style="background:url(/d/459730/d/548470803_5.jpg) 50% 50% no-repeat scroll;" alt="?????? ?/?" height="160" width="180"> </a> </div> </div> <form action="" onsubmit="return addProductForm(17094601,333193003,3150.00,this,false);"> <ul class="bott "> <li class="price">????:<br> <span> <b> 3 150 </b> ???. </span> </li> <li class="amount">???-??:<br><input class="number" onclick="this.select()" value="1" name="product_amount" type="text"> </li> <li class="buy"><input value="" type="submit"> </li> </ul> </form> </div> <div class="tovar2"> <h2 class="new"> <a href="http://modnyedeti-krsk.ru/magazin/product/333124803">?????? ?/?</a> </h2> <ul class="art"> <li> ???????: <span>1759</span> </li> </ul> <div> <div class="wrap" style="width:180px;"> <div class="new"> <img src="shop_files/new-t.png" alt=""> </div> <a class="highslide" href="http://modnyedeti-krsk.ru/d/459730/d/820.jpg" onclick="return hs.expand(this)"> <img src="shop_files/fr_5.gif" style="background:url(/d/459730/d/548470803_5.jpg) 50% 50% no-repeat scroll;" alt="?????? ?/?" height="160" width="180"> </a> </div> </div> <form action="" onsubmit="return addProductForm(17094601,333124803,3150.00,this,false);"> <ul class="bott "> <li class="price">????:<br> <span> <b>3 150</b> ???. </span> </li> <li class="amount">???-??:<br><input class="number" onclick="this.select()" value="1" name="product_amount" type="text"> </li> <li class="buy"> <input value="" type="submit"> </li> </ul> </form> </div> </body>

    Read the article

  • Why isn't the @Deprecated annotation triggering a compiler warning about a method?

    - by Scooter
    I am trying to use the @Deprecated annotation. The @Deprecated documentation says that: "Compilers warn when a deprecated program element is used or overridden in non-deprecated code". I would think this should trigger it, but it did not. javac version 1.7.0_09 and compiled using and not using -Xlint and -deprecation. public class test_annotations { public static void main(String[] args) { test_annotations theApp = new test_annotations(); theApp.this_is_deprecated(); } @Deprecated public void this_is_deprecated() { System.out.println("doing it the old way"); } }

    Read the article

  • NSDateFormatter iOS6 issue

    - by Angad Manchanda
    I have written a code for UIButton press to decrement date. The present date is shown in a UILabel text property and it changes to the previous date when the button is pressed. The following code works perfectly fine for iOS5 but doesn't work with iOS6. With iOS6, it gives the output as Dec 31, 1999 or null. - (IBAction)showPrevDate:(id)sender { NSString *dateForDecrement = _showDateLbl.text; [dateFormatter setDateFormat:@"MMM d, yyyy (EEE)"]; NSDate *dateObjectForDecrement = [dateFormatter dateFromString:dateForDecrement]; int subtractDays = 1; dateAfterDecrement=[dateObjectForDecrement dateByAddingTimeInterval:-(24*60*60 * subtractDays)]; _showDateLbl.text = [NSString stringWithFormat:@"%@", [dateFormatter stringFromDate:dateAfterDecrement]]; } Can anybody verify this, or tell me if its's a bug in iOS6 ? Thanks guys.

    Read the article

  • Efficient banner rotation with PHP

    - by reggie
    I rotate a banner on my site by selecting it randomly from an array of banners. Sample code as demonstration: <?php $banners = array( '<iframe>...</iframe>', '<a href="#"><img src="#.jpg" alt="" /></a>', //and so on ); echo $banners(rand(0, count($banners))); ?> The array of banners has become quite big. I am concerned with the amount of memory that this array adds to the execution of my page. But I can't figure out a better way of showing a random banner without loading all the banners into memory...

    Read the article

  • Retrieve values from multimdimensional array

    - by vincentlerry
    I have a great difficulty. I need to retrieve [title], [url] and [abstract] values ??from this multidimensional array. Also, I have to store those values in mysql database. thanks in advance!!! Array ( [bossresponse] = Array ( [responsecode] = 200 [limitedweb] = Array ( [start] = 0 [count] = 20 [totalresults] = 972000 [results] = Array ( [0] = Array ( [date] = [clickurl] = http://www.torchlake.com/ [url] = http://www.torchlake.com/ [dispurl] = www.torchlake.com [title] = Torch Lake, COLI Inc, Highspeed, Dial-up, Wireless ... [abstract] = Welcome to COLI Inc. Chain O' Lake Internet. Local Northern Michigan ISP, offering Dialup Internet access, Wireless access, Web design, and T1 services in Northern ... ) [1] = Array ( [date] = [clickurl] = http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [url] = http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [dispurl] = en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [title] = Torch Lake (Antrim County, Michigan) - Wikipedia, the free ... [abstract] = Torch Lake at 19 miles (31 km) long is Michigan's longest lake and at approximately 18,770 acres (76 km²) is Michigan's second largest lake. Within it are several ... ) this is the entire code that generates this array: require("OAuth.php"); $cc_key = ""; $cc_secret = ""; $url = "http://yboss.yahooapis.com/ysearch/limitedweb"; $args = array(); $args["q"] = "car"; $args["format"] = "json"; $args["count"] = 20; $consumer = new OAuthConsumer($cc_key, $cc_secret); $request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $url, $args); $request-sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL); $url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args)); $ch = curl_init(); $headers = array($request-to_header()); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $rsp = curl_exec($ch); $results = json_decode($rsp, true);

    Read the article

  • How can I find out if the MainActivity is being paused from my Java class?

    - by quinestor
    I am using motion sensor detection in my application. My design is this: a class gets the sensor services references from the main activity and then it implements SensorEventListener. That is, the MainActivity does not listen for sensor event changes: public void onCreate(Bundle savedInstanceState) { // ... code mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); // The following is my java class, it does not extends any android fragment/activty mShakeUtil = new ShakeUtil(mSensorManager,mAccelerometer,this); // ..more code.. } I can't redesign ShakeUtil so it is a fragment nor activity, unfortunately. Now to illustrate the problem consider: MainActivity is on its way to be destroyed/paused. I.e screen rotation ShakeUtil's onSensorChanged(SensorEvent event) gets called in the process.. One of the things that happen inside onSensorChanged is a dialog interaction, which gives the error: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState When the previous happens between MainActivity's onSaveInstanceState and onPause. I know this can be prevented if I successfully detect that MainActivity is being pause in ShakeUtil. How can I detect that MainActivity is being paused or onSaveInstanceState was called from ShakeUtil? Alternatively, how can I avoid this issue without making Shakeutil extend activity? So far I have tried with flag variables but that isn't good enough, I guess these are not atomic operations. I tried using Activity's isChangingConfigurations(), but I get an undocummented "NoSuchMethodFound" error.. I am unregistering the sensors by calling ShakeUtil when onPause in main ACtivity

    Read the article

  • PHP convert latin1 to utf8 Persian txt

    - by root
    I now work on a web-base PHP app to work with a MySQL Server database . database is with Latin1 Character set and all Persian texts don't show properly . database is used with a windows software Show and Save Persian texts good . I don't want to change the charset because windows software work with that charset . Question: how can convert latin1 to utf8 to show and utf8 to latin1 for saving from my web-base PHP app , or using Persian/Arabic language on a latin1 charset database without problem ? note: one of my texts is ???? ?????? when save from my windows-based software save as ÇÍãÏ ÑÍãÇäí and still show with ???? ?????? in my old windows-based software image : image of database , charsets,collation and windows-based software

    Read the article

  • jQuery make child div visible on hover (on effective li element only, not parent!)

    - by Dennis
    I've already tried all of the existing posts related to this, but they doesn't work as I want it... The HTML: <ol class="sortable"> <li> <div> <a href="#">Start Page</a> <div class="li_options"> <a href="#"><img src="img/icons/small_add.png" /></a> <a href="#" onClick="[..]"><img src="img/icons/small_remove.png" /></a> </div> <div class="clear"></div> </div> <ol> <li> <div> <a href="#">Sub Seite</a> <div class="li_options"> <a href="#"><img src="img/icons/small_add.png" /></a> <a href="#" onClick="[..]"><img src="img/icons/small_remove.png" /></a> </div> <div class="clear"></div> </div> <ol> <li> <div> <a href="#">Sub Sub Seite</a> <div class="li_options"> <a href="#"><img src="img/icons/small_add.png" /></a> <a href="#" onClick="[..]"><img src="img/icons/small_remove.png" /></a> </div> <div class="clear"></div> </div> </li> </ol> </li> </ol> </li> <div class="clear"></div> This should look like this: Start Page Sub Page Sub Page I want the div.li_options which is set for every li element to be shown only on hovering element. I know, that the parent's li is also being "hovered" on hovering child elements, but I don't those "li_options" to be displayed. The best solution so far: $(document).ready(function() { $('.sortable li').mouseover(function() { $(this).children().children('.li_options').show(); }).mouseout(function() { $(this).children().children('.li_options').hide(); }); }); But with this, parents aren't being excluded... I don't know how to point on them, because there can be endless levels. Do you know how to get this working?

    Read the article

  • absolute audio synchronization

    - by user1780526
    I would like to synchronize my computer with an external camcorder recording so that I can know exactly (to the millisecond) when certain recored events happen with respect to other sensors logged by the computer. One idea is to playback short sound pulses or chirps every second from the computer that get picked up by the microphone on the camcorder. But the accuracy of a simple cron job playing a sound clip is not precise enough. I was thinking of using something like gstreamer, but how does one get it to playback a clip at precisely a certain time according to the system clock?

    Read the article

  • ViewController access data

    - by Giovanni Filaferro
    Today i would ask you if there is a way to call a method of another view controller just not initializing it or just how to get that viewController as a global variable declared in .h file. Help me please. I'm using a PageViewController and I have to use a method of the contentViewController alredy initialized. here I create my ViewControllers: - (void)createTheContent { NSLog(@"createTheContent"); pageController = nil; //[pageController removeFromParentViewController]; //[pageController awakeFromNib]; NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:UIPageViewControllerSpineLocationMin] forKey: UIPageViewControllerOptionSpineLocationKey]; self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options: options]; pageController.dataSource = self; [[pageController view] setFrame:CGRectMake(0, 0, 320, 365)]; initialViewController = [self viewControllerAtIndex:0]; NSMutableArray *viewControllers = [NSArray arrayWithObject:initialViewController]; [pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil]; [self addChildViewController:pageController]; [[self view] addSubview:[pageController view]]; [pageController didMoveToParentViewController:self]; } here are my propertys in .h file: contentViewController *initialViewController; } //Page View Controller Properties @property (strong, nonatomic) UIPageViewController *pageController; @property (strong, nonatomic) NSArray *pageContent; @property (strong, nonatomic) NSMutableArray *pageStrings; @property (strong, nonatomic) id dataObject;

    Read the article

  • Parse JSON with R

    - by Btibert3
    I am fairly new to R, but the more use it, the more I see how powerful it really is over SAS or SPSS. Just one of the major benefits, as I see them, is the ability to get and analyze data from the web. I imagine this is possible (and maybe even straightforward), but I am looking to parse JSON data that is publicly available on the web. I am not programmer by any stretch, so any help and instruction you can provide will be greatly appreciated. Even if you point me to a basic working example, I probably can work through it.

    Read the article

  • Getting Started With Knockout.js

    - by Pawan_Mishra
    Client side template binding in web applications is getting popular with every passing day. More and more libraries are coming up with enhanced support for client side binding. jQuery templates is one very popular mechanism for client side template bindings. The idea with client side template binding is simple. Define the html mark-up with appropriate place holder for data. User template engines like jQuery template to bind the data(JSON formatted data) with the previously defined mark-up.In this...(read more)

    Read the article

  • No More NCrunch For Me

    - by Steve Wilkes
    When I opened up Visual Studio this morning, I was greeted with this little popup: NCrunch is a Visual Studio add-in which runs your tests while you work so you know if and when you've broken anything, as well as providing coverage indicators in the IDE and coverage metrics on demand. It recently went commercial (which I thought was fair enough), and time is running out for the free version I've been using for the last couple of months. From my experiences using NCrunch I'm going to let it expire, and go about my business without it. Here's why. Before I start, let me say that I think NCrunch is a good product, which is to say it's had a positive impact on my programming. I've used it to help test-drive a library I'm making right from the start of the project, and especially at the beginning it was very useful to have it run all my tests whenever I made a change. The first problem is that while that was cool to start with, it’s recently become a bit of a chore. Problems Running Tests NCrunch has two 'engine modes' in which it can run tests for you - it can run all your tests when you make a change, or it can figure out which tests were impacted and only run those. Unfortunately, it became clear pretty early on that that second option (which is marked as 'experimental') wasn't really working for me, so I had to have it run everything. With a smallish number of tests and while I was adding new features that was great, but I've now got 445 tests (still not exactly loads) and am more in a 'clean and tidy' mode where I know that a change I'm making will probably only affect a particular subset of the tests. With that in mind it's a bit of a drag sitting there after I make a change and having to wait for NCrunch to run everything. I could disable it and manually run the tests I know are impacted, but then what's the point of having NCrunch? If the 'impacted only' engine mode worked well this problem would go away, but that's not what I found. Secondly, what's wrong with this picture? I've got 445 tests, and NCrunch has queued 455 tests to run. So it's queued duplicate tests - in this quickly-screenshotted case 10, but I've seen the total queue get up over 600. If I'm already itchy waiting for it to run all my tests against a change I know only affects a few, I'm even itchier waiting for it to run a lot of them twice. Problems With Code Coverage NCrunch marks each line of code with a dot to say if it's covered by tests - a black dot says the line isn't covered, a red dot says it's covered but at least one of the covering tests is failing, and a green dot means all the covering tests pass. It also calculates coverage statistics for you. Unfortunately, there's a couple of flaws in the coverage. Firstly, it doesn't support ExcludeFromCodeCoverage attributes. This feature has been requested and I expect will be included in a later release, but right now it doesn't. So this: ...is counted as a non-covered line, and drags your coverage statistics down. Hmph. As well as that, coverage of certain types of code is missed. This: ...is definitely covered. I am 100% absolutely certain it is, by several tests. NCrunch doesn't pick it up, down go my coverage statistics. I've had NCrunch find genuinely uncovered code which I've been able to remove, and that's great, but what's the coverage percentage on this project? Umm... I don't know. Conclusion None of these are major, tool-crippling problems, and I expect NCrunch to get much better in future releases. The current version has some great features, like this: ...that's a line of code with a failing test covering it, and NCrunch can run that failing test and take me to that line exquisitely easily. That's awesome! I'd happily pay for a tool that can do that. But here's the thing: NCrunch (currently) costs $159 (about £100) for a personal licence and $289 (about £180) for a commercial one. I'm not sure which one I'd need as my project is a personal one which I'm intending to open-source, but I'm a professional, self-employed developer, but in any case - that seems like a lot of money for an imperfect tool. If it did everything it's advertised to do more or less perfectly I'd consider it, but it doesn't. So no more NCrunch for me.

    Read the article

  • Helper method to Replace/Remove characters that do not match the Regular Expression

    - by Michael Freidgeim
    I have a few fields, that use regEx for validation. In case if provided field has unaccepted characters, I don't want to reject the whole field, as most of validators do, but just remove invalid characters. I am expecting to keep only Character Classes for allowed characters and created a helper method to strip unaccepted characters. The allowed pattern should be in Regex format, expect them wrapped in square brackets. function will insert a tilde after opening squere bracket , according to http://stackoverflow.com/questions/4460290/replace-chars-if-not-match.  [^ ] at the start of a character class negates it - it matches characters not in the class.I anticipate that it could work not for all RegEx describing valid characters sets,but it works for relatively simple sets, that we are using.         /// <summary>               /// Replaces  not expected characters.               /// </summary>               /// <param name="text"> The text.</param>               /// <param name="allowedPattern"> The allowed pattern in Regex format, expect them wrapped in brackets</param>               /// <param name="replacement"> The replacement.</param>               /// <returns></returns>               /// //        http://stackoverflow.com/questions/4460290/replace-chars-if-not-match.               //http://stackoverflow.com/questions/6154426/replace-remove-characters-that-do-not-match-the-regular-expression-net               //[^ ] at the start of a character class negates it - it matches characters not in the class.               //Replace/Remove characters that do not match the Regular Expression               static public string ReplaceNotExpectedCharacters( this string text, string allowedPattern,string replacement )              {                     allowedPattern = allowedPattern.StripBrackets( "[", "]" );                      //[^ ] at the start of a character class negates it - it matches characters not in the class.                      var result = Regex .Replace(text, @"[^" + allowedPattern + "]", replacement);                      return result;              }static public string RemoveNonAlphanumericCharacters( this string text)              {                      var result = text.ReplaceNotExpectedCharacters(NonAlphaNumericCharacters, "" );                      return result;              }        public const string NonAlphaNumericCharacters = "[a-zA-Z0-9]";There are a couple of functions from my StringHelper class  http://geekswithblogs.net/mnf/archive/2006/07/13/84942.aspx , that are used here.    //                           /// <summary>               /// 'StripBrackets checks that starts from sStart and ends with sEnd (case sensitive).               ///           'If yes, than removes sStart and sEnd.               ///           'Otherwise returns full string unchanges               ///           'See also MidBetween               /// </summary>               /// <param name="str"></param>               /// <param name="sStart"></param>               /// <param name="sEnd"></param>               /// <returns></returns>               public static string StripBrackets( this string str, string sStart, string sEnd)              {                      if (CheckBrackets(str, sStart, sEnd))                     {                           str = str.Substring(sStart.Length, (str.Length - sStart.Length) - sEnd.Length);                     }                      return str;              }               public static bool CheckBrackets( string str, string sStart, string sEnd)              {                      bool flag1 = (str != null ) && (str.StartsWith(sStart) && str.EndsWith(sEnd));                      return flag1;              }               public static string WrapBrackets( string str, string sStartBracket, string sEndBracket)              {                      StringBuilder builder1 = new StringBuilder(sStartBracket);                     builder1.Append(str);                     builder1.Append(sEndBracket);                      return builder1.ToString();              }v

    Read the article

  • Why can't we reach some (but not all) external web service via VPN connection?

    - by Paul Haldane
    At work (UK university) we use a set of Windows servers running WS2008R2 and RRAS which offer VPN service to students in our accommodation. We do this to associate the network connections with individuals. Before they've connected to the VPN all they can talk to is the stuff thats needed to setup the VPN and a local web site with documentation on how to connect. Medium term we'll probably replace this but it's what we're using at the moment. VPN on the 2008 servers allocates client a private (10.x) address. Access to external sites is through NAT on the campus routers (same as any other directly connected client on a private address). Non-VPN connections aren't seeing this problem. Older servers run WS 2003 and ISA2004. That setup works but has become unreliable under load. Big difference there was that we were allocating non-RFC1918 addresses to the clients (so no NAT required). Behaviour we're seeing is that once connected to the VPN, clients can reach local web sites (that is sites on the campus network) but only some external sites. It seems (but this may be chance) that the sites we can reach are Google ones (including YouTube). We certainly have trouble reaching Microsoft's Office 365 service (which is a pain because that's where mail for most of our students is). One odd bit of behaviour is that clients can fetch (using wget on a Windows 7 client) http://www.oracle.com/ (which gets a 301 redirect) but hangs when asked to fetch http://www.oracle.com/index.html (which is what the first URL redirects to). Access works reliably if we configure clients to use our local web proxies (Squid). My gut tells me that this is likely to be something in the chain dropping replies either based on HTTP inspection or the IP address in the reply. However I'm puzzled about why we're seeing this with the VPN clients. Plan for tomorrow (when I'm back in the office) is to setup a web server on external connection so that we can monitor behaviour at both ends of the conversation (hoping that the problem manifests itself with our test server). Any suggestions for things we should be looking at?

    Read the article

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