Search Results

Search found 308 results on 13 pages for 'joseph'.

Page 10/13 | < Previous Page | 6 7 8 9 10 11 12 13  | Next Page >

  • How to get all words of a string in c#?

    - by Joseph Lafuente
    I have a paragraph in a single string and I'd like to get all the words in that paragraph. My problem is that I don't want the suffixes words that end with punctuation marks such as (',','.',''','"',';',':','!','?') and /n /t etc. I also don't want words with 's and 'm such as world's where it should only return world. In the example he said. "My dog's bone, toy, are missing!" the list should be: he said my dog bone toy are missing

    Read the article

  • iPhone: Using dispatch_after to mimick NSTimer

    - by Joseph Tura
    Don't know a whole lot about blocks. How would you go about mimicking a repeating NSTimer with dispatch_after? My problem is that I want to "pause" a timer when the app moves to the background, but subclassing NSTimer does not seem to work. I tried something which seems to work. I cannot judge its performance implications or whether it could be greatly optimized. Any input is welcome. #import "TimerWithPause.h" @implementation TimerWithPause @synthesize timeInterval; @synthesize userInfo; @synthesize invalid; @synthesize invocation; + (TimerWithPause *)scheduledTimerWithTimeInterval:(NSTimeInterval)aTimeInterval target:(id)aTarget selector:(SEL)aSelector userInfo:(id)aUserInfo repeats:(BOOL)aTimerRepeats { TimerWithPause *timer = [[[TimerWithPause alloc] init] autorelease]; timer.timeInterval = aTimeInterval; NSMethodSignature *signature = [[aTarget class] instanceMethodSignatureForSelector:aSelector]; NSInvocation *aInvocation = [NSInvocation invocationWithMethodSignature:signature]; [aInvocation setSelector:aSelector]; [aInvocation setTarget:aTarget]; [aInvocation setArgument:&timer atIndex:2]; timer.invocation = aInvocation; timer.userInfo = aUserInfo; if (!aTimerRepeats) { timer.invalid = YES; } [timer fireAfterDelay]; return timer; } - (void)fireAfterDelay { dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, self.timeInterval * NSEC_PER_SEC); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_after(delay, queue, ^{ [invocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO]; if (!invalid) { [self fireAfterDelay]; } }); } - (void)invalidate { invalid = YES; [invocation release]; invocation = nil; [userInfo release]; userInfo = nil; } - (void)dealloc { [self invalidate]; [super dealloc]; } @end

    Read the article

  • Wordpress: Sort posts by meta value after AFTER querying from database

    - by Joseph Carrington
    Hello, I am pulling posts from my database by using Wordpress' WP_Query object like so: $shows_query = new WP_Query("category_name=shows&meta_key=band&meta_value=$artist_id"); I have another meta value I would like to sort the posts by, however. The meta key is 'date'. The WP_Query object can no work with multiple meta_keys, so this does not work: $shows_query = new WP_Query("category_name=shows&meta_key=band&meta_value=$artist_id&meta_key=date&orderby=meta_value&order=DESC"); So now I have to figure out a way to sort the posts in $shows_query['posts'] by one of their meta_values, which are not even IN their array. Any other, more sensible approach would also be appreciated.

    Read the article

  • C# Windows Service Access denied when trying to write in a folder

    - by Joseph Ghassan
    Hi guys, I have deployed successfully a C# windows service on a windows 7 machine. Now, when I try to create a file using this code : FileStream os = new FileStream(String.Format(folderName, fileName), FileMode.Create); I get Access to filepath is denied. In the service Installer I set the following parameters to : this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; this.serviceProcessInstaller1.Password = "Pass"; this.serviceProcessInstaller1.Username = "Administrator" I added all the possible accounts with Full permissions to the folder where I want to create the file but nothing helped. Any suggestions would be highly appreciated

    Read the article

  • Flash Animation and Sound Loop

    - by Joseph
    ok so im having an issue with Flash CS5. I have a sound looping, and my animation is only 13 frames long, while the song is like a minute long, so each time the animation loops threw the default "Loop Playback" a new sound audio is played which os overlapping the previous over and over causing a massive echo effect. Whats the best way to loop both of them insync, or atleast copy and paste the animations frames and make it the length of the song?

    Read the article

  • Why can't I pass self as a named argument to an instance method in Python?

    - by Joseph Garvin
    This works: >>> def bar(x, y): ... print x, y ... >>> bar(y=3, x=1) 1 3 And this works: >>> class foo(object): ... def bar(self, x, y): ... print x, y ... >>> z = foo() >>> z.bar(y=3, x=1) 1 3 And even this works: >>> foo.bar(z, y=3, x=1) 1 3 But why doesn't this work? >>> foo.bar(self=z, y=3, x=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unbound method bar() must be called with foo instance as first argument (got nothing instead) This makes metaprogramming more difficult, because it requires special case handling. I'm curious if it's somehow necessary by Python's semantics or just an artifact of implementation.

    Read the article

  • Block facebook from my website

    - by Joseph Szymborski
    I have a secure link direction service I'm running (expiringlinks.co). If I change the headers in php to redirect my visitors, then facebook is able to show a preview of the website I'm redirecting to when users send links to one another via facebook. I wish to avoid this. Right now, I'm using an AJAX call to get the URL and javascript to redirect, but it's causing problems for users who don't use javascript. Here are a number of ways I'd like to block facebook, but I can't seem to get working: I've tried blocking the facebook bot (facebookexternalhit/1.0 and facebookexternalhit/1.1) but it's not working, I don't think they're using them for this functionality. I'm thinking of blocking the facebook IP addresses, but I can't find all of them, and I don't think it'll work unless I get all of them. I've thought of using a CAPTCHA or even a button, but I can't bring myself to do that to my visitors. Not to mention I don't think anyone would use the site. I've searched the facebook docs for meta tags that would "opt-me out", but haven't found one, and doubt that I would trust it if I had. Any creative ideas or any idea how to implement the ones above? Thank you so much in advance!

    Read the article

  • rails, activerecord callbacks not saving

    - by Joseph Silvashy
    I have a model with a callback that runs after_update: after_update :set_state protected def set_state if self.valid? self.state = 'complete' else self.state = 'in_progress' end end But it doesn't actually save those values, why not? Regardless of if the model is valid or not it won't even write anything, even if i remove the if self.valid? condition, I can't seem to save the state. Um, this might sound dumb, do I need to run save on it?

    Read the article

  • No transperancy in Bitmap loading from MemoryStream

    - by Jogi Joseph George
    Please see the C# code. When i am writing a Bitmap to a file and read from the file, i am getting the transperancy correctly. using (Bitmap bmp = new Bitmap(2, 2)) { Color col = Color.FromArgb(1, 2, 3, 4); bmp.SetPixel(0, 0, col); bmp.Save("J.bmp"); } using (Bitmap bmp = new Bitmap("J.bmp")) { Color col = bmp.GetPixel(0, 0); // ------------------------------ // Here col.A is 1. This is right. // ------------------------------ } But if I write the Bitmap to a MemoryStream and read from that MemoryStream, the transperancy has been removed. All Alpha values become 255. MemoryStream ms = new MemoryStream(); using (Bitmap bmp = new Bitmap(2, 2)) { Color col = Color.FromArgb(1, 2, 3, 4); bmp.SetPixel(0, 0, col); bmp.Save(ms, ImageFormat.Bmp); } using (Bitmap bmp = new Bitmap(ms)) { Color col = bmp.GetPixel(0, 0); // ------------------------------ // But here col.A is 255. Why? i am expecting 1 here. // ------------------------------ } I wish to save the Bitmap to a MemoryStream and read it back with transperancy. Could you please help me?

    Read the article

  • how to put jcheckbox to table cell?

    - by joseph
    Hello, I cannot put jChceckBox to jTable cell. More likely I can put checkBox to table, but when I run module with that table, the cell where should be checkBox shows text "true" or "false". The behaviors of that cell are the same like checkbox, but it shows text value instead of checkbox. Here is the code. DefaultTableModel dm = new DefaultTableModel(); dm.setDataVector(new Object[][]{{"dd", "Edit", "Delete"}, {"dd","Edit", "Delete"}}, new Object[]{"Include","Component", "Ekvi"}); jTable1 = new javax.swing.JTable(); jTable1.setModel(dm); JCheckBox chBox=new JCheckBox(); jTable1.getColumn("Include").setCellEditor(new DefaultCellEditor(chBox)); jScrollPane1.setViewportView(jTable1);

    Read the article

  • How to make "Open File..." window in netbeans PLATFORM?

    - by joseph
    Hello, I need to create something like internal frame in netbeans platform, which loads file from any location. I tried it by jInternalFrame, but I was not able to find some container to which I can add my frame. I am working in netbeans platform, which has own pre-created main window. Pease help me by any advice, I am dealing with this about 10 hours, still without result.

    Read the article

  • Drupal : Custom views filter

    - by Joseph
    Hi, First thing I would say is that I am a Drupal newbie. So, I would appreciate your answer in a detailed step by step process. I am using Drupal 6 and location module. There are two main content types - user profile (using content profile module) and event content type. Both have one field for location. Now, lets suppose in his profile, user is selecting city as Toronto and province as Ontario. And some events have been added for Toronto city. I need one Views, which will display events from user city. So, if user is from Vancouver, and they click on "my city events", they will see list of events from their city. Someone told me that I can achieve this using arguments/ relationships, but I don't know how to do that. Can someone please help me out? I am not good at PHP either :(

    Read the article

  • Difficulty determining the file type of text database file

    - by Joseph Silvashy
    So the USDA has some weird database of general nutrition facts about food, and well naturally we're going to steal it for use in our app. But anyhow the format of the lines is like the following: ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 ~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 ~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 ~01004~^~0100~^~Cheese, blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87 With those odd ~ and ^ separating the values, It also lacks a header row but thats ok, I can figure that out from the other stuff on their site: http://www.ars.usda.gov/Services/docs.htm?docid=8964 Any help would be great! If it matters we're making an open/free API with Ruby to query this data. Additionally I'm having a tough time posing this question so I've made it a community wiki so we can all pitch in!

    Read the article

  • Polymorphic associations in CakePHP2

    - by Joseph
    I have 3 models, Page , Course and Content Page and Course contain meta data and Content contains HTML content. Page and Course both hasMany Content Content belongsTo Page and Course To avoid having page_id and course_id fields in Content (because I want this to scale to more than just 2 models) I am looking at using Polymorphic Associations. I started by using the Polymorphic Behavior in the Bakery but it is generating waaay too many SQL queries for my liking and it's also throwing an "Illegal Offset" error which I don't know how to fix (it was written in 2008 and nobody seems to have referred to it recently so perhaps the error is due to it not having been designed for Cake 2?) Anyway, I've found that I can almost do everything I need by hardcoding the associations in the models as such: Page Model CREATE TABLE `pages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created` datetime NOT NULL, `updated` datetime NOT NULL, PRIMARY KEY (`id`) ) <?php class Page extends AppModel { var $name = 'Page'; var $hasMany = array( 'Content' => array( 'className' => 'Content', 'foreignKey' => 'foreign_id', 'conditions' => array('Content.class' => 'Page'), ) ); } ?> Course Model CREATE TABLE `courses` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created` datetime NOT NULL, `updated` datetime NOT NULL, PRIMARY KEY (`id`) ) <?php class Course extends AppModel { var $name = 'Course'; var $hasMany = array( 'Content' => array( 'className' => 'Content', 'foreignKey' => 'foreign_id', 'conditions' => array('Content.class' => 'Course'), ) ); } ?> Content model CREATE TABLE IF NOT EXISTS `contents` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `class` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `foreign_id` int(11) unsigned NOT NULL, `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `content` text COLLATE utf8_unicode_ci NOT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) <?php class Content extends AppModel { var $name = 'Content'; var $belongsTo = array( 'Page' => array( 'foreignKey' => 'foreign_id', 'conditions' => array('Content.class' => 'Page') ), 'Course' => array( 'foreignKey' => 'foreign_id', 'conditions' => array('Content.class' => 'Course') ) ); } ?> The good thing is that $this->Content->find('first') only generates a single SQL query instead of 3 (as was the case with the Polymorphic Behavior) but the problem is that the dataset returned includes both of the belongsTo models, whereas it should only really return the one that exists. Here's how the returned data looks: array( 'Content' => array( 'id' => '1', 'class' => 'Course', 'foreign_id' => '1', 'title' => 'something about this course', 'content' => 'The content here', 'created' => null, 'modified' => null ), 'Page' => array( 'id' => null, 'title' => null, 'slug' => null, 'created' => null, 'updated' => null ), 'Course' => array( 'id' => '1', 'title' => 'Course name', 'slug' => 'name-of-the-course', 'created' => '2012-10-11 00:00:00', 'updated' => '2012-10-11 00:00:00' ) ) I only want it to return one of either Page or Course depending on which one is specified in Content.class UPDATE: Combining the Page and Course models would seem like the obvious solution to this problem but the schemas I have shown above are just shown for the purpose of this question. The actual schemas are actually very different in terms of their fields and the each have a different number of associations with other models too. UPDATE 2 Here is the query that results from running $this->Content->find('first'); : SELECT `Content`.`id`, `Content`.`class`, `Content`.`foreign_id`, `Content`.`title`, `Content`.`slug`, `Content`.`content`, `Content`.`created`, `Content`.`modified`, `Page`.`id`, `Page`.`title`, `Page`.`slug`, `Page`.`created`, `Page`.`updated`, `Course`.`id`, `Course`.`title`, `Course`.`slug`, `Course`.`created`, `Course`.`updated` FROM `cakedb`.`contents` AS `Content` LEFT JOIN `cakedb`.`pages` AS `Page` ON (`Content`.`foreign_id` = `Page`.`id` AND `Content`.`class` = 'Page') LEFT JOIN `cakedb`.`courses` AS `Course` ON (`Content`.`foreign_id` = `Course`.`id` AND `Content`.`class` = 'Course') WHERE 1 = 1 LIMIT 1

    Read the article

  • Bypassing Browser popup blocking when automatic session timout occurs

    - by Joseph
    Hi all, Please help regarding the following issue. I have enabled the "Block popup" option in browser. We are doing a session validation using a background ajax call to check the session is active or not. If the session is not active for a desired interval a popup window will come for notification. Now comming to the problem . since the session notification popup is comming automatically without any client interaction, This popup is blocked by the browser. But if a client clicks anyother popup window in the form that popup window will not be blocked by the browser.

    Read the article

  • how to write own serializer/deserializer?

    - by joseph
    Hello, I need to save objects - instances of classes - in my app like some filetype. How I can write own serializer/deserializer for it? Or exist some easier way how to save objects to some filetype? Using of io.serialization was commented as not so good solution for "real" app. Why?

    Read the article

  • Nested Resource testing RSpec

    - by Joseph DelCioppio
    I have two models: class Solution < ActiveRecord::Base belongs_to :owner, :class_name => "User", :foreign_key => :user_id end class User < ActiveRecord::Base has_many :solutions end with the following routing: map.resources :users, :has_many => :solutions and here is the SolutionsController: class SolutionsController < ApplicationController before_filter :load_user def index @solutions = @user.solutions end private def load_user @user = User.find(params[:user_id]) unless params[:user_id].nil? end end Can anybody help me with writing a test for the index action? So far I have tried the following but it doesn't work: describe SolutionsController do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :owner => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions) get :index, :user_id => @user.id end end And I get the following error: Spec::Mocks::MockExpectationError in 'SolutionsController GET index, when the user owns the software he is viewing should find all of the solutions owned by a user' #<User:0x000000041c53e0> expected :solutions with (any args) once, but received it 0 times Thanks in advance for all the help. Joe

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13  | Next Page >