Posts

Showing posts from June, 2013

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)

ios - AFNetworking JSONRequestSerializer POST requestWithMethod Newb Example -

i'm trying json post request (to create new user) ios app cloud back-end rest api using afnetworking. in view controller, i'm doing, afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; nsstring *urlstring = api_base_url; nsdictionary *parameters = @{@"username": self.usernametextfield.text, @"password": self.passwordtextfield.text}; manager.requestserializer = [[afjsonrequestserializer serializer] requestwithmethod:@"post" urlstring:urlstring parameters:parameters error:nil]; i've reviewed the docs , so post , , r.wenderlich tutorial, frankenstein-ing skills running out. the compiler complains about incompatible pointer types assigning 'afhttprequestserializer<afurlrequestserialization> *' 'nsmutableurlrequest *' has got pointer working example of or guidance on might wrong code. specifically, how initiate action callback? try this: af

python - Monitor file for an append and perform some action after the append is done -

wi've created 2 separate scripts crawl, scrape , save results csv file , upload file dropbox run manually. want monitor csv file while performing append operation , upload file once append operation over. can throw me idea or examples i'm new this. saw package named watchdog couldn't figure out how use it. watchdog simple use. i've written sample code here, , monitor change on *.csv file. set path before using it... simple ./ works: import time watchdog.observers import observer watchdog.events import patternmatchingeventhandler class changehandler(patternmatchingeventhandler): patterns = ["*.csv"] # handle csv files def __init__(self): super(changehandler, self).__init__() def process(self, event): ''' event.event_type: type of event string. event.src_path: source path of file system object triggered event event.is_directory: true if event emitted

sql server - how to connect to mssql using php mssql() -

there sample code below connect mysql <?php $dbh = new pdo('mysql:host=localhost;dbname=register', 'root', '12345'); $stmt = $dbh->prepare("insert registered(name, email, password) values (?,?,?)"); $stmt->bindparam(1, $name); $stmt->bindparam(2, $email); $stmt->bindparam(3, $pwd); $name = $_post["fname"]; $email = $_post["email"]; $pwd = $_post["pwd"]; $stmt->execute(); echo "<p>thank registering!</p>"; ?> but need similar code in above connect " mssql " database using mssql() function examle refer http://www.wikihow.com/create-a-secure-login-script-in-php-and-mysql in above link there connect mysql without pdo

java - TableView items are not removed but do not respond -

Image
firstly, working on windows 7, netbeans 8, jdk 8. have tableview containing pojo objects (not using properties). trying implement " search while typing " strange happens. in image can see students being displayed: in next picture after search done can see problem. first 4 students actual search results , clickable active entries in tableview . others entries visible not responding, instead should have been removed completely. how works (coding part) : 1. when users types 'f' function called. 2. in function create new list contain search results: observablelist<student> subentries = fxcollections.observablearraylist(); 3. add items matching criteria of search in subentries list 4. call: 5. studentstable.setitems(subentries); erroneous result shown in picture 2. hacks tried: 1. randombutton.fire(); 2. columnsofthetable.get(0).setvisible(false); columnsofthetable.get(0).setvisible(true); the above don't work. appreciated.

gcc - How to install g++ on FreeBSD? -

on server freebsd 10.0 following error: # make /usr/bin/g++ crypto.cpp md4.cpp rsalib1.cpp base64.cpp cmdbase.cpp signer.cpp wmsigner.cpp -o wmsigner make: exec(/usr/bin/g++) failed (no such file or directory) *** error code 1 stop. make: stopped in /tmp/wmsigner-2.0.3 /usr/bin/g++ doesn't exist, how install it/fix this? gcc still available in freebsd, under ports. install latest version (as of writing, 4.9) port, following: cd /usr/ports/lang/gcc49/ && make install clean if want install package, following: pkg install lang/gcc49 this install c, c++, fortran , java front ends gcc49 , g++49 , gfortran49 , , gcj49 , respectively.

syntax - How to echo php variable from array? -

i need echo this: echo "<a href="#">$some['variable']</a> how can escape [] brackets echo variable in link? echo "<a href='#'>" . $some['variable'] . "</a>"; or echo "<a href=\"#\">" . $some['variable'] . "</a>"; or echo "<a href='#'>{$some['variable']}</a>";

rust - Option<T> where T can be two different traits? -

if have 2 different traits: trait foo {} trait bar {} is possible have option can either of them (or none, of course), like: struct foobar { fb: option<~foo or bar> } let fb1 = foobar{fb: some(~somestruct ~foo)} let fb2 = foobar{fb: some(~otherstruct ~bar)} and have them both work? there nothing special option<t> ; this, plus convenience methods , bit of documentation: pub enum option<t> { some(t), none, } bear in mind: it's enums way. can make own enums. explicit, learn appreciate thing. pub enum fooorbar { foo(~foo), bar(~bar), } you can make option<t> of this . or perhaps prefer blend two, if can better semantic meaning out of it: pub enum { foozy(~foo), bark(~bar), adifferentvariant, }

java - Referencing another class in an Enum class -

i've created enum class manage various systems in code, however, need access class in order complete code. i've tried referencing code so: public newskillsmain plugin = newskillsmain.this; however returns error: no enclosing instance of type newskillsmain accessible in scope does know how reference other classes enum class? thanks!

datatable - Data Table Error :: Cannot read property 'fnSetData' of undefined -

initial code looks this.. var otable = $('#sim_data').datatable( { aocolumns: [ {"sname": "ss" },{"sname": "sim_no"}, {"sname": "sale_price"}, {"sname": "purchased_price"},{"sname": "status"} ] }).makeeditable({ ..... }); only when try initialize aocolumns above returns error cannot read property 'fnsetdata' of undefined and out initialization works i had same problem today. make sure number of elements in "aocolumns" matches number of columns have in table. in case, problem.

java - Storing and getting values from sharedpreferences in android -

i want store values in sharedpreferences , getting values sharedpreferences display values in listview. next want remove values list when click on longpress on specific value .after removing values status updated in sharedpreferences. done 1 problem when close application , open again have display sharedpreferences vales in listview. display nullpointerexeption , actually requirement 1)storing values in sharedpreferences , display values in listview every click .allowed 5 values.and list values available in onresume() method also. 2) when long press on specific value of listview have remove , and updated values stored in sharedpreferences also. my code public class listviewdemo1 extends activity { /** * called when activity first created. */ button btn; static int count; private listview list; public static arraylist<string> values = new arraylist<string>(); arraylist countlist = new arraylist(); private arrayadapter

com - Write DirectShow Filter Without Using Windows SDK -

i wanna write "driectshow source filter" using webcam. but know way not using "windows sdk" ? yes, possible create directshow filter without using windows sdk base classes. filter nothing com class implementing set of com interfaces, of mandatory ( ibasefilter , ipin ) , other optional. sdk baseclasses helpers give quick start if want fresh - it's absolutely possible.

javafx - Disabling Button while TextFields empty not working -

booleanbinding bb = new booleanbinding() { { super.bind(addnum.textproperty(),addt1.textproperty(),addt2.textproperty(), addt3.textproperty(),addasg.textproperty(),addatt.textproperty()); } @override protected boolean computevalue() { return (addnum.gettext().isempty() && addt1.gettext().isempty() && addt2.gettext().isempty() && addt3.gettext().isempty() && addasg.gettext().isempty() && addatt.gettext().isempty()); } }; final button b2 = new button("add"); b2.disableproperty().bind(bb); this code disable button when textfields empty, button becomes active when textfield filled. code not working. when 1 textfield filled button becomes active. had used code @ other parts of project same purpose add working fine there. why not working here ? if want button active if , if fields filled (i.e. not empty), using wrong operator. use || inste

jquery - How to show autocomplete list in tabular format with multiple column? -

i have autocomplete function on textbox.i want show more data in tabular format new column. my code till : <script type="text/javascript"> function cno(sender, args) { $(function () { $("#<%=txtcno.clientid %>").autocomplete({ source: function (request, response) { $.ajax({ url: '<%=resolveurl("~/webservice.asmx/gettxtcno") %>', data: "{ 'prefix': '" + request.term + "'}", datatype: "json", type: "post", async: false, mustmatch: true, contenttype: "application/json; charset=utf-8", success: function (data) { response($.map(data.d, function (item) { re

c# - UdpClient Error 10022 An invalid argument was supplied -

i need send packet via udp. in project getting error on first line: udpclient udpclient = new udpclient(); it constructor dont know why giving me error: an invalid argument supplied

Which AsyncTask should I use behind SERIAL_EXECUTOR in Android -

i retrieving created data in user controls. , there 3 spinners using serial_executor execute 1 one. now, issue that, 1 spinner retrieves data based on spinner . asynctask executor should use spinner can load data although serial_executor going on. in short, want know asynctask should use execute task though serial_executor in process. if want execute asynctask parallel 1 can use thread_pool_executor this: asynctask task = new someasynctask(); task.executeonexecutor(asynctask.thread_pool_executor); but warn might not work might like. if asynctasks executing perform quite bit of work on own executing them in parallel slow them down considerably. if possible, try execute tasks serially, execute in parallel if absolutely have to. if need load data dependent on other kind of data consider doing in 1 big asynctask instead of splitting work to asynctasks . try keep amount of asynctasks or threads minimum. fewer have faster app load.

php - YII framework Create A Contact Form To Send Mail To Email Id Of Another Model's Entry -

i have form store values model add having rows id name description , 1 email store email particular entry. now want contact form send mail particular model values... that send mail owner of particular add.. i able reuse contact form purpose fail fetch saved email id each add viewer can mail adds.. how achive task?? please me someone.. let me know how can this?? if example code useful me.. thank you..... search db if there matching email address in contact form processing controller $model = contacts::model()->findbyattributes( 'email'=>$_post['contactform']['email_address']) if (!is_null($model)) ... send mail ... else yii::app()->user->setflash('error','that email address not registered');

java - How can I make background music for android project -

Image
i'm making small android app image below: i have sound button. want background music play across activity , when click on sound button, music stop. or click play music again. i dont know how make it. please me! or give me link refer. i'd gladly appreciate thanks! in order media played in background of app location when user interacting must start service application's main activity , service shall contain methods related playback. allow activity interact service, service connection required. in short, need implement bounded service. refer http://www.codeproject.com/articles/258176/adding-background-music-to-android-app

c# - Simple .NET file system persistence? -

i need store simple data (just poco objects few attributes, nothing fancy). public class mypoco { public int id {get; set;} public string title {get; set;} public string email {get; set;} // ... } basically, @ point of web application need check if mypoco object persisted (matching id ), , if it's not, persist it. that's need. it can't database, xml or json . what's easy way (or nuget package) store it? i suggest use in-process database sql server ce or sqlite o/r mapper. easier , more maintainable reinventing small database.

Google Sheets not showing custom function in autocomplete -

i can't google sheets autocomplete show custom function when use google's version (see below). have jsdoc info correctly formatted, still doesn't show up. i'm sure i'm overlooking stupid, can't find it. missing? google's demo code: /** * multiplies input value 2. * * @param {number} input value multiply. * @customfunction */ function double(input) { return input * 2; } btw, i'm using chrome develop custom functions. also, function works, no autocomplete. built-in functions autocomplete works. thanks in advance help! brad i managed custom function autocomplete working yesterday. seems work container-bound scripts, jsdoc info inside script being used library not come across. verify works, did following: create new google sheet open script editor enter following in script: /** * returns amount multiplied itself. * * @param {number} amount amount multiplied itself. * @return {number} amount multiplied itself. *

list - C# Crafting Logic -

there many similar questions none definitive answer. using unity3d engine create game. have set inventory system methods add items, remove items , check if inventory contains amount of item. what want on every update, loop through items , if player has required items crafting recipe, show add button list player can click on craft new item. i thought use dictionary store items , quantities needed. this: public static dictionary<string, int> sword = new dictionary<string, int>() { {"stone", 2}, {"wood", 1} }; public static dictionary<string, int> plank = new dictionary<string, int>() { {"wood", 5} }; but need way store of recipes , loop through them. dictionary of dictionaries. loop through of crafting item names. can similar this? public static dictionary<string, dictionary> recipes = new dictionary<string, int>() { {"wood sword", sword}, {"wood

html - Retrieve post value from php of dropdown select upon page -

i have drop down select inside of form on page nice.php submitted using button <form action="nice.php" method="post"> <select name="carlist"> <option value="0"> - select car - </option> <option value="am">aston martin</option> <option value="kg">koenigsegg</option> <option value="mb">mercedes benz</option> </select> <input type="submit"> </form> after making selection possible submit form, reload same page value dropdown php variable $selectedcar ? if(!empty($_post['carlist'])){ $selectedcar = $_post['carlist']; echo $selectedcar; }else{ echo '<p>no selection has been made , submitted yet</p>'; }

I am stuck with this javascript/jquery code -

http://jsfiddle.net/ytjcl/ so, here code jsfiddle.net $(".scroll").click(function(event){ event.preventdefault(); //calculate destination place var dest=0; if($(this.hash).offset().top > $(document).height()-$(window).height()){ dest=$(document).height()-$(window).height(); }else{ dest=$(this.hash).offset().top; } //go destination $('html,body').animate({scrolltop:dest}, 1000,'swing'); }); here problem, on jsfiddle, code works fine without problems. when try , plugging text editor , run it, developer tools gave warning stating "top" undefined--yet works fine in jsfiddle. anyone know why so? ::edit:: here what's in <head> <script src="ajax.googleapis.com/ajax/libs/jquery-1.11.0.js"></script> <script src="bootstrap.min.js"></script> <meta charset="utf-8"> <meta http-equiv=

networking - Send file from Client to Server in python -

i sending file client server in python. i've wrote python script. i want store file @ receiver side same filename sent sender. suppose sending file "first.txt" . @ receiver side saving file name file_1.txt . instead of file_1.txt, want original name first.txt. 1 more thing, if i'm sending file after first.txt, overwriting previous file @ receiver. i'm not getting idea how solve problem.please me. server code (receiver) import socket import shutil s = socket.socket(socket.af_inet, socket.sock_stream) host = '' port = 31401 s.bind((host, port)) s.listen(3) conn, addr = s.accept() print 'conn @ address',addr conn.sendall('ready') i=1 f = open(r'file_'+ str(i)+".txt",'wb') i=i+1 fsize=int(conn.recv(8)) print 'file size',fsize sfile = conn.makefile("rb") shutil.copyfileobj(sfile, f) sfile.close() f.write(conn.recv(fsize)) f.close() conn.close() s.clos

ios - Display UIview controller as a subview using storyboard IOS7 -

in application have uiview object in second view controller. want display uiview popup or sub view when click button first view controller. please tell me how this? have seen many solution nib files didn't find storyboard. i have connected iboulet of view in second view controller. @property (strong, nonatomic) iboutlet uiview *popview; and have imported second view controller in firstview please tell me how make 1 have been stuck here long time please me out on one. thanks. in firstviewcontroller has uiview *popview : - (void)viewdidload { [super viewdidload]; // don't want show popview self.popview.alpha = 0; } - (void) showpopview { //you want show popview self.popview.alpha = 1; }

oracle - How to show all value of a single column into a single row in pl/sql report? -

i trying show single column single row in pl/sql report. want item ----- itme1 item2 item4 item5 to item ----- item1,item2,item3, item4, item5 i have used following code function cf_hs_descformula return char v_items varchar2(600); begin v_items:=:hs_desc; if v_items not null v_items:=v_items||','; end if; return v_items; end; but not working. please tell me how can that? you can use listagg in oracle: select listagg(name, ', ') within group (order name) "name_list" table1;

php - Drupal 7 Unable to remove/update uploaded file in content type -

i have created content type "product" , want possible attach pdf nodes of content type visitors download, created custom field "download" on content type. the type , widget of field both "file" , in admin have possibility upload / remove file... or @ least, seems so. uploading pdf not problem, added node. if later try remove file - no can't do. can press "remove" button in admin section, , press "save", doesn't give me error , "download" field still empty. if refresh page - bam! there file again. if both remove action , uploading new file @ same time, again; can press "save", doesn't give me error , filename in "download" field name of new file. new file uploaded. again - after refreshing page, original, first file back. i chmodded /files/ directory 777 testing purposes, doesn't solve issue. else clue ? maybe can find clues in logs, don't see related problem @ /admin/r

javascript - How to calculate Fetching Time while fetching data from any Api in Ajax -

i want show amount of data fetched api. output should 10% fetched 90 % remaining that. i'm searching how should calculate amount amount retreived , remaning data left fetched. i have been working on basecamp api waste lots of time fetch tasks , activities etc. want want show time left while fetching in ajax . i have googled , found link: monitoring_progress if body suggest me start appreciate. as far know there no way exact time, can approximation. why can't have exact time ? most of time spent in basecamp servers, not in request. link posted offers way basecamp push progress messages. if don't so, nothing. you can imagine basecamp servers wall. behind wall progress, can't see behind wall , not allowed basecamp climb it. ? you can approximate time. method similar posted here: var ajaxtime= new date().gettime(); $.ajax({ type: "post", url: "some.php", }).done(function () { var total

html - Flex iframe doesn't stretch in IE11 -

the following iframe flex item , supposed stretch , fill available space: <!doctype html> <html> <head> <meta charset="utf-8"> <title>flex iframe</title> <style> body { display: flex; margin: 0; height: 100vh; } span { background: green; } iframe { background: tan; } </style> </head> <body> <span>hello, world!</span> <iframe></iframe> </body> </html> but in ie11 doesn't right: demo is bug? what's cross-browser solution? that's easy: iframe { min-height: 100%; } demo

javascript - jQuery "chosen": conflict with 'selected' attribute in option tag -

i'm having trouble getting jquery snippet work due 'conflict' jquery plugin 'chosen' . i'm using wordpress in case matters. i want set selected attribute in several <option> tags, using jquery( document ).ready(function() { var arr = ["1", "2"]; jquery("#location option").each(function () { if (jquery.inarray(jquery(this).val(), arr) != -1) { jquery(this).prop('selected', true); }; }); }); html output <select name="location[]" multiple="multiple" id="location" class="postform" style="display: none;"> <option value="-1">select location</option> <option class="level-0" value="1">location a</option> <option class="level-0" value="2">location b</option> <option class="level-0" value="3">location

Java API for running UIMA Ruta scripts -

i new uima ruta. made annotators using scripting language. able run them within eclipseide. want write java api automatically run scripts on input provided. i using same example project provided in uima documentation. so far have been able this try { file taedescriptor = null; file inputdir = null; // read , validate command line arguments boolean validargs = false; if (args.length == 2) { taedescriptor = new file(args[0]); inputdir = new file(args[1]); validargs = taedescriptor.exists() && !taedescriptor.isdirectory() && inputdir.isdirectory(); } if (!validargs) { printusagemessage(); } else { // resource specifier xml file xmlinputsource in = new xmlinputsource(taedescriptor); resourcespecifier specifier = uimaframework.getxmlparser() .parseresourc

ios - How to detect Push notification when app is open -

this question has answer here: get push notification while app in foreground ios 12 answers in application have used push notification service problem when close app @ time notification appears when open application , send notification notification not come. please me. you can easily handle function mentioned below in appdelegate.m ---implement application:didreceiveremotenotification: example:- - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { uiapplicationstate appstate = [application applicationstate]; if (appstate == uiapplicationstateactive) { uialertview *alertvw = [[[uialertview alloc] initwithtitle:@"notify" message:yourmessage delegate:self cancelbuttontitle:@"done" otherbuttontitles: @"vizllx", nil] autorelease]; [aler

ios - Merge paid app and free app with in app purchase -

i have 2 application on appstore free app in app purchase. paid app. now, want keep 1 app on appstore above options 1.free app in app purchase , remove paid app. here want give app full functionality user used paid app (purchased paid app). here question how can merge these 2 app single app free , contains in app purchase keeping paid app user ? if have idea regarding please share. thanks in advance. i solved problem using icloud. first provided update both application doing following changes. i used "key value store" icloud option , stored setting on icloud need make sure here "icloud key-value store" value in .entitlements file (which automatically created xcode) in both application same both application. setting stored here accessible both application , depending on setting identified user , gave access specific functionality.

Swap positions of Radios - Android java -

i got 1 radiogroup 4 radios. radiogroup rg = (radiogroup) findviewbyid(r.id.radiogroup); radiobutton r0 = (radiobutton) findviewbyid(r.id.radio0); radiobutton r1 = (radiobutton) findviewbyid(r.id.radio1); radiobutton r2 = (radiobutton) findviewbyid(r.id.radio2); radiobutton r3 = (radiobutton) findviewbyid(r.id.radio3); i set text of them. r0.settext("1"); r1.settext("2"); r2.settext("3"); r3.settext("4"); so got radios 1, 2, 3, 4. how can randomly swap positions of radios. want 3,2,1,4 or 2,3,1,4....etc... important don't want change text of radios, said want positions swapped. i don't think can achieve using same layout xml file. use 4 different layouts, , inflate randomly. all ids work if keep same in each xml file. @override public void oncreate(final bundle bundle) { super.oncreate(bundle); setcontentview(randomlayout()); radiogroup rg = (radiogroup) findviewbyid(r

.net - Crash of my command line tool when it tries to access some Console Cursor related properties -

i'm trying retrieve standard output little command line tool wrote (in .net too) starting process this . it works except if command line tool tries retrieve console.cursortop property, or tries set console.cursorvisible property. in cases, crashes. i don't understand why happening, other methods or properties of console might work theses don't. there kind of hidden cursor object in console never initialized if started way? this tool works fine if launch explorer or if run in cmd. could explain me why happens , how can prevent it? thanks.

sql - how to fetch this data in one query? -

i want fetch data in simple query i use select user_id , order_id product order_id = 3 group user_id , order_id ; but result 1 row group example input: #user_id #order_id 1 2 1 3 2 3 2 4 3 1 3 4 3 5 4 1 4 3 4 12 4 6 5 4 where order_id = 4 then output : #user_id #order_id 2 3 2 **4** 3 1 3 **4** 3 5 5 **4** try this: select p2.user_id, p2.order_id product p1 inner join product p2 on p1.userid = p2.userid p1.order_id = 4 this should effective way data. if slow you, should create proper indexes on product table. also note work specifying 1 single order_id , need adjustments more order_id s ( distinct , specific) , bigger difference selecting userid.

ado.net - How do I get unique Linq-to-Entities results when there is no primary key? -

Image
i have entity model of oracle data source on have no control. using model query particular view see volume price breaks given product: as can see, view has no primary key. here linq using: var db = getoracledatacontext(); var result = db.itempricebreaks_v.where(p => p.stockno == stockid).tolist(); this works degree, instead of returning 4 distinct records own quantities , pricing, returns 4 identical records, each pricing , quantities of first record ($4800, 0, 2). i have no control on view. there way can structure linq query can 4 distinct values? select fields care , use distinct(). example: var result = db.itempricebreaks_v .where(p => p.stockno == stockid) .select(p => p.price) .distinct() .tolist(); however, i'd recommend, along other commenters, primary key involved.

ios - How can I replace selected customTableCellA with customTableCellB -

how can replace selected customtablecella customtablecellb i have table view working customtablecellas i want replace customtablecella customtablecellb when selected. customtablecellb 50 pixels taller customtablecella how can implement properly? try this, create @property array nsmutablearray *selectedindexpatharray , instantiate in viewdidload , - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { cgfloat cellheight = //customtablecella height if ([self.selectedindexpatharray containsobject:indexpath]) { cellheight = //customtablecellb height } else { cellheight = //customtablecella height } } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { ... if ([self.selectedindexpatharray containsobject:indexpath]) { //load customtablecellb } else { //load customtablecella } //other code ... }

java - Opengl Rendering - Anything outside of the z range -1 to 1 doesn't appear? -

anything render outside of range 1 -1 (in z-range) doesn't appear on screen. i've been trying everything, including using different matrices try transform vertices outside of 1 -1 range nothing seems work. i'll put code in below. consists of model class data stored, shader program(which won't include - pretty simple) , main class. vertex shader #version 330 core in vec4 in_position; in vec4 in_color; out vec4 pass_color; void main(void) { gl_position = in_position; pass_color = in_color; } fragment shader #version 330 core in vec4 pass_color; out vec4 out_color; void main(void) { out_color = pass_color; } model class package util; import static org.lwjgl.opengl.gl11.*; import static org.lwjgl.opengl.gl15.*; import static org.lwjgl.opengl.gl30.*; import static org.lwjgl.opengl.gl20.*; import java.nio.bytebuffer; import java.nio.floatbuffer; public class model { // vertex array id int vaoid; // vbo id's int vbovertexid, vbocolorid, vboin

c# - Pull information from partialview into final partialview before submit? -

i have form uses partialviews load different sections. when information filled out show on final partialview give confirmation page before submission. how grab information entered on 1 partialview , display submit on final? my partialview code looks this: @using (ajax.beginform("primaryapplicant", new ajaxoptions { httpmethod = "post", insertionmode = insertionmode.replace, updatetargetid = "step3", onsuccess = "showstep3" })) { <h4>primary applicant information</h4> @html.antiforgerytoken() @html.validationsummary(true) <hr/> <div class="form-group"> @html.labelfor(m => m.firstname, new { @class = "col-md-3 control-label" }) <div class="col-md-9"> <div class="col-md-4"> @html.textboxfor(m => m.firstname, new { @class = "form-control", placeholder = "first name" }) </div> <div class=&

android - App not supported on some devices -

my app doesn't support specific android device (samsung galaxy tab 3 10.1 p5210), though supports other 10 inch tablets. clueless why happening. reason? the client has above mentioned tablet , app doesn't listed on store. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:versioncode="8" android:versionname="1.7" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <permission android:name="com.example.app.permission.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="com.example.app.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="a