Search Results

Search found 2396 results on 96 pages for 'alex zylman'.

Page 72/96 | < Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >

  • jQuery select image in div if image parent does't have a certain class.

    - by Alex
    Wordpress wraps images with captions in a div with a class of .wp-caption. I'm looking for a way to select images that don't have this div so I can wrap them in different div. (to keep a consistent border around all the images) <div class="blog-post-content"> <div id="attachment_220" class="wp-caption alignleft" style="width: 310px"> <a href="/somewhere/"><img class="size-medium wp-image-220" src="/path/to/image" alt="" width="300" height="280" /></a> <p class="wp-caption-text">Caption Text</p> </div> <p>This is the body of the post</p> </div> To test my selector, I'm just trying to add a green border. I can handle the .wrap() once the selector is working. The most promising of my attempts is: $('.blog-post-content img').parent('div:not(".wp-caption")').css('border', '2px solid green'); ... but no luck.

    Read the article

  • Display rows from MySQL where a datetime is within the next hour

    - by alex
    I always have trouble with complicated SQL queries. This is what I have $query = ' SELECT id, name, info, date_time FROM acms_events WHERE date_time = DATE_SUB(NOW(), INTERVAL 1 HOUR) AND active = 1 ORDER BY date_time ASC LIMIT 6 '; I want to get up to 6 rows that are upcoming within the hour. Is my query wrong? It does not seem to get events that are upcoming within the next hour when I test it. What is the correct syntax for this? Thanks

    Read the article

  • .NET BinarySearch() on ArrayList of custom objects

    - by Alex
    Hi. I have an ArrayList of custom objects that have the following properties: FileName FilePath CurrentFolder TopLevelFolder I then need to do a BinarySearch (or some other quick search) on the FileName property on all the objects in the ArrayList in .NET. In other words, I need to find the object in the ArrayList with the same FileName as the one I'm searching on. Syntax for the ArrayList's BinarySearch is this; but how do you do this for an object's property in the arraylist? public static void FindMyObject( ArrayList myList, Object myObject ) { int myIndex=myList.BinarySearch( myObject ); if ( myIndex < 0 ) Console.WriteLine( "The object to search for ({0}) is not found. The next larger object is at index {1}.", myObject, ~myIndex ); else Console.WriteLine( "The object to search for ({0}) is at index {1}.", myObject, myIndex ); }

    Read the article

  • Android Video Camera : still picture

    - by Alex
    I use the camera intent to capture video. Here is the problem: If I use this line of code, I can record video. But onActivityResult doesn't work. Intent intent = new Intent("android.media.action.VIDEO_CAMERA"); If I use this line of code, after press the recording button, the camera is freezed, I mean, the picture is still. Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); BTW, when I use $Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); to capture a picture, it works fine. The java file is as follows: package com.camera.picture; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import android.app.Activity; import android.content.ContentValues; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import android.widget.VideoView; public class PictureCameraActivity extends Activity { private static final int IMAGE_CAPTURE = 0; private static final int VIDEO_CAPTURE = 1; private Button startBtn; private Button videoBtn; private Uri imageUri; private Uri videoUri; private ImageView imageView; private VideoView videoView; /** Called when the activity is first created. * sets the content and gets the references to * the basic widgets on the screen like * {@code Button} or {@link ImageView} */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); imageView = (ImageView)findViewById(R.id.img); videoView = (VideoView)findViewById(R.id.videoView); startBtn = (Button) findViewById(R.id.startBtn); startBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startCamera(); } }); videoBtn = (Button) findViewById(R.id.videoBtn); videoBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startVideoCamera(); } }); } public void startCamera() { Log.d("ANDRO_CAMERA", "Starting camera on the phone..."); String fileName = "testphoto.jpg"; ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, fileName); values.put(MediaStore.Images.Media.DESCRIPTION, "Image capture by camera"); values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); imageUri = getContentResolver().insert( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, IMAGE_CAPTURE); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == IMAGE_CAPTURE) { if (resultCode == RESULT_OK){ Log.d("ANDROID_CAMERA","Picture taken!!!"); imageView.setImageURI(imageUri); } } if (requestCode == VIDEO_CAPTURE) { if (resultCode == RESULT_OK) { Log.d("ANDROID_CAMERA","Video taken!!!"); Toast.makeText(this, "Video saved to:\n" + data.getData(), Toast.LENGTH_LONG).show(); videoView.setVideoURI(videoUri); } } } private void startVideoCamera() { // TODO Auto-generated method stub //create new Intent Log.d("ANDRO_CAMERA", "Starting camera on the phone..."); String fileName = "testvideo.mp4"; ContentValues values = new ContentValues(); values.put(MediaStore.Video.Media.TITLE, fileName); values.put(MediaStore.Video.Media.DESCRIPTION, "Video captured by camera"); values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4"); videoUri = getContentResolver().insert( MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values); Intent intent = new Intent("android.media.action.VIDEO_CAMERA"); //Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // start the Video Capture Intent startActivityForResult(intent, VIDEO_CAPTURE); } private static File getOutputMediaFile() { // TODO Auto-generated method stub // To be safe, you should check that the SDCard is mounted // using Environment.getExternalStorageState() before doing this. File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES), "MyCameraApp"); // This location works best if you want the created images to be shared // between applications and persist after your app has been uninstalled. // Create the storage directory if it does not exist if (! mediaStorageDir.exists()){ if (! mediaStorageDir.mkdirs()){ Log.d("MyCameraApp", "failed to create directory"); return null; } } // Create a media file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; mediaFile = new File(mediaStorageDir.getPath() + File.separator + "VID_"+ timeStamp + ".mp4"); return mediaFile; } /** Create a file Uri for saving an image or video */ private static Uri getOutputMediaFileUri(){ return Uri.fromFile(getOutputMediaFile()); } }

    Read the article

  • Problem with JPopupMenu in a JTree

    - by Alex
    Hi guys I have this issue. In a custom JTree I implemented a JPopupMenu to display different JMenuItem according to the node selected using a MouseListener. The JPopupMenu is shown when the mouse right button is clicked. The problem is that if I don’t choose an Item from the PopupMenu but instead I select another node in the tree, either with right or left buttons, this event is never caught by the tree MouseListener Could anyone point me in the right direction to solve this? In case an example is available I’ll appreciate it. Thanks.

    Read the article

  • Pygame - Different sided collision question!

    - by Alex Lockwood
    Hi there everyone! I'm making a Pygame of, basically, "Breakout". I'm using collisions, and want a simple way to have different bounce effects of the different sides of one rectangle. What I currently have for the ball-to-bat collision is this: "dot" = ball; "bat" = bat; so you all understand. if dot.rect.colliderect(bat.rect):<br> dot.dy *= -1 I'd like something that interacts with each side, so could reverse the self.dx value of the ball when it hits the side of the bat, and only reversing the self.dy value when it strikes the top. Thanks!!! :D

    Read the article

  • I have data about deadlocks, but I can't understand why they occur

    - by Alex
    I am receiving a lot of deadlocks in my big web application. http://stackoverflow.com/questions/2941233/how-to-automatically-re-run-deadlocked-transaction-asp-net-mvc-sql-server Here I wanted to re-run deadlocked transactions, but I was told to get rid of the deadlocks - it's much better, than trying to catch the deadlocks. So I spent the whole day with SQL Profiler, setting the tracing keys etc. And this is what I got. There's a Users table. I have a very high usable page with the following query (it's not the only query, but it's the one that causes troubles) UPDATE Users SET views = views + 1 WHERE ID IN (SELECT AuthorID FROM Articles WHERE ArticleID = @ArticleID) And then there's the following query in ALL pages: User = DB.Users.SingleOrDefault(u => u.Password == password && u.Name == username); That's where I get User from cookies. Very often a deadlock occurs and this second Linq-to-SQL query is chosen as a victim, so it's not run, and users of my site see an error screen. I read a lot about deadlocks... And I don't understand why this is causing a deadlock. So obviously both of this queries run very often. At least once a second. Maybe even more often (300-400 users online). So they can be run at the same time very easily, but why does it cause a deadlock? Please help. Thank you

    Read the article

  • help me to choose between two designs

    - by alex
    // stupid title, but I could not think anything smarter I have a code (see below, sorry for long code but it's very-very simple): namespace Option1 { class AuxClass1 { string _field1; public string Field1 { get { return _field1; } set { _field1 = value; } } // another fields. maybe many fields maybe several properties public void Method1() { // some action } public void Method2() { // some action 2 } } class MainClass { AuxClass1 _auxClass; public AuxClass1 AuxClass { get { return _auxClass; } set { _auxClass = value; } } public MainClass() { _auxClass = new AuxClass1(); } } } namespace Option2 { class AuxClass1 { string _field1; public string Field1 { get { return _field1; } set { _field1 = value; } } // another fields. maybe many fields maybe several properties public void Method1() { // some action } public void Method2() { // some action 2 } } class MainClass { AuxClass1 _auxClass; public string Field1 { get { return _auxClass.Field1; } set { _auxClass.Field1 = value; } } public void Method1() { _auxClass.Method1(); } public void Method2() { _auxClass.Method2(); } public MainClass() { _auxClass = new AuxClass1(); } } } class Program { static void Main(string[] args) { // Option1 Option1.MainClass mainClass1 = new Option1.MainClass(); mainClass1.AuxClass.Field1 = "string1"; mainClass1.AuxClass.Method1(); mainClass1.AuxClass.Method2(); // Option2 Option2.MainClass mainClass2 = new Option2.MainClass(); mainClass2.Field1 = "string2"; mainClass2.Method1(); mainClass2.Method2(); Console.ReadKey(); } } What option (option1 or option2) do you prefer ? In which cases should I use option1 or option2 ? Is there any special name for option1 or option2 (composition, aggregation) ?

    Read the article

  • Is an ArrayList automaticaly declared static in Java, if it is an instance variable?

    - by Alex
    I'm trying to do something like this: private class aClass { private ArrayList<String> idProd; aClass(ArrayList<String> prd) { this.idProd=new ArrayList<String>(prd); } public ArrayList<String> getIdProd() { return this.idProd; } } So if I have multiple instances of ArrayLIst<String> (st1 ,st2 ,st3) and I want to make new objects of aClass: { aClass obj1,obj2,obj3; obj1=new aClass(st1); obj2=new aClass(st2); obj3=new aClass(st3); } Will all of the aClass objects return st3 if I access the method getIdProd() for each of them(obj1..obj3)? Is an ArrayList as an instance variable automatically declared static?

    Read the article

  • PHP custom function code optimization

    - by Alex
    Now comes the hard part. How do you optimize this function: function coin_matrix($test, $revs) { $coin = array(); for ($i = 0; $i < count($test); $i++) { foreach ($revs as $j => $rev) { foreach ($revs as $k => $rev) { if ($j != $k && $test[$i][$j] != null && $test[$i][$k] != null) { if(!isset($coin[$test[$i][$j]])) { $coin[$test[$i][$j]] = array(); } if(!isset($coin[$test[$i][$j]][$test[$i][$k]])) { $coin[$test[$i][$j]][$test[$i][$k]] = 0; } $coin[$test[$i][$j]][$test[$i][$k]] += 1 / ($some_var - 1); } } } } return $coin; } I'm not that good at this and if the arrays are large, it runs forever. The function is supposed to find all pairs of values from a two-dim array and sum them like this: $coin[$i][$j] += sum_of_pairs_in_array_row / [count(elements_of_row) - 1] Thanks a lot!

    Read the article

  • How can I disable the F4 key from showing the items in a ComboBox

    - by Alex
    You might not know this, but pressing the F4 key on a ComboBox makes it's drop-down item list appear. I believe this is the default behavior on Windows. Does anyone know how to override this behavior in WPF (C#)? I know that overriding default behavior is generally seen as bad practice, however in this case I have a rugged-device that runs XP Embedded. It has a handful of prominent Function keys (F1-F6) that need to trigger different events. This works fine, however when focused over a ComboBox the events aren't triggered as the ComboBox drops down. I have tried catching the KeyDown event both on the form and on the ComboBox and listening for the F4 key, however it doesn't get this far as the key press must be handled at a lower level. Any ideas? Thanks.

    Read the article

  • i = true and false in Ruby is true?

    - by alex
    Am I fundamentally misunderstanding Ruby here? I've been writing Ruby code for about 2 years now and just today stumbled on this... ruby-1.8.7-p249 > i = true and false => false ruby-1.8.7-p249 > i => true Could somebody explain what's going on here please? I'm sure it's to spec, but it just seems counter intuitive to me...

    Read the article

  • Java technologies for web-development.

    - by Alex
    Hello. I'm PHP-programmer, but I'm extremely interested in learning Java. So I decided to change speciality from PHP to Java. At the moment I have an opportunity to try to make quite simple web-application (it should contain 2-3 forms, several pages with information from the database and authorization module) and also I have a chance to choose any technology I want. Besides I have about 3 months for this task. I've decided to develop site with Java technologies for the purpose of studying. I've already read a book about Java ("Java2 Complete Reference" by P.Naughton) and currently I'm reading "Thinking in Java" by B.Eckel. I clearly understand it's not enough for efficient development, but I want, at least, to try. I would be very appreciated for the advises, which framework (for example) or technology to choose (Spring, Grails etc.) and what primary aspects and technologies of Java should I pay attention to? Thank you in advance.

    Read the article

  • Javascript code plagiarism checker

    - by Alex Ciminian
    I was wondering if there was any tool available that detects code plagiarism and works well with Javascript. I want to test assignment submissions for homework I'm going to hand out. The only tool that I know of that can do this is MOSS, but, from what I've heard, it's pretty poor for anything else than C. Unfortunately, I can't test it yet because I don't have submissions :).

    Read the article

  • How do I include the Django settings file?

    - by alex
    I have a .py file in a directory , which is inside the Django project folder. I have email settings in my settings.py, but this .py file does not import that file. How can I specify to Django that settings.py should be used , so that I can use EmailMessage class with the settings that are in my settings.py?

    Read the article

  • How to deal with a Java serialized object whose package changed?

    - by Alex
    I have a Java class that is stored in an HttpSession object that's serialized and transfered between servers in a cluster environment. For the purpose of this explanation, lets call this class "Person". While in the process of improving the code, this class was moved from "com.acme.Person" to "com.acme.entity.Person". Internally, the class remains exactly the same (same fields, same methods, same everything). The problem is that we have two sets of servers running the old code and the new code at the same time. The servers with the old code have serialized HttpSession object and when the new code unserializes it, it throws a ClassNotFoundException because it can't find the old reference to com.acme.Person. At this point, it's easy to deal with this because we can just recreate the object using the new package. The problem then becomes that the HttpSession in the new servers, will serialize the object with the new reference to com.acme.entity.Person, and when this is unserialized in the servers running the old code, another exception will be thrown. At this point, we can't deal with this exception anymore. What's the best strategy to follow for this kind of cases? Is there a way to tell the new servers to serialize the object with the reference to the old package and unserialize references to the old package to the new one? How would we transition to using the new package and forgetting about the old one once all servers run the new code?

    Read the article

  • Generic applet style system for publishing mathematics demonstrations?

    - by Alex
    Anyone who's tried to study mathematics using online resources will have come across these Java applets that demonstrate a particular mathematical idea. Examples: http://www.math.ucla.edu/~tao/java/Mobius.html http://www.mathcs.org/java/programs/FFT/index.html I love the idea of this interactive approach because I believe it is very helpful in conveying mathematical principles. I'd like to create a system for visually designing and publishing these 'mathlets' such that they can be created by teachers with little programming experience. So in order to create this app, i'll need a GUI and a 'math engine'. I'll probably be working with .NET because thats what I know best and i'd like to start experimenting with F#. Silverlight appeals to me as a presentation framework for this project (im not worried about interoperability right now). So my questions are: does anything like this exist already in full form? are there any GUI frameworks for displaying mathematical objects such as graphs & equations? are there decent open source libraries that exposes a mathematical framework (Math.NET looks good, just wondering if there is anything else out there) is there any existing work on taking mathematical models/demos built with maple/matlab/octave/mathematica etc and publishing them to the web?

    Read the article

  • Silverlight logging out causes "Object reference not set to an instance"

    - by Alex
    I am using the Silverlight 4 Business Application Template. I've created a DomainDataSource in XAML like so: <riaControls:DomainDataSource x:Name="LogData" QueryName="GetLogs" AutoLoad="True" LoadSize="20" > <riaControls:DomainDataSource.DomainContext> <local:AdminDomainContext /> </riaControls:DomainDataSource.DomainContext> <riaControls:DomainDataSource.QueryParameters> <riaControls:Parameter ParameterName="UserLoginID" Value="{Binding Path=User.UserLoginID, Source={StaticResource WebContext}}" /> </riaControls:DomainDataSource.QueryParameters> </riaControls:DomainDataSource> The problem I'm experiencing is that whenever I log out, I get: Load operation failed for query 'GetLogs'. Object reference not set to an instance of an object. I assume that because I've logged out, User.UserLoginID is now null and is causing the exception. So... anybody know a good way for me to solve this? I don't really want to set the QueryParameter programmatically.

    Read the article

  • Change row/column span programatically (tablelayoutpanel)

    - by alex
    I have a tablelayoutpanel. 2x2 - 2 columns 2 rows. For example, I added a button button1 in a 1 row, second column. button1 has a dock property set to Fill. VS Designer allows to set column/row span properties of button1. I want an availability to change row span property of button1 programatically, so it can fill all second column(1 row and second row) and availability to set it back. How ?

    Read the article

  • Reordering fields in Django model

    - by Alex Lebedev
    I want to add few fields to every model in my django application. This time it's created_at, updated_at and notes. Duplicating code for every of 20+ models seems dumb. So, I decided to use abstract base class which would add these fields. The problem is that fields inherited from abstract base class come first in the field list in admin. Declaring field order for every ModelAdmin class is not an option, it's even more duplicate code than with manual field declaration. In my final solution, I modified model constructor to reorder fields in _meta before creating new instance: class MyModel(models.Model): # Service fields notes = my_fields.NotesField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: abstract = True last_fields = ("notes", "created_at", "updated_at") def __init__(self, *args, **kwargs): new_order = [f.name for f in self._meta.fields] for field in self.last_fields: new_order.remove(field) new_order.append(field) self._meta._field_name_cache.sort(key=lambda x: new_order.index(x.name)) super(TwangooModel, self).__init__(*args, **kwargs) class ModelA(MyModel): field1 = models.CharField() field2 = models.CharField() #etc ... It works as intended, but I'm wondering, is there a better way to acheive my goal?

    Read the article

< Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >