Posts

boost - C++: thread sync -

i trying synchronize 2 thread (working on same c++ map) using boost library. must tell not expert in c++ , find boost documentation quite hard understand. what want achieve, this: #thread 1 access map put in release access #thread 2 wait until map empty when it's not empty anymore, wake , gain access perform operations on 1 entry of map leave access else i tried use mutex , condition_variables, code not working properly. in specific, when thread2 waking (after waiting cond. variable), not gaining directly access map, there else got access , emptied map. therefore, got segmentation fault, because expecting map full while empty when accessed it. in addition, understand difference between mymutex.lock() , invokations boost::mutex::scoped_lock scopedlock(mutex_) ; or unique_lock . thanks teaching :) edit: here tried extract relevant parts of code. since did not understand how sync works, may not make sense... //common part boost::mutex mutex1; boost::mutex mutex2;...

html - Table beside a floating image -

i'm trying accomplish thought simple, seems when comes css, never know! i have image float left. beside it, have title , under title, still besides image, want display table taking remaining width. in ie , chrome, table ends under image while in ff, takes more 100% (an horizontal scroll bar displayed). ff gives result closer want, don't want scrollbar. here code tried make work using w3school "try it" editor (http://www.w3schools.com/css/tryit.asp?filename=trycss_float) <html> <head> <style type="text/css"> h1{ font-size:1em; } img { float:left; } .field{ width:100% } </style> </head> <body> <img src="logocss.gif" width="95" height="84" /> <div class="content"> <h1>...

xcode - How To Add A Folder Of Images To IKImageBrowserView -

how add folder of images displayed in ikimagebrowserview? thanks check out ikimagebrowserview class reference , there find imagekitdemo . example shows how add photos ikimagebrowserview using directories

activerecord - Rails 3: how to write DRYer scopes -

i'm finding myself writing similar code in 2 places, once define (virtual) boolean attribute on model, , once define scope find records match condition. in essence, scope :something, where(some_complex_conditions) def something? some_complex_conditions end a simple example: i'm modelling club membership; member pays fee , valid in year . class member < activerecord::base has_many :payments has_many :fees, :through => :payments scope :current, joins(:fees).merge(fee.current) def current? fees.current.exists? end end class fee < activerecord::base has_many :payments has_many :members, :through => :payments scope :current, where(:year => time.now.year) def current? year == time.now.year end end is there dryer way write scopes make use of virtual attributes (or, alternatively, determine whether model matched conditions of scope)? i'm pretty new rails please point out if i'm doing stupid! no, there...

c# - How can I generate Service Model Metadata without rebooting -

i have simple wcf service application (based on tutorial : getting started ). problem when add function application , want re-generate proxy.cs file using command below: c:\kod>svcutil.exe /language:cs /out:proxy.cs /config:app.config http://localhos t:8000/pbmb i following result. solution know re-generate files reboot computer. doing every time change frustrating. can help? result: microsoft (r) service model metadata tool [microsoft (r) windows (r) communication foundation, version 4.0.30319.1] copyright (c) microsoft corporation. rights reserved. attempting download metadata ' http://localhost:8000/pbmb ' using ws-metad ata exchange or disco. error: cannot import wsdl:porttype detail: exception thrown while running wsdl import extension: system.se rvicemodel.description.datacontractserializermessagecontractimporter error: schema target namespace ' http://pbmb ' not found. xpath error source: //wsdl:definitions[@t...

Removing an element permanently in jQuery -

when append element , afterwards remove object still exists? bg = $('<div class="dialog_bg"></div>'); $('#'+elm).append(bg); bg.remove(); how that? isn't possible remove element permanently? so element removed dom completely. that's fine. question how ensure element removed. i'd use .parent() method that. because if element removed dom won't have parent anymore. may faster $("html").has(bg) because doesn't have traverse whole dom tree. bg = $('<div class="dialog_bg"></div>'); $('#'+elm).append(bg); bg.remove(); if(bg.parent().length == 0) { // removed succesfully } else { // still somewhere in dom } // tells garbage collector free memory because there's no way access element anymore bg = null;

javascript - Is there a JS equivalent to CSS text-transform: capitalize? -

i've got hidden <section /> comprised of divs contain content stuffed jquery ui dialog. on document.ready want loop through divs, take id of each respective div, replace dashes spaces, capitalize each word, , store in title variable. then, i'm going use in object literal gets put dialogs[] array. sounds simple, right? stripped down version of html: <section id="dialog-content" class="hidden"> <div id="some-dialog"> // awesome dialog content here </div> <div id="another-dialog"> // awesome dialog content here </div> <div id="modal-dialog"> // awesome dialog content here </div> </section> stripped down version of javascript: var dialogs = [], $container = $("#dialog-content"); $content = $container.find("> div"); $content.each(function (i) { var $this = $(this), ...