Posts

Showing posts from February, 2010

javascript - Get/Set value of field in PageBlockTable -

i have pageblocktable in visualforce page, in table allowing users via jquery .sortable rearrange order of rows. no, want store sorting on page save, have created new parameter on product in salesforce called sort_order number field. i update field, in table , hidden each time rows dragged, on save stored. i have following code, trying loop through table , update fields appropriatley, can't work out jquery syntax setting value of field. here code creates table: <apex:pageblock title="selected {!$objecttype.product2.labelplural}" id="selected"> <apex:variable value="{!1}" var="index"> <apex:pageblocktable value="{!shoppingcart}" var="s" id="shopping_cart" rowclasses="cartrow"> <tr data-sfid="{!index}"> <apex:column headervalue="{!$objecttype.opportunitylineitem.fields.description.la

recursively adding files in perforce with python -

i'm building python script supposed recursively add files 3 subdirs in perforce , submit them. here's how looks: wksp = "myworkspace" subprocess.popen("dir /b /s /a-d | p4 -c " + wksp + " -x - add") here error trace: traceback (most recent call last): file "v2_pep8.py", line 286, in <module> p4() file "v2_pep8.py", line 226, in p4 subprocess.popen("dir /b /s /a-d | p4 -c " + wksp + " -x - add") file "c:\programs\python\app\lib\subprocess.py", line 711, in __init__ errread, errwrite) file "c:\programs\python\app\lib\subprocess.py", line 948, in _execute_child startupinfo) windowserror: [error 2] system cannot find file specified if print out entire command , paste command line works, reason when script executes via subprocess.popen doesn't. the problem subprocess.popen expects invoke process . there no dir executable; it's comm

c# - Is it okay to store access tokens on clients computer when using AuthenticationContext from ADAL -

i building wpf application , using authenticationcontext adal @ each startup right , cache access tokens in way not having prompt user each time application start. i given refresh tokens , access tokens. not sure if accepable serialize them on disk application. there should aware of? working adal, there build in helping me serialize/deserialize context , @ startup. (only found deserialize on authenticationresult sofar). you can creating own custom cache. vittorio talks here . scroll down "dude, own" section. and sample code references uses credential manager available here . you use as-is based on you've described.

Google Cast - Receiver Unavailable -

i'm trying simple "hello, world!" style app run new chromecast sdk. here's step-by-step i'm following: https://developers.google.com/cast/docs/chrome_sender to achieve minimal setup, i'm attempting wire via chrome app (app, not extension) sender, , using chrome.cast.media.default_media_receiver_app_id appid (as mentioned in tutorial). it seems fall apart somewhere between initialization , launch. call chrome.cast.initialize succeeds, when receiverlistener gets invoked, result "unavailable". if attempt call chrome.cast.requestsession, invokes error handler error code of "receiver_unavailable". a few things: i've paid $5 google developer account , registered device note: applications list still empty, problem? i've reconfigured chromecast device send serial number when retrieving updates i've rebooted chromecast several times (from android app) the chromecast idle on-screen landscapes flashing beautifully m

python - Incrementing Counter in List - Int Objects not Iterable Error -

i looking increment 2 separate counters contained in list , having error 'int objects not iterable' returned error. how can increase integer stored in specified place? dc_counter = 0 in range(15): in range(2): decision_counter[dc_counter].append([0]) dc_counter += 1 line_counter = 0 j in all_decisions: if all_decisions[line_counter][4] == 1: decision_counter[session_num][0] += 1 elif all_decisions[line_counter][4] == 2: decision_counter[session_num][1] += 1 line_counter +=1 your decision_counter 1 layer of list s deeper expected. sample: [[[0], [1]], [[0], [1]], [[0], [1]], [[0], [1]]] what intended was: [[0, 1], [0, 1], [0, 1], [0, 1]] to that, remove brackets append: decision_counter[dc_counter].append(0) # <-- append(0) instead of append([0])

java ee - Uploading a file, Spring MVC + CloudBees -

i have worked on local tomcat's server , i've deployed application cloudbees. works great apart uploading file server's directory. i have such piece of code in controller, worked me on localhost: @requestmapping("/main/admin/upload") public modelandview fileuploaded( @modelattribute("uploadedfile") fileupload uploadedfile, final httpservletrequest request, final httpservletresponse response, bindingresult result) { inputstream inputstream = null; outputstream outputstream = null; string pdfdirectory = uploadedfile.getpdfdirectory(); multipartfile file = uploadedfile.getfile(); string filename = file.getoriginalfilename(); try { inputstream = file.getinputstream(); string pdffiledirectory = request.getsession().getservletcontext() .getrealpath("/") + "resources\\pdf\\" + pdfdirectory + "\\"; file newfile = new f

javascript - D3 - Returning a table row to original bgcolor on mouseout -

apologies newbie question, i'm trying following using d3: 1) render alternating rows grey , white (zebra style) 2) highlight rows on mouseover event 3) return row original state on mouseout i've done via following code, works fine except returning rows original color on mouseout. instead, renders every row #c4c4c4 on mouseout var rows = tbody.selectall("tr") data(states) .enter() .append("tr") .style("background-color", function(d, i) { if (i%2===0){return "#fff";}else{return "#c4c4c4";} }); var rows = tbody.selectall("tr") .on("mouseover", function(){ d3.select(this).style("background-color", "yellow");}) .on("mouseout", function(){ d3.select(this).style("background-color", function(d,i) { if (i % 2 === 0){ return "#fff"; } else {

android - SharedPreferences dependencies -

i wanted create listpreference which, when changed reload values of others listpreference objects. tried calling: if(key.equals("important_pref")) { sharedpreferences.editor editor = sharedpreferences.edit(); editor.putstring("some_pref", "some_val"); editor.apply(); } in onsharedpreferencechanged function. it work need reload preferences screen see efect. there way avoid , reload values instantly? my guess can't way, because first commit needs ended before changing else. this common requirement unfulfilled i'm afraid. either have reload screen hacks setpreferencesscreen(null); or (better) register sharedpreferenceschanged listener , update prefs manually. see : update preferences values after changing them programatically in case should add if clauses in existing sharedpreferenceschanged listener "hear" change in "some_pref" preference , update displayed value manually.

java - Querying all Hibernate Envers revisions between two dates -

i have started using hibernate envers audit, , know if there way revisions of class between 2 dates. up until using: auditquery query = reader.createquery().forrevisionsofentity(myclass.class, false, true); query.add(auditentity.revisionnumber().le(reader.getrevisionnumberfordate(mydate))); to revisions of particular date, there way recover revisions between example: mydate1 , mydate2? you can use between method of auditproperty apply "between" constraint. http://docs.jboss.org/envers/api-new/org/hibernate/envers/query/criteria/auditproperty.html

javascript - Table Cell loop produces undefined index erroneously -

$('#process').click(function() { var char_matrix = []; $('#char_input tr').each(function(e) { $(this).children('td').each(function() { var = $(this).css('background-color').replace(/\d+/g, ''); if (a === '2551650') { char_matrix[e] += "0"; } else { char_matrix[e] += "1"; }//end if });//end each alert(char_matrix[e]); });//end each });//end func this code loops through each table row, , each row cell create array of 1's , 0's. each index of array different row, , each index composed of series 1's , 0's indicating background color status of each row. expected output like: 10101010 10101010 10101010 10101010 10101010 10101010 10101010 10101010 actual output is: undefined10101010 undefined10101010 undefined10101010 undefined10101010 undefined10101010 undefined10101010 undefined10

io - Appending bits to a file in C -

i'm working on crc32 program project , i've hit stumbling block. 32-bit uint asm code have, , in order test algorithm, need append exact bits end of text file threw algorithm, , we're kind of @ loss of how that. tried fprint, transformed int char , changed bits. same deal fwrite. there way fwrite we're missing? appreciated. you have open file in binary mode. it's possible have flip bytes (if asm code returns them in different endianness expected. if target big-endian, htonl work).

strtotime - PHP Date from string -

i have specific date format need convert normal looking date. strtotime() isnt parsing correctly. $fulldate = 'tue feb 04 2014 09:30:00 gmt-0800 (pacific standard time)'; echo $fulldate.'<br />'; echo strtotime($fulldate).'<br />'; echo date('y-m-d g:i a', strtotime($fulldate)); any ideas? you can use datetime object: <?php $fulldate = 'tue feb 04 2014 09:30:00 gmt-0800 (pacific standard time)'; //remove between brackets $datestring = preg_replace("/\([^)]+\)/","",$fulldate); //now, date object $date = new datetime($datestring); echo $date->format('y-m-d h:i:s'); ?> try fiddle here: http://ideone.com/odwtuh

java - not correctly casting back from generic type -

i attempting create junit tester check if median method returns double if given double. there seems sort of casting error missing together. appreciated. thank help. edit: required use collection of type number add sequences mixed integers , doubles , ensure when cast back, integers returned integers , doubles returned doubles the question attempting complete follows: testnumberparsimony: test when mixed integer , double concrete types added statcollection, maintain concrete types integer or double. mode, min, or max should return concrete type integer or double, according types numbers when added statcollection. (hint: can test number's type attempting cast of number retrieved statcollection.) here median method. given generic type creates collection of type array list out of public class statcollection<e extends number> extends java.util.abstractcollection<e> implements statskeeper<e>{ collection c; public statcollection(){ c=new arraylist<e>

ruby - Grep and print list of strings from two files? -

i have 2 large files , want take list of strings (in third file) , print each string exists in first large file not other. want run on command line 1 liner. #snippet of big_file_1 ahello.$ line blahblah llo no #snippet of big_file_2 123 line blahblah # list_of_strings file hello address name # expected output => hello i've tried following 2 options. first gives me shell error, second results in no output. hello in first file , not second i'm expecting output. running in irb, second option's if() returns true. why not getting puts output? ruby -ne 'puts $_ if ((`grep #{$_} big_file_1`.length >0) && !(`grep #{$_} big_file_2`.length >0))' < list_of_strings ruby -ne 'puts $_ if ((`grep $_ big_file_1`.length >0) && !(`grep $_ big_file_2`.length >0))' < list_of_strings the first gives me shell error, this because -n ruby option leaves newline on $_ . answers other questions. to fix this, c

php - jquery change event to submit form using ajax -

here form <form name="uploadimg" id="uploadimg" class="profile-image" enctype="multipart/form-data"> <input type="file" name="profile" id="updprofileimg"> </form> here jquery event $("#updprofileimg:file").change(function() { $('#uploadimg').submit(function() { var querystring = new formdata($('form')[0]); $.ajax({ type: "post", url: 'index.php?route=account/edit/upload', data: querystring, contenttype: false, processdata: false, beforesend: function() { }, success: function() { } }) }) }) but change event not triggering form submit tried trigger('submit') page refreshing instead of submitting in ajax. you binding events incorrectly. have it, changing field trigger binding of submit. need this: // bind submit event $('#uploadi

mpi - Connecting laptops through ssh and adding hosts to laptop -

i want make mpi cluster between 2 laptops. need connect via ssh. following link: https://help.ubuntu.com/community/mpichcluster accomplishing it. before need add other laptop's ip address known hosts. when googled got know need manually edit /etc/hosts file (like doing in text editor) super user permission. i'm apprehensive changing manually. can tell how add hosts can proceed project. here contents of /etc/hosts file: 127.0.0.1 localhost 127.0.1.1 shabhri-hp-pavilion-15-notebook-pc # following lines desirable ipv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters you add new hosts ip addresses @ end of first section. this: 127.0.0.1 localhost 127.0.1.1 shabhri-hp-pavilion-15-notebook-pc 192.168.0.2 otherlaptop 192.168.0.3 laptopnumber3 ...etc... # following lines desirable ipv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-m

is there any pure-java or standalone deployable implementation of jarsigner? -

i've seen lot of questions here asking how deploy app jarsigner without full jdk. people ask how programatically jarsigner tasks. i wondering if there pure-java implementation of jarsigner or standalone , alternate implementation of it, easier deploy apps. (of course, know force user install full jdk in installation process or require installed jdk) so question if there such thing alternate jarsigner. if soul explain why jarsigner must native (because java can decompiled?), plus :-) the executable part of jarsigner tool thin wrapper on pure java implementation. in fact it's same wrapper used java, javac, javap, etc. the real problem have class files used jarsigner in tools.jar, isn't present in jre.

How does rails 4 know which manifest file to use? -

there used single manifest.yml file. have multiple manifest-*.json files. how rails know 1 use? according sprockets source, picks first one. see line 50 here: https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/manifest.rb

Using keyup to change absolute position using JavaScript -

all i'm trying move div around screen using arrow keys. newbie javascript , wrote seems should working it's not. every keyup moving div based on it's original position , not current position of div. there i'm missing? css: #pawn { position: absolute; left: 0; top: 0; width: 50px; height: 50px; } javascript function showkeycode(e) { var pawn = document.getelementbyid("pawn"); if(e.keycode == "37") { console.log("left"); pawn.style.left = -50+"px"; } if(e.keycode == "38") { console.log("up"); pawn.style.top = -50+"px"; } if(e.keycode == "39") { console.log("right"); pawn.style.left = +50+"px"; } if(e.keycode == "40") { console.log("down"); pawn.style.top = +50+"px"; } } html: &

jQuery animate not work in Chrome and IE -

i created div container relative postitioned. in div container, there image displayed in block , responsive image , overlay div absolute positioned. because div container used in responsive website scenario, not have fixed dimension, instead, @ time, dimension determined dimension of image changing when size of screen changes. when page loaded, part of overlay visible. when user's mouth hovers on overlay, rest of overlay needs displayed, , fill entire div container. use jquery animate implement animation , works expected in firefox, , not work in ie, , not work in chrome, ie , safari. the following code, , can find live demo in jsfiddle: http://jsfiddle.net/spencerfeng/k9hdn/ here html: <div id="container"> <img class="responsive-img" src="http://www.fubiz.net/wp-content/uploads/2013/07/one-ocean-one-breath14.jpg" alt=""> <div class="overlay"> <h1>this title</h1> <

javascript - Run Continous Process from Node.js -

the point of server able pick webcam , stream it, along few other things have working. trying run continuous process (mjpg-streamer) within node.js server. node.js server handling serving html page has select drop down binded javascript function send command server via socket.io. drop down lets me select video0, video1, , none. however, whenever try run server refuses saying after particular block of code unreachable or code gets stuck running infinite process. how can execute without locking server? here code causes problem: child = exec("video0.sh", function (error, stdout, stderr) { sys.print('stdout: ' + stdout); sys.print('stderr: ' + stderr); if (error !== null) { console.log('exec error: ' + error); } the bash script video0.sh is: cd mjpg-streamer/mjpg-streamer ; export ld_library_path=. ; ./mjpg_streamer -o "output_http.so -w ./www -p 8080" -i "input_uvc.so -d /dev/video0"; you can set infinite loop in p

objective c - Animate a UINavigationBar's barTintColor -

the app i'm working on changes bartintcolor of navigation bar when pushing new view controllers. right set colour in destination view controller's viewwillappear: method, have few issues that. with way we're doing right now, navigation bar's colour changes abruptly, while rest of bar content animates usual. i'd bar fade between source , destination colour. there way achieve public cocoa touch apis? you can add animations match timing , animation curve of view controller transition using uiviewcontrollertransitioncoordinator . a view controller's transitioncoordinator set after view controller's animation has started (so in viewwillappear of presented view controller). add animations using animatealongsidetransition:completion: on transition coordinator. an example: [[self transitioncoordinator] animatealongsidetransition:^(id<uiviewcontrollertransitioncoordinatorcontext> context) { self.navigationcontroller.navigationbar.t

Google App Engine login URL redirect phonegap -

i writing cordova (phonegap) application uses google app engine backend logins , database. google app engine seems structured handle urls within application, that's not how cordova things. using users.create_login_url() direct users google's login page. first argument function redirect url either full url or location relative application. enter '/home' or url 'http://google.com' want application redirect cordova page on when user clicked button login. entered 'http://localhost' i'm not sure work way i'm expecting to. work, or need else? essentially, make request login using jquery.ajax(): $.ajax({ type:'post', url:'http://localhost:8090/login', //i running in gae developer runtime success:function(data) { window.location = data; } }); the above code should call post() method in login class have created in gae. code in method this: def post(self): user = users.get_current_user() if us

bash - trim sequences and quality in fastq file -

i have bunch of fastq files in directory , want trim sequence 2 nucleotides , quality(if read has 51 base pairs , ends-with ctg or ttg). here wrote shell script getting errors,need new shell scripting input: @hwi-st1072:187:c35yuacxx:7:1101:1609:1983 1:n:0:acagtg nggagaaagagagtgtgtttttagggggagatttttaaaatggttgttttg + #0<bfffffffff<bfffiifffffiiibfffffiifiiiiiffbffffff @hwi-st1072:187:c35yuacxx:7:1101:1747:1995 1:n:0:acagtg nggttgtggtggtgggtatttgtagttttatttattcgggaggttgagctg + #0<bffffffffffiibffiiiiiifiiiffiifiiifiifiiffffiiff @hwi-st1072:187:c35yuacxx:7:1101:9351:2210 1:n:0:acagtg cggttttgttttattttgtatgattaggagggttttggaggtttagttacc + bbbffffffffffiiiiiffiifiiiiiiiiiffiififiiffiiifiiii @hwi-st1072:187:c35yuacxx:7:1101:1747:1995 1:n:0:acagtg nggttgtggtggtgggtatttgtagttttatttat + #0<bffffffffffiibffiiiiiifiiiffiifi output: @hwi-st1072:187:c35yuacxx:7:1101:1609:1983 1:n:0:acagtg nggagaaagagagtgtgtttttagggggagatttttaaaatggttgttt + #0<bfffffffff<bfffiifffffiii

Using Teradata .net provider from VBA? -

does know how can use teradata .net provider in vba project? (excel). odbc not option. short sad answer: no. however, can use .net program (hence name), write c# or vb.net program uses it. if you're reasonably skilled programmer, write com component using c#/vb.net , can call vba.

java - Ganymed-ssh - how to set timeout to close session when execCommand takes more time -

i'm using ganymed-ssh pull log details remotely. below code. data returned stdout huge , takes more time return. want close session if stdout did not return in 1 minute. how set timeout session close automatically stdout took more 1 minute ? connection conn = new connection(hostname); conn.connect(); boolean isauthenticated = conn.authenticatewithpassword(username, password); if (isauthenticated == false) throw new ioexception("authentication failed."); session session = conn.opensession(); session.execcommand("grep traceid trace.log"); inputstream stdout = new streamgobbler(session.getstdout()); bufferedreader br = new bufferedreader(new inputstreamreader(stdout)); while (true) { string line = br.readline(); if (line == null) break; system.out.println(line); } system.out.println("exitcode: " + session.getexitstatus()); session.close(); conn.close(); you can use waitforcondition met

How to convert TTF font for use in three.js -

i looking library convert ttf or otf font js font. i aware of converter tool http://typeface.neocracy.org/fonts.html however know how site making conversion. can implement conversions of font files myself. ideally looking js or php library accomplish this. the converter typeface.js uses server-side perl scripts , the sources on launchpad . here extract readme : use typefacejs; $typeface = typefacejs::new->( input_filename => "truetype_font.ttf", unicode_range_names => ['basic latin', 'latin-1 supplement'], ); $typeface->write_file( output_filename => 'font.typeface.js' );

javascript - Need To Call Struts Action Class Method Upon selecting radio button -

i need call struts action class method upon selecting 1 radio button (onclick event) using javascript. selection of radio button shall passed parameter action class method. how can achieve this? please me. <s:form style="margin:5px 10;" action="searchaction" method="post" name="searchform"> <s:radio name="searchtype" label="criteria" list="{'data element','transaction details'}" requiredlabel="true" tooltip="your seach done depending upon selected criteria" onclick="func();"/> <script language="javascript"> function func() { var b = document.getelementsbyname()('searchtype').value; var sub = document.searchform.action + '?searchtype=' + b; alert(sub); document.searchform.submit(); } you can use javascript call achieve this...submit form javascri

Overwrite CSS: .container > * -

i'm trying overwrite line-height has been set in theme using: .container > *{font:normal 22px/28px sans-serif;} the div targeting nested inside of .container try doesn't work! any suggestions? assuming div want style has class called myclass, this: .container .myclass { line-height: x px; /* whatever need */ } this override original selector because more specific here's demo

javascript - JS - Check if string contain only 0 -

i have data of day , need check if contain 0. how can check if string contain 0? want regular expressions. /^0*$/.test(subject) returns true string contains nothing (any number of, including 0) zeroes. if don't want empty string match, use + instead of * .

recommendation engine - Performance Issue with Item-Based Recommender in Mahout -

i trying use item based recommender in mahout. contains 2.5 m user,item interaction, without preference values. there around 100 items , 100k users.it takes around 10s recommend. whereas same data takes less second when use user based recommender. itemsimilarity sim = new tanimotocoefficientsimilarity(dm); candidateitemsstrategy cis = new samplingcandidateitemsstrategy(10,10,10,dm.getnumusers(),dm.getnumitems()); mostsimilaritemscandidateitemsstrategy mis = new samplingcandidateitemsstrategy(10,10,10,dm.getnumusers(),dm.getnumitems()); recommender ur = new genericbooleanprefitembasedrecommender(dm,sim,cis,mis); i read 1 of answer of @sean suggests using above parameters samplingcandidateitemsstrategy. not sure does. edit: 2.5 m total user-item associations, there 100k users , total number of items 100. among many reasons, main reason choosing item-based recommender is: if number of items relatively low compared number of users, performance advantage significant .

java - How to create a method to add a table -

i have question. i have following method: public static object[] czydziala(string[] lista) throws ioexception { for(int i=0 ; i<=lista.length-1;i++){ url url = new url(lista[i]); httpurlconnection httpcon = (httpurlconnection) url.openconnection(); int len = httpcon.getcontentlength(); if (len>0){ system.out.println(url +new string(" site work")); }else{ system.out.println(url +"site don't work"); } } return null; } the argument in method list of strings. jframe okno = new jframe(); okno.setsize(1200, 500); okno.setvisible(true); okno.setdefaultcloseoperation(jframe.exit_on_close); string [] col = {"nazwa witryny"}; string [] listawitryn = {"http://www.wp.pl", "http://www.onet.pl","http://mobidev.pl"}; try {

python - Publishing geospatial data with Plone -

i setting new site on plone using collective.geo.bundle, need make data accessible desktop gis. 2 obvious ways of doing use postgres/postgis database, or publish data through wfs service. problem appears plone stores pickles in database, gis wouldn't able make sense of data, , there doesn't seem addon exposes wfs. 2 questions then: is there way use configure plone use postgres/postgis database geometry data types, data can read outside plone? is there way set plone (e.g. through addon) expose wfs? tl;dr: don't think there out-of-the-box solution (using collective.geo.* ) this. as mentioned in comments, plone doesn't deal geospatial data @ all, it's collective.geo.geographer this. more specifically, it's georeferencingannotator saves coordinates igeoreferenceable objects annotations (and loads them there). so, forcing plone store content in relational db, example using relstorage wont - plone or relstorage don't know geospatial da

sql server - Which query would be better for Paging? -

which query better paging query 1 or query 2 query 1: select ceiling(convert(decimal,count(*))/@pagesize) totalpages table query 2: select (count(*) + @pagesize - 1)/@pagesize totalpages table bases on sample i'll go query 2 but technically speaking both have same performance in sql server, try executing them , see execution plan.

How to convert LINQ query result to list and return generic List? -

i used generic orm list example. this table. person table guid name lastname and struct class. public struct personitem // database , class field names same { public guid guid{ get; set; } public string name { get; set; } public string lastname { get; set; } } public struct personitems { public personitems() { items = new list<personitem>(); } public list<personitem> items { get; set; } } i'm using such , no problem have write field's public personitems getpersons() { var query = (from p in _dbentities.t_crew select p).tolist(); if (query != null) { foreach (var item in query) { _personitems.items.add(new personitem { guid = item.guid, name = item.name,

c# - IRC Bot GUI crash? -

ok so, bot connects fine, when create bot, form crashes. bot stays connected !about commands doesnt work. if use same exact code console application works fine. problem ui form using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.io; using system.net.sockets; namespace circbot { public partial class bsetup : form { public bsetup() { initializecomponent(); } private void createbotbtn_click(object sender, eventargs e) { string buf, nick, owner, server, chan; int port; tcpclient sock = new tcpclient(); textreader input; textwriter output; //get nick, owner, server, port, , channel user nick = botnick.text; owner = botname.text; server = servern

after printf program ends itself without doing the rest of code ? C -

after printf line program ends didnt why. #include<stdio.h> int main () { int sum,multiply,divide,difference,num1,num2; char i; scanf("%d", &s1); scanf("%d", &s2); printf("type initial of operation : "); scanf("%c", &i); return 0 ; } there no way compile that, since s1 , s2 undefined variables. thus, information happened when ran moot, since there no way run it. you meant: if(scanf("%d %d", &num1, &num2) == 2) { printf("operands %d , %d, type initial of desired operation:\n"); if(scanf("%c", &i) == 1) { } } it's important check scanf() has succeeded before relying on return value.

.net - What is the opposite class to TcpListener in C# and how to use it to send message to server -

i have programmed tcp server in application can handle incoming connections , decode inoming messages. but wanted create client on windows phone send short string message: "i client" server. in server used class tcplistener looking "opposite" class tcpsender not find one. the servers ip is: 192.168.0.13 , port 13000 . to sum question: how create short client send single message server? my server looks - post show i've done it: using system; using system.net; using system.net.sockets; using system.text; using system.threading; namespace homesecurity { class tcpeventserver { private tcplistener tcplistener; private thread listenthread; public tcpeventserver() { this.tcplistener = new tcplistener(ipaddress.any, 13000); this.listenthread = new thread(new threadstart(listenforclients)); this.listenthread.start(); } private void listenforclients() { this.tcp

Autocomplete/Autofill Edit Text Android -

i looking achieve functionality of autocompletetextview different. instead of getting drop-down list suggestions want complete sentence me. for example: type abc , completed, rest of text in grey: abc1@etc.etc , click button keep text or keep writing filter further. do think is achievable somehow? i have looked problem far answers found involved drop-down list, perhaps haven't looked deep enough. why don't try implement custom view? basically, need same things autocompletetextview instead of displaying n elements drop down list have add first option edittext. have at: textwatcher in order see how detect user input , progress you can play indexes , spannables in order keep track of data input user , data suggesting. one thing don't idea fact if have got: germans germany ... you need type lot of letters without possibility choose different solution providing.

android - How to install two versions of an app -

is there simple way have installed 2 version of app on same android phone? im updating old web app native android app. testing purpose great if have both installed @ same time on same device. it great rename update temporary. if rename package name in androidmanifest, r renamed , have reorganize imports etc. is possible simple rename somewhere in androidmanifest without changing single line of code (even not eclipse / android studio refactoring mechanism). i have tried mark native app library project , include in new android project package name. trouble approach, instance actionbar sherlock: unable execute dex: multiple dex files define lcom/actionbarsherlock/r$attr; conversion dalvik format failed: unable execute dex: multiple dex files define lcom/actionbarsherlock/r$attr; if using new gradle build system create new build type , add packagenamesuffix to it. add suffix package name else stays same. buildtypes { debug { packagenamesuffix ".

sql - Compare a group of rows in oracle -

i have table having coloumns, id | branch | start_num | end_num 123 s 25 95 234 s 45 105 445 s 46 90 556 m 56 129 78 m 76 199 87 m 80 110 987 m 89 128 777 m 100 1500 i want first group result on basis of branch (m,s here).then want records lies insubset of master start , end no being first row of group.here compare s group 25-95 , in m group 56-129 . hence answer (i writing rows first element) 123 445 556 87 you can use below given query in mssql. select b.id branch b inner join ( select distinct m.branch,c.start_num,c.end_num branch m outer apply

jquery - Apply an effect to many IDs in a page -

i using loading effect in button (bootstrap v.3) works fine. <a href="#" class="btn btn-primary" role="button" id="fat-btn" >read</a> and script $('#fat-btn').click(function () { var btn = $(this) btn.button('loading') settimeout(function () { btn.button('reset') }, 9000) }); this works fine! applied first button in page. can do, apply effect more buttons? thought type similar scripts different selectors. not convenient, (if have 20 buttons, type 20 different selectors??) use class selector instead of id selector , assign same class buttons have. $('.btn-primary').click(function () { var btn = $(this); btn.button('loading'); settimeout(function () { btn.button('reset'); }, 9000); });

CDC in sql server -

i have enabled cdc feature on 1 of database. have below table data in cdc tables memberid lastname __$operation 1 david 4 1 dave 4 2 jimmy 4 2 test 4 now problem have query cdc table , rows latest 1 members (most recent updated value). example query return memberid lastname __$operation 1 dave 4 2 test 4 in addition _ $operation column, there _ $start_lsn , __$seq_val columns. ordering 2 should there.

Get facebook check ins via FQL or Graph api -

so need achieve facebook check ins user (myself, or friend). according fb documentation on fql should simple, example: select author_uid, tagged_uids, target_id, timestamp checkin author_uid = me() but atm i'm not getting errors, empty data array in return, have lot of facebook check-ins also, if tried different author_uid's (friends of mine, permissions granted) i'm getting same response. for me not logical , if i'm doing wrong here realy appreciate if u can point me in right direction ;)

database - ISO-8601 in Postgres: How to insert only year in type date? (incomplete date-time values) -

the postgres database claims supports iso-8601 standard . in iso-8601 date format "yyyy", i.e. consisting of year, fine , acceptable. can't find way add year postgres database field of type "date". idea if i'm doing wrong or feature missing in postgres? i've seen other posts advising set date "yyyy-01-01" not want , need (since marks specific day of month of year). scenario the scenario following. collecting information on people. many have exact dates. have no dates or years, or year , month no day. have able find people born before year, or after other year. easy if have full date. hoped there feature implemented in postgres handle cases of incomplete dates. to year of date data type: select extract(year '2014-01-01'::date) the_year; the_year ---------- 2014 if need year use smallint check constraint create table t ( the_year smallint check( the_year between 0 , extract(year current_date)

android fragments - How to build your own tabs in MvvmCross? -

i'm trying build own tabs in monodroid , mvvmcross. the reason building own tabs can have further control on them. want them on every screen if aren't in tabs, want control clicks on tabs. loading 2 fragments on page fine, when click button on either tab fragment or content fragment navigates next content fragment getting error message "an unhandled exception occured." isn't helpful. 02-06 10:15:13.947 w/dalvikvm( 2040): jni warning: jni method called exception pending 02-06 10:15:13.947 w/dalvikvm( 2040): in lcirrious/mvvmcross/droid/fragging/mvxeventsourcefragmentactivity;.n_startactivityforresult:(landroid/content/intent;i)v (newstring) in mgmain jni_onload 02-06 10:15:13.947 w/dalvikvm( 2040): pending exception is: 02-06 10:15:13.947 i/dalvikvm( 2040): android.content.activitynotfoundexception: unable find explicit activity class {frags.droid/frags.droid.views.frags.childtwoview}; have declared activity in androidmanifest.xml? 02-0

Use less to generate dynamic CSS rules based on parameter value and passed mixin -

it possible achieve in less? .some-button(@classname) { @classname { .actionicon; } tr:hover { @classname { .actionbutton; } } } when call it: .some-button(.edit-action); the expected output should : .edit-action { .actionicon; } tr:hover { .edit-action { .actionbutton; } } currently i'm getting "unrecognized input in @classname { .actionicon; }" error: .some-button(@classname) { @classname { .actionicon; } tr:hover { edit another thing achieve use mixin mixin parameter: .actionbutton(@buttonclassname; @buttontype) { @{buttonclassname} { .actionicon; } tr:hover { @{buttonclassname} { .actionhovericon; @buttontype(); } } } and call this: .actionbutton(~'.row-edit', button-harmful); where button-harmful mixin. they call "selector interpolation" , correct syntax is: .some-button(@classname) { @{classname} { /* ... */ } } // usage: .some-button

javascript - In JQuery why one of ajax request is working while other isn't? -

i developing application in have call multiple ajax requests. sending $.get , $.post ajax requests working fine tried give shot common $.ajax request.the problem $.ajax not working, below piece of code //get request $.get works $.get("/requestcont/task2", function (data) { alert(data); }); //common ajax request below don't work $.ajax({ url: "/requestcont/task2", type: "get", datatype: "json", success:function(data) { //processing json data here }, failure:function(data) { //handling error here } }); i using asp.net mvc , actual code haven't wrote here piece of code demonstrate works or not. action in controller requestcont public actionresult task2() {

asp.net mvc 4 - Get form collection value using mvc paging -

how can form collection value while paging? when submit form can form collection value. when click next page can not form collection value. need change in pager? kindly suggest me public actionresult index(formcollection fc, int? page) { } please , page id make first , must pass default=0 public actionresult index( int page, formcollection fc) { }

java - Redirection Module in a JSP/Servlet web application -

well, need creating redirection module java web application. based on jsp/servlets. functionalities of module: - if user enters link of webpage , user isn't logged in, app should ask user login first , redirect user specified link. i have achieved functionality, done storing links in session, overhead codes on each jsp pages, kind of unmanaged. suggest ideas or apis useful in creating such module. you should take @ jaas, java athentication , authorization service . service container (tomcat, wildfly, ...) provides you, , abstracts concern, application doesn't needs implement security model scratch. you can find reference guide here .

sql - SQLITE: Create View to multiple tables via index -

presently writting bit of code logging requests sqlite database. database not bloated using different tables containing invariant data( apps , machineid , ips , platforms ) can appear lot of times, unique , main table ( access ) keeps references on rows in other tables ids. want create view shows main data other tables instead of indexes other tables. example tables: apps table ---------- id application buildnum 1 app1 24.112 2 app2 24.113 machineid table -------------- id machineid 1 12345 2 1235 ips table --------- id ip 1 192.168.9.53 platforms table --------------- id platform os 1 windows win7 2 windows win8 access table ------------ date ip_id machineid_id platform_id application_id responsecode 1391677790.7363 1 1 1 1 404 1391677797.5792 1 1 1 1

java - call paintComponet agian -

i make imagepanel class imageicon object , draw show panel. import javax.swing.jpanel; import javax.swing.imageicon; import java.awt.graphics; class imagepanel extends jpanel { private imageicon img; public imagepanel(imageicon img) { this.setimage(img); } public void setimage(imageicon img){ this.img = img; } @override public void paintcomponent(graphics g) { if(img instanceof imageicon) g.drawimage(img.getimage(), 0, 0, this.getwidth(), this.getheight(), null); } } but problem when change img, don't show on panel till change frame size. how can update it? edit: repaint() not clean last img on panel. typically need call repaint within setimage method. you should calling super.paintcomponent in order prevent possibility of introducing paint artifacts rendering process. you should should consider overriding getpreferredsize in order ensure component laid out under layout managers. sh

javascript - how to update data form file json using d3.js (zoomable circle pack) -

Image
i'm working on real-time visualization of incoming data stored in json file. use d3 visualization. chart use: http://mbostock.github.io/d3/talk/20111116/pack-hierarchy.html this code page: <body onload="visualize()"> <h2> <input type="button" value="get new data" onclick='ajaxsyncrequest("get-current-time")' /> <br /> <br /> message server :: <span id="message"></span> </h2> <script type="text/javascript"> function ajaxsyncrequest(requrl) { //creating new xmlhttprequest object var xmlhttp; if (window.xmlhttprequest) { xmlhttp = new xmlhttprequest(); //for ie7+, firefox, chrome, opera, safari } else { xmlhttp = new activexobject("microsoft.xmlhttp"); //for ie6, ie5 } //create asynchronous request xmlhttp.open("get", requrl, false); xmlhttp.send(null); //executio