Posts

Showing posts from March, 2015

How to focus android activity to the specific item of the listview -

i populating listview dynamically want when activity created take focus specific item of listview. in facebook app notification takes on specific row of comments. if listview extends activity try : listviewname.setselection(positionofitem); and if listview extends listactivity try : getlistview().setselection(positionofitem); example chat application, listview must focused @ last row put code after message displayed getlistview().setselection(getlistadapter().getcount()-1);

javascript - How to override responsive features in Twitter Bootstrap 2? -

i have site using twitter bootstrap , using of responsive features. works fine on desktop , mobile devices. shrinking window on desktop cause responsive grid kick in, , responsive grid served mobile device appropriately. however, possible iphone user access 'non-responsive' version? it's safe iphone , android phones access 'full' version of sites, i'd offer option mobile users. back before 'responsive' hottest thing, typically handled via client browser detection , backend routed clients 2 different sites, pages, or themes render content, , there kind of link or button afforded user allow them visit full-site instead. i'm trying replicate usage pattern. if don't want reload page after change "desktop" version try disable repsonsive stylesheet(s). see: removing or replacing stylesheet (a <link>) javascript/jquery , https://stackoverflow.com/a/15824131/1596547 . removing stylesheet seems work. some proof of c

sql server - Derive grouped meaning from multiple rows -

what ways, in last query, include batch 2 in result "processing"? each batch has several child tasks. overall status of batch i'm looking for. task status meanings: 1=pending 2=processing 3=retrying 4=complete 5=failed batch status: batch 1 processing batch 2 in middle of processing, pending task has not yet been picked up. seconds before happens, i'm not interested in "sleeping" type state. batch 3 processing retrying task batch 4 not processing because nothing has been picked up. batch 5 not processing because complete batch 6 not processing because has failed task. code: if object_id('tempdb..#t') not null drop table #t create table #t (batchid int, taskstatus int) insert #t(batchid, taskstatus) values (1, 1), (1, 2), (1, 4), (2, 1), (2, 1), (2, 4), (2, 4), (3, 3), (3, 4), (4, 1), (4, 1), (5, 4), (5, 4), (6, 5),

Is there a way to convert image with R ? JPEG to GIF for example -

i wish display images in tcltk window (not in r device) using r simpliest method (below) supports gif files : require(tcltk) tcl("image","create","photo", "imageid", file="a.gif") w <- tktoplevel() l <- ttklabel(w, image="imageid", compound="image") tkpack(l) and files png/jpeg (file containing histograms generated program itself) someone has idea conversion ? thank you despite warnings seems succeed: png("test.png") plot(1,1) dev.off() #quartz # 2 library(png) help(package="png") img <- readpng("test.png") str(img) # num [1:480, 1:480, 1:4] 1 1 1 1 1 1 1 1 1 1 ... require(catools) #loading required package: catools write.gif(img, "test.gif", scale="always") #----------------- warning message: in if (col == "jet") col = colorramppalette(c("#00007f", "blue", : condition has length > 1 ,

javascript - trying to get the validation on the radio group to work correct however I seem to have it backwards -

<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>javascript exercises</title> <style type="text/css"> body { font-family:verdana, geneva, sans-serif; font-size:100%; margin:0; padding:0; } p { color:#900; margin-left:20px; } fieldset { border-color: #fff; border-radius: 15px; } div#results { background-color:#ff6; height:auto; width:500px; border:1px solid red; padding:10px; margin-left:20px; -moz-box-shadow: 10px 10px 5px #888; -webkit-box-shadow: 10px 10px 5px #888; box-shadow: 10px 10px 5px #888; border-radius:7px; } div#more { background-color: #39f; height:auto; width:500px; border:1px solid #036; padding:10px; margin-left:20px; margin-top:20px; -moz-box-shadow: 10px 10px 5px #888; -webkit-box-shadow: 10px 10px 5px #888; box-shadow: 10

javascript - Embedding an SVG, no show in IE9 -

i trying embed external svg file , have manipulatable in css , jquery. code works in ie10, ff, chrome. $.get("assets/images/floorplans4.svg", function(svgdata){ //console.log(svgdata); $("#svgcontainer").append(svgdata.documentelement); }, "xml"); in ie9, hierarchyrequesterror. any thoughts on this? maybe i'm missing in html file make compatible? i'm using html5, thus: <!doctype html> <html> <head> etc. in advance.

c++ - I am trying to clean my data file from special charachters with some conditions, but those conditions are not met? -

ok here code this code trying remove special characters ",',{,},(,) .txt file , replace them blank space. #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <fcntl.h> #include <iostream> #include <time.h> #include <fstream> using namespace std; int main(int argc, char *argv[]) { int fd; int i; int j; int len; int count = 0; int countcoma = 0; int countquote = 0; char buf[10]; char spec[] = {',','"',':','{','}','(',')','\''}; fd = open(argv[1],o_rdwr,0777); while (read(fd,buf,10) != 0) { len = strlen(buf); (i=0;i<len;i++) { (j=0;j<8;j++) { if (buf[i]==spec[j]) { count =1; countquote=0; if (j==1) { if (count

java - Using JavaMail with a Self Signed Certificate -

i have servlet contains following code: system.setproperty("javax.net.ssl.keystore", getservletcontext().getrealpath("keystore.jks")); system.setproperty("javax.net.ssl.keystorepassword", "123456"); system.setproperty("javax.net.ssl.truststore",getservletcontext().getrealpath("keystore.jks")); system.setproperty("javax.net.ssl.truststorepassword","123456"); sslsocketfactory sslsocketfactory = (sslsocketfactory) sslsocketfactory.getdefault(); sslsocket sslsocket = (sslsocket) sslsocketfactory.createsocket("127.0.0.1", 606); with code i'm able use ssl (what mandatory case). later in same servlet need send e-mail using javamail. when try send e-mail without using certificate in other code, works fine, when try using following message returned: using port 465 -> debug: setdebug: javamail version 1.4.7 debug: setdebug: javamail version 1.4.7 debug: getprovider() returning javax.mail.

Search Query in Linq with EF -

lets have following classes entity framework 5 code first. need search of industries or divisions array of keywords, returning leads match of keywords. need search name of lead same keywords. i'm stuck on how search multiple keywords. main class public class lead { public guid id { get; set; } public string name { get; set; } public virtual icollection<industry> industries { get; set; } public virtual icollection<division> divisions { get; set; } } industry class public class industry { public guid id { get; set; } public string name { get; set; } public icollection<lead> leads { get; set; } } division class public class division { public guid id { get; set; } public string name { get; set; } public icollection<lead> leads { get; set; } } service / repository call public iqueryable<lead> getbykeywords(string keyword) { var result = leadrepository.getall().where (x =>

What's the pros and cons to install HBase + Hadoop together vs. install HBase and Hadoop separately? -

i mean , 2 options : 1. install hbase on hadoop cluster offline computing, means 1 hadoop cluster. 2. install hadoop cluster offline computing , install hadoop cluster hbase use hdfs. so 2 options : 1 integrated cluster , 2 clusters. what's pros & cons these 2 options ? option 1: integrated cluster. pros: mapreduce reads or writes hbase more efficient data locality. cons: hbase region server reduce performance of machine (datanode , tasktracker) need hold cpu , memory. hbase latency may seconds if there many mapreduce jobs. if want make hbase response in time, need more work (for example, using memcache improve read performance). option 2: 2 clusters. prons: hbase region server not impact performance of hdfs datenode , tasktracker. cons: mapreduce needs read , write data remotely if wants access hbase. option needs more machines.

salesforce - How to increment a value in a map with Apex? -

is there way increment value in map without needing second variable? for example, doesn't work: counts = new map<string,integer>(); counts.put('month_total',0); counts.put('month_total',counts.get['month_total']++); it returns "initial term of field expression must concrete sobject: map" instead needed do: counts = new map<string,integer>(); counts.put('month_total',0); integer temp = 0; temp++; counts.put('month_total',temp); is there way increment without needing variable? replace counts.put('month_total',counts.get['month_total']++); with counts.put('month_total',counts.get('month_total')++);

php - How do I build a cookie to get around wordpress caching for my post view hit counter -

i'm building wordpress plugin counts total views on page. problem i'm having if using caching system hits not accurate. is possible construct cookie or can add bypass server or wordpress caching systems , still update database page view hit , timestamp? how jetpack wordpress it?

php - Codeigniter update record -

i have update record looks this $data_gallery = array( 'order' => $value ); $this->db->where('order', $neworder); $this->db->update('gallery', $data_gallery); i have say, 5 images have reorderd. have old position , new position. but loop through sometime overwrite each other. example: 5 images 1,2,3,4,5 i change order 2,1,3,4,5 i update in loop goes through array of new order. update order = 2 order = 1 update order = 1 order = 2 obviously second 1 never gets hit order = 2 no longer exits. i guess more logic question else. any ideas how can loop through , update without losing of data? though maybe updating in batch operation didn't far it. thanks in advance. use image's id in clause: $this->db->where('imageid', $imageid); this set new order each image without overwriting (and disappearing!) information.

How Can I Incorporate my WordPress Blogs into an iOS app? -

how can incorporate wordpress blogs ios app? have beautiful word press site , want create native ios app. have knowledge of coding ios, don't know how go showing latest blogs in beautiful way. thanks in advance! there many ways can achieve that. here list of things need in order make ios app wordpress blog: 1) need parse data wordpress blog display inside ios app. can parsing blog's rss feed can parse json. 2) if planning parse rss feed, use nsxmlparser that. there other third party libraries available parse xml feeds suggest go built in nsxmlparser there plenty of available online it. 3) if planning parse json data, install feed json plugin on wordpress blog. once installed, can go http://example.com/feed/json json data. (you can replace example.com blog's url) 4) connect web services xml feed , json on blog, can use third party libraries afnetworking or can use apple's built in libraries nsurlconnection , other classes connect , download

database - Why can't one of my Rails processes see what the other has committed to the DB? -

i'm developing app on top of amazon fps. when make payment fps, payment succeeds asynchronously: make request , wait post (an instant payment notification) informing whether charge completed. i need user see whether charge completed next page load (if possible), i'm having server: charge user, then spin in loop checking database status update, and time out if takes long meanwhile, server process is: receiving ipn and noting success in database other process see. i'm running unicorn 3 workers. they're logging same terminal window. see first process begin spin, reporting repeatedly charge still pending. see ipn come in, , second process pick , write database has succeeded. see first process continue see it's pending. why never see success value written database? it feels me transaction issue, ran separate process loops , outputs status of latest charge. when second process reported marked charge successful, third independent process agreed. it

javascript - Node.js closes as I open it -

i running simple script in nodejs, loading static html file. var http = require("http"); fs = require('fs'); fs.readfile('./index.html', function (err, html) { if (err) { throw err; } }); http.createserver(function(request, response) { response.writehead(200, {"content-type": "text/plain"}); response.write("hello world"); response.end(); }).listen(1994); whenever launch application closes. see text on console half second application launches, window closes. happens every time. you using node.js repl comes installation of node.js. i no errors when run code (assuming have index.html in directory , no error thrown). try run code via command line command node yourscriptfilename.js

kentico - Setting the product description in the shopping cart -

i trying write code add item shopping cart. i have been able set price of product using cartitem.cartitemprice = price; how can set description displays? i have looked @ shoppingcartinfoprovider cant figure out method use in webpart set cartitem.cartitemtext description wanted. i edited getskuname in cmsmodles\ecommerce\shoppingcart\shoppingcartcontent.ascx.cs return itemtext

Easy example to put HTML with CSS into an NSTextView? -

is there easy way put html css nstext or nstextview? once that, want rotate it, put part of in view, generate output, repeat... thanks. use webview , embed css html. [[webview mainframe] loadhtmlstring:<yourstring> baseurl:nil];

html - center three divs side by side -

i have 3 divs want center side side on page. have content such <p> , <h3> tags in them html (example) <div id = "wrapper"> <div class = "aboutleft"> <h1> </h1> <h3> small description </h3> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec tristique non odio nec few sentences go here </p> </div> <div class = "vline"></div> <div class = "aboutright"> <h1> shop/clients </h1> <h3> small description </h3> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec tristique non odio ne few sentences go here </p> </div> </div> css .aboutleft { display:inline-block; float:left; width: 450px; } #wrapper { text-align:center; width: 80%; margin: 0

java - More efficient method for storing records from a file -

recently in discussion asked: have one flat file containing many records 5 million. need write java program can fetch records file , store in database via jdbc. efficient approach? my suggestion create: one thread handle jdbc connection (additionally can make connection class singleton) another thread fetch records file & save in table. additionally when number of records saved in database, 100 commit first continue. here stored procedures better or there other way? sounds have right approach in mind. the cost , time spent on network i/o , db operations going larger file io , parsing time spent on flat file. there might small performance gain in having separate thread read file , prepare record db, wouldn't worth added complexity, , maybe not worth time jvm spend on thread management. i'd recommend: 1 thread read file , submit db updates. as bitfiddler says, use preparedstatements batch updates ( preparedstatement.addbatch() ) every record,

android - Spinner in Action Bar returns Null Pointer Exception -

i trying implement spinner in action bar, switch between 2 different fragments in activity. implement it, have added spinner using xml in layout, , trying set adapter in base activity class. here's activity class, protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); log.i(debug,"oncreate"); setcontentview(r.layout.add_new_course); intent intent = getintent(); semesterid = intent.getintextra("semester id", 0); log.i(tag,"add new course created"); spinner = (spinner)findviewbyid(r.id.coursespinner); fragmentmanager fragman = getfragmentmanager(); if(savedinstancestate == null) { adddetailsfrag = new addcoursedetailsfragment(); addweightsfrag = new addcourseweightsfragment(); fragman.begintransaction().add(r.id.coursefragmentcontainer, adddetailsfrag); } } @override public boolean oncreateoptionsmenu(menu

R - Remove commas from values in a column and place separated values into new rows -

i have column of gene symbols have retrieved directly database, , of rows contain 2 or more symbols comma separated (see example below). slc6a13 atp5j2-ptcd1,bud31,ptcd1 acot7 bud31,pdap1 ttc26 i remove commas, , place separated symbols new rows so: slc6a13 atp5j2-ptcd1 bud31 ptcd1 acot7 bud3 pdap1 ttc26 i haven't been able find straight forward way in r, have suggestions? another option use readlines , strsplit : unlist(strsplit(readlines(textconnection(txt)),',')) "slc6a13" "atp5j2-ptcd1" "bud31" "ptcd1" "acot7" "bud31" "pdap1" "ttc26"

Convex Hull on Java Android Opencv 2.3 -

please me, i have problem convex hull on android. use java , opencv 2.3 . before made on java, made on c++ visual studio 2008. this code can running on c++. now, want convert c++ java on android. , found error "force close" when run on sdk android simulator. this code on c++: vector<vector<point> > contours; vector<vec4i> hierarchy; findcontours( canny_output, contours, hierarchy, cv_retr_tree, cv_chain_approx_simple, point(0, 0) ); drawing = mat::zeros( canny_output.size(), cv_64f ); /// find convex hull object each contour vector<vector<point> > hull ( contours.size() ); for( int = 0; < contours.size(); i++ ) { convexhull( mat(contours[i]), hull[i], false ); } for(size_t = 0; < contours.size(); i++){ drawcontours( drawing, hull, i, scalar(255, 255, 255), cv_filled ); // fill white color } and code on android: mat hierarchy = new mat(img_canny.rows(),img_canny.cols(),cvtype.cv_8uc1,new scalar(0)); list<

sbt - Scala build settings(foobar: _*) -

this question has answer here: using variable length argument in scala 1 answer i see in spray build.scala lazy val spraycaching = project("spray-caching", file("spray-caching")) .dependson(sprayutil) .settings(spraymodulesettings: _*) .settings(librarydependencies ++= provided(akkaactor) ++ compile(clhashmap) ++ test(specs2) ) what .settings(spraymodulesettings: _*) do? spraymodulesettings: _* . .settings method takes variable argument list. spraymodulesettings seq. : _* tell compiler want pass elements in spraymodulesettings arguments method. scala> val s = seq(1,2,3,4) scala> def test(args:int*) { println(args.length) } scala> test(s) <console>:10: error: type mismatch; found : seq[int] required: int test(s) ^ scala> test(s:_*) 4

How to add a transparent image to MS Access 2010 button control? -

normal intuitive way, hitting picture property's "..." button , clicking explore choose file doesn't work transparent ico files (ms access returns error), , doesn't work on bmp files, there no easy way specify transparent color them. there heaps of trials on internet handle special software, modules or custom multipart pictures drawn on buttons - way complicated. is there simple way add transparent picture ms access button control? finally long search finished here: http://www.tek-tips.com/faqs.cfm?fid=7541 draw image control on form , select image transparency ( used .png files ) change property 'picture type' 'shared' (noting control name or image name) click button control click property 'picture' , see picture image control available selection, select it. you can change button control 'picture type' 'embedded' you should have transparent image isn't compatible buttons on

postgresql - input date validation check calling to_date -

i'm using postgresql-9.1.6 on centos. i have issue on to_date function like... postgres=# select to_date('20130229','yyyymmdd'); to_date ------------ 2013-03-01 (1 row) so i'm trying add validation check out of range against incoming date. postgres=# select to_date('20130229','yyyymmdd'); error: timestamp out of range i found hint here didn't work , asked here . unfortunately, couldn't answer. finally, reached conclustion. below formatting.c 9 lines marked + added. datum to_date(pg_function_args) { text *date_txt = pg_getarg_text_p(0); text *fmt = pg_getarg_text_p(1); dateadt result; struct pg_tm tm; fsec_t fsec; + int ndays[]={-1,31,28,31,30,31,30,31,31,30,31,30,31}; + int last_day_of_month; do_to_timestamp(date_txt, fmt, &tm, &fsec); + last_day_of_month = ndays[tm.tm_mon]; + if (((tm.tm_

etl - minus query in sql developer -

i have 2 database connections in sql developer active lets db1 , db2. working on etl validation. want check if data table1 of db1 populated correctly in table2 of db2. to access tables 2 connections how can write query? on helpful there common ways validate if etl correct: you can run 2 queries calculate line counts separately against table1@db1 , table2@db2, , compare line counts between them. or perform aggregate functions, such sum(), avg()...etc on tables in db1/db2.

c# - Pass Listbox Items as array to another pages -

i making app in vs2012 c# windows 8. have 1 listbox 'a' , want pass items page 'pageone.xaml'. listbox item contain both numbers , characters. p.s. : can make listbox global(i.e. can used pages) you using viewmodel this. check out mvvmlight . create ioc , service locator (well, template create 1 you) allows access viewmodel s anywhere in app via source={staticresource locator} .

html - Completely center form in navbar -

what i've been trying center form (and 2 icons beside it) dead center in navbar. i've used below css property, however, doesn't center precisely. text-align: center; if check in jsfiddle below, it's not precisely in center. also, it's important know length of text in both buttons on right vary. http://jsfiddle.net/mgcdu/5763/ how can center form (with 2 icons) in navbar, noting length of button's text can change? this it, you'll need set width .center-form box. css .center-form { width: 250px; margin: 0 auto; text-align: center; }

c++ - How to stop an ongoing upload in vc -

in application, can upload upload files server. using wininet. want stop upload process when user click on stop button. if user click on stop button ongoing process not stop uploading. how can deny file uploading. if using wininet, need post file in several smaller chunks. if uses presses "cancel" need set variable abort upload. must checked after each small upload... full example of splitting uploads smaller pparts can found here: http://support.microsoft.com/kb/177188/en-us need download "hsrex.exe" file , open winzip or 7-zip , extract "bigpost.cpp" file. can post code here, if want...

java - oracle exception: invalid table name -

i using jdbc connecting database (oracle10) in servlets. following query in want set 3 parameters dynamically. table name column name value query: query = "select ? ? ? = ?"; mypstmt = con.preparestatement(query); mypstmt.setstring(1, tablename); mypstmt.setstring(2, columnname); mypstmt.setstring(3, columnname2); mypstmt.setstring(4, value); but above query giving me error: java.sql.sqlexception: ora-00903: invalid table name i checked table name. correct, , if write query like: query = "select "+columnname+" "+tablename+" "+columnname2+" = ?"; then executing fine. so should if want set table name , column names mypstmt.setstring(1,tablename) edit1 reason why want parameterize table name , column name allowing user select/enter table names , column names, want avoid sql injection . we can't pass tablename directly preparedstatement table name cannot bind variable . preparedstatement .

C++ fstream tellg behaviour -

i working on c++ application in visual studio 2012 (32-bit). when read file using fstream , read 4 bytes twice, confusing values tellg. expecting 0, 4 , 8. std::fstream file; file.open(filename, std::ios::in , std::ios::binary); if ( !file.is_open()) { throw exception("error opening file reading"); } int pos = file.tellg(); // pos 0 boost::int32_t usedblocks; int size = sizeof (usedblocks); file.read(reinterpret_cast<char*>(&usedblocks),sizeof(usedblocks)); pos = file.tellg(); //pos 3588 //read reserved size file.read(reinterpret_cast<char*>(&reservedsize),sizeof(reservedsize)); pos = file.tellg(); //pos 3592 why happen? i have changed code use fopen, fread, , ftell, , pos values 0, 4 , 8. usedblocks boost::int32 . boost::int32 int , not struct. changing them int gives same result. if looking @ values of pos in debugger, may wrong due optimization. try printing values of pos standard output.

php - Drupal how to change url path -

i have server multiply sites, example have domain http://site.com/ , .htaccess file in server root: rewriterule ^site.com/ - [l] rewritecond %{http_host} ^site\.com$ rewritecond %{document_root}/site%{request_uri} -d rewriterule [^/]$ %{request_uri}/ [r,l] rewritecond %{http_host} ^site\.com$ rewriterule (.*) site.com/$1 [l,qsa] and have installed drupal in path: c:/servers/web/www/site.com/drupal problem site links looks - http://site.com/site.com/drupal/user/logout , found $base_url in settings.php , change , site links looks nice http://site.com/user/logout . create new problem - links redirect me index.php (not working normaly) whats wrong? dont change $base_url>you should not touch that.i think u need virtual host entry in webserver (for apache httpd.conf)upto c:/servers/web/www/site.com

css - Vertically Stack divs inside fixed div -

i have vertical parent container div fixed positioning , height in pixels. have child divs same width parent. how stack these child divs inside fixed parent? uanble through. please help. if want statically, set each child div's top property how want it. so if child divs 50px in height #child1{ position:relative; top:50px; } #child2{ position:relative; top:100px; } and on

Laravel model getting instances of the class -

i developing package in workbench environment. have model like <?php namespace vendor\webshop\models; use vendor\webshop\models\country country; use illuminate\database\eloquent\model eloquent; /** * catalog */ class catalog extends eloquent { // define database protected $table = 'catalogs'; // mass assignment restriction protected $guarded = array('id'); // return countries related catalog public function countries() { return $this->belongstomany('vendor\webshop\models\country'); } /** * returns whether enforce compability check or not */ public function getforcecompabilitytest() { return $this->force_compability_check; } } ?> i wondered if can have custom instance getters like public function getdefaultcatalogs() { return catalog::where('is_default_catalog', '=', true)->get(); }} within class itself. possible or methods available concrete i

performance - Change C code to run fully (including all sections of if) -

note: realise question not clear. have modified now, , apologise making mistake in first place. i have large c project run on embedded system. use arm compiler . code spread across multiple sub-folders, , consists of .c , .h files. i wish take stock of function called how many times, can identify dead code , speed used functions . arm compiler has few options removing unreachable code, fails when function pointers come play so, i'd go through every branch of code , keep count of number of calls function. for example (this very simple program demonstrate looking for, not original code): void foo1(void) { printf("number divisible 5"); } void foo2(void) { printf("number divisible 10"); } void foo3(void) { printf("number divisible neither 10 nor 5"); } void foo4(void) { printf("foo4 called"); } int main (void) { int x; x = rand (11); if (! x%10) { foo2(); foo1(); } else if

spring - Problems with @Autowire annotation (null) -

i have problems 2 services autowired in validator class. services works ok because in controller autowired. i've applicationcontext.xml file , myapp-servlet.xml file. base package es.unican.meteo , have problems package es.unican.meteo.validator. package es.unican.meteo.controller , es.unican.meteo.service can autowire services properly. applicationcontext.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> .... bea

How to send all calls to voicemail except whitelist contacts in Android -

i trying develop app need send calls automatically voicemail except few whitelist contacts ids storing in different table of app. can 1 suggest me right approach of doing this. here code wore, can select contacts in list in order direct calls contacts directly mailbox, or not mailbox. stringbuilder mailboxids = new stringbuilder(""); // stringbuilder collects id of checked contacts in list int visibleitemcount = contactadapter.getcount(); (int = 0; < visibleitemcount; i++) { // iterating visible , checked contacts of list contactitem contactitem = contactadapter.getitem(i); if (contactitem.ischecked()) { mailboxids.append(contactitem.getid() + ","); // creating coma-seperated string ideas later query } } mailboxids.replace(mailboxids.length() - 1, mailboxids.length(), ""); // removing last coma list contentresolver contentresolver = getactivity().getcontentresolver(); contentva

jquery - Best way to build a "select all" checkbox -

i have "select all" checkbox(a) , others related it(b). i hope: when a's checked or not, make of b same a. when of b's checked, make a's checked. when not of b's checked,make a's not checked. using jquery preferred, but there better way coming html5? like: <checkbox id="target" name="select all"/> <checkbox relatetd="target" name="1"/> <checkbox relatetd="target" name="2"/> or xpath if have many subgroups different dom structures: <checkbox id="target" name="select all"/> <div> <checkbox relatetd="../" name="1"/> <checkbox relatetd="../" name="2"/> </div> <checkbox id="target2" name="select all"/> <div> <div> <checkbox relatetd="../../" name="1"/> <checkbox relatetd=".

html - execution of some code inside javascript function -

i have div example code in it. i'd execute code after pressing button. here's i've tried: html <button onclick="javascript:playcode()"> </button> js function playcode () { var execcode= ""; (i=1; i<=countcodeline (); i++) execcode += document.getelementbyid("line"+i).innertext; var div= document.getelementbyid ("mydiv"); var scr= document.createelement ('script', ""); div.innerhtml= "play() {"+execcode+"}"; div.appendchild(scr); play(); } but doesn't work. how can this? update: here errors console: (line 9: pre.appendchild(scr)) uncaught syntaxerror: unexpected token { (line 10: play()) uncaught typeerror: object not function if indeed getting right html execcode, can use eval(execcode); you can check doing simple console.log(execcode) or alert(execcode) verify it's loaded correctly. however, c

How to prevent 3 nested MySQL queries from timing out -

i want delete records in t3 field names in t2 missing, if meet record id t1. the query t1: select max(id) t1 name1 = "xxx" , user_id = '$id' works fine. the t2 query: select name2 t2 record in (select max(id) t1 name1 = "xxx" , user_id = '$id') also works fine, takes while. but t3 query: delete t3 name3 not in (select name2 t2 record in (select max(id) t1 name1 = "xxx" , user_id = '$id')); results in "#2006 - mysql server has gone away" how query result within reasonable time? i think can use join queries instead? select name2, max(t1.id) t2 inner join t1 on t2.t1_id = t1.id name1="xxx" , user_id='$id'

asp.net - Data transfer between pages -

protected void page_load(object sender, eventargs e) { label1.text=request.querystring["fileno"].tostring(); label3.text=request.querystring["sub"].tostring(); ddl_u.selectedvalue=request.querystring["unit"].tostring(); ddl_branch.selectedvalue=request.querystring["branch"].tostring(); } this pageload function of file.aspx page. getting error on querystring when debug file.aspx i have 2 pages named file.aspx , search.aspx . want transfer data search.aspx file.aspx . using querystring transfer data , initialising data controls on pageload function of file.aspx problem file.aspx start page giving error on querystring . so need take care of query string when not available or null. write code inside this protected void page_load(object sender, eventargs e) { if (request.querystring["fileno"] != null) { label1.text = request.querystring["fileno"].tostring(); } if (reque

c - MPI communicate large two dimensional arrays -

related previous question concerning copying of 2- 1-dimensional arrays, wondered if there better way whole business, try achieve. so, want mpi communicated couple of large 2 dimensional arrays (which allocated dynamically arrays of arrays, known size @ compile time) master clients , vice versa. data supposed scattered to/gathered clients column-wise. what doing @ moment map 2-dimensional arrays (which in fact sub-arrays of 3-dimensional ones) statically allocated 1-dimensional arrays, send these 1-dim. arrays via mpi , rebuild 2-dimensional arrays again @ receiver. however, have feeling there should (much) more efficient that... thanks lot! c99 has support dynamic multidimensional arrays: using them can avoid copy data @ all. example following code compile gcc -std=c99 : #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { int m = atoi(argv[1]); int n = atoi(argv[2]); int p = atoi(argv[3]); // if defined in stack... i'm

ios - uitableview cell value not refresh according with the ones in coredata after change -

i'm building master-detail application, saying master view a(tableview), second-view(tableview) b, detail-view c. data core-data. in secondview(tableview), popover prompt cell value change when user tap specific cell. after change on popover screen, dismiss popover, return secondview(tableview) , update core data accordingly. , cell value expected reflect update value. issue doesn't work that. cell value still remains old ones, though core data update new value(i confirmed via nslog in method --tableview:cellforrowatindexpath. print cell's new value, display cell's old value). tried put table-view:reloaddata viewwillappear , popovercontrollerdiddismisspopover method, still doesn't work. i cannot figure out it. cell value on secondview(tableview) update after return view master-view , again switch second-view b. however, second view reflect new cell addition immediately, addition via popover prompt cell new value input. would please this? thanks. -(voi

ios - Container view with freeform doesn't resize when constraints are applied -

i using container views project( 721*1024) , have image-view goes end end , has height 44. if apply constraints image view re-sizes correctly in normal ipad view i.e 768*1024 if use free form container view , apply same constraints doesn't re-size. doing wrong? thanks.

javascript - How to create duplicate object -

Image
i have object nested objects in following way. var g = { "steps": [{ "location": [{ "a": "1" }, { "a": "2" }] }] }; i created duplicate object using object in following way. var h=object.create(g); the problem was,if modify in h , g reflecting.how can prevent this.i tried underscore function( clone ). modified: h["steps"][0]["location"][0]["a"]="3" after modify: g looks like h looks like even if modify in h , g should not reflect. can me. thanks. as per _.clone docs, create shallow-copied clone of object. nested objects or arrays copied reference, not duplicated. shallow copied objects tend show problem experiencing now. if object use doesn't have methods/variables attached it , can this var h = json.parse(json.stringify(g)); this deep copy. note: if object has c

Javascript setTimeOut in For Loop Behaviour -

i curious why , how javascript interpreter outputs following 5 5 5 5 5 when running code: for(var i=0;i<5;i++){ settimeout(function(){console.log(i);},200); }; can provide thorough explanation? it's chronology. remember timeout synchronous operation delayed, time runs, consults i , finds value 5. because last action of (synchronous) loop set value 5: reached 4 (the last iteration of loop) , i++ made 5. if want output 0-4 retain timeout, need capture current, iterative value of i @ time create timeout. can passing immediately-executing function: for(var i=0;i<5;i++) settimeout((function(i) { return function(){ console.log(i); }; })(i),200);

matlab array create random consecutive ones -

i create 4-dimensional array random number of consecutive ones in each row. ones should start in first column , end in random column. example: array(:,:,1,1) = [ 1 1 1 0 0 0; 1 1 0 0 0 0; 1 1 1 1 1 0; ... ] one 3 loops inefficient: array = zeros(n,n,n,n); i= 1:n j = 1:n k =1:n rows = ceil(n*rand()); array(k,1:rows,j,i) = 1; end end end can find better solution? thanks!! simple , straight-up approach (might not random though) rows = 8; %%// number of rows cols = 7; %%// number of columns ch3 = 3; %%// number of elements in 3rd dimension ch4 = 2; %%// number of elements in 4th dimension array = sort(round(rand(rows,cols,ch3,ch4)),2,'descend') bsxfun approach (much faster shown in benchmark results below , random) %%// sizes rows = 8; %%// number of rows cols = 7; %%// number of columns ch3 = 3; %%// number of elements in 3rd dimension ch4 = 2; %%// numb