Posts

c++ - Fast lock for variables that are read a lot and may be changed from another thread occasionaly -

i'm looking lock, allows thread-safe transition between gui , back-end. just double, i'm sure end being used other things. now part i'm unsure of, on modern cpus, can reading , writing @ same time cause race condition? or when 2 threads try write @ same time. i've encapsulated variables cross threads with, in template object, allows me same use requires locking, here basics: //===================================================================================================== // class store variable in thread safe manner. //===================================================================================================== template <class t> class threadsafevariable { public: threadsafevariable(const t & variable): _stored_variable(variable) { } threadsafevariable(): _stored_variable() { } //===================================================================================================== /// returns stored variable ...

java - Generic method of converting SQLite BLOB to byte array (POJO) -

i working third party sqlite database. has blob column may contain image, video or audio file. of course, there column specifies mime type of blob. question is, there generic way of converting blob byte array , byte array blob. have seen tons of examples around web specific images. looking generic method of working blob regardless of it's type. note: know not idea save these types of files in db in case have no choice. the android database api used byte arrays represent blobs; no conversion needed.

Creating a table dynamically in Android app just like you would create one in Ms word - Java -

Image
i have searched keywords possible next looking for. well, wasn't lucky enough find it, here now, what's question? question is, possible create table in android app dynamically, have textviews columns have rows editable (edittext), when want user fill-in table. appreciate advice/guidance/help on this. like one:

c++ - SDL_Image return NULL when trying to load texture -

i have model loaded screen, having trouble getting it's texture read. whenever try load model's texture, returns null. model , texture resides within same directory, can't figure out why program having problems. while program runs, error receive img_geterror() is: couldn't open (location)/image.jpg here how loading: bool ctexture::load() { surface = img_load(_filename.c_str()); glenable(gl_texture_2d); glgentextures(1, &_textureobj); if (surface == null) { std::cout << "---------------\n" << img_geterror() << "\n---------------\n" << std::endl; return 0; } _width = surface->w; _height = surface->h; _bpp = surface->pitch; if (surface->format->bytesperpixel == 3) _mode = gl_rgb; else if (surface->format->bitsperpixel == 4) _mode = gl_rgba; else { sdl_freesu...

php - Why does my WPDB enquiry on test server work but not on the live server? -

i using wordpress output ads on non wordpress page. html on non wordpress test server page is: <?php require('/home/mcreativ/public_html/parts/imagerotator/wp-load.php'); echo init_ads(); ?> on test server have code in functions file , post type custom post type have created call manufacturer: function init_ads() { echo $_server['document_root']; $serial = $_get["serial"]; // args query $args = array( 'numberposts' => -1, 'post_type' => 'manufacturer', 'meta_key' => 'smashing_post_class', 'meta_value' => $serial ); $the_query = new wp_query( $args ); $the_query->the_post(); $meta= get_post_meta( get_the_id(), 'ad_rotator_group', true); wp_reset_query(); // restore global post data stomped the_post(). echo adrotate_group($meta); } and on test url http://www.m1creative.org/noword/index.php?serial=57 ...

java - How to "hide" a JFrame using a JButton outside the main -

so i've completed project, last thing being "hide" button. teacher never gave instruction on do, since it's annoying me , can't find answer works, figured i'd ask folks. i've tried: setextendedstate(jframe.iconified) //causes compiler error, can't find variable name setstate(jframe.iconified) //same issue, "can't find symbol", or rather find variable setvisible(false) //this doesn't work bc hides entire frame, , can't without closing program. i use container c = getcontentpane() create pane, inside main use: classname variablename = new classname() create parameters. this how taught , have use way now(since teacher wants) have noticed there other ways achieve same goal. any input specific program awesome! thanks! my program follows(i posted whole thing nothing may left out): import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.arrays; public class project9 extends jframe {...

html - How to create parallax effect like this? -

i've been trying build website parallax effect 1 on website: http://www.sparksandhoney.com/the-open-agency-index/ or http://www.sparksandhoney.com/press-index/ i've been trying use stellar.js, can't seem make nav bar , web page scroll in sync on image website. far i've been trying make nav bar , text layer 1 div scrolls on fixed background not working @ all? by way, i've gone through websites source code, , use squarespace, i'm trying effect without it. does have ideas? it's super simple. nav , content containers in flow. content has margin-top separate nav. background image set position: fixed , , on scroll offset percentage of scroll position (eg, 30%). you don't need libraries, jquery makes easier. considering stellar.js requires jquery, assume don't have problem using it. in case, following code enough working you: $(window).on('scroll', function() { $('#background').css('margin-top', $(window)...