Posts

Showing posts from March, 2011

java - Problems logging into SQL Server 2012 (64 Bit) -

i programming agent-based simulation based on jade framework. framework creates agents (each agent has own thread) , provides standardized interfaces communication between agents. nevertheless when agents beeing created, accessing ms-sql 2012 (64 bit) server (installed on same machine) @ 1 time. it's easy statement, gives id: "select geoid " + "[weatherman_de].[dbo].[geo]" + " lat_rot = " + loc.getlatit() + " , long_rot = " + loc.getlongit(); the problem is: when start application everything works fine , it's slow works ok. getting different types of errors, lead application crash directly @ beginning. either it's connection reset: com.microsoft.sqlserver.jdbc.sqlserverexception: connection reset @ com.microsoft.sqlserver.jdbc.sqlserverconnection.terminate(sqlserverconnection.java:1352) @ com.microsoft.sqlserver.jdbc.sqlserverconnection.terminate(sqlserverconnection.java:1339) @...

razor - How can I retrieve the the current CSHTML file for more intelligent view selection? -

suppose have partial view "_navbar.cshtml" in views/shared folder that's referenced in layout page... gets embedded on every page. now, suppose have view same name existing in views/controllerx/partial folder, navigation bar specific view. in case, views in other controllers find shared partial view file fine. however, when run view in controllerx, _navbar.cshtml file in views/controllerx/partial ends usurping/overriding 1 in shared/views. so wondering if there's way prefer view based on executing cshtml file. example, if "partial" called cshtml file in shared folder, should prefer other partial views in same folder on ones in more specific controller view locations. in short, there way rig view engine rather having static search path order, it's contextual , looks files in same folder executing cshtml file first?

javascript - How to find the least common multiple of a range of numbers? -

given array of 2 numbers, let them define start , end of range of numbers. example, [2,6] means range 2,3,4,5,6. want write javascript code find least common multiple range. code below works small ranges only, not [1,13] (which range 1,2,3,4,5,6,7,8,9,10,11,12,13), causes stack overflow. how can efficiently find least common multiple of range? function leastcommonmultiple(arr) { var minn, max; if ( arr[0] > arr[1] ) { minn = arr[1]; max = arr[0]; } else { minn = arr[0]; max = arr[1]; } function repeatrecurse(min, max, scm) { if ( scm % min === 0 && min < max ) { return repeatrecurse(min+1, max, scm); } else if ( scm % min !== 0 && min < max ) { return repeatrecurse(minn, max, scm+max); } return scm; } return repeatrecurse(minn, max, max); } i think gets job done. function leastcommonmultiple(min, max) { function range(mi...

sql - Quick SELECT sometimes time out -

Image
i have stored procedure execute simple select. time run manually, runs under second. in production (sql azure s2 database) runs inside scheduled task every 12 ours - think reasonable expect run every time "cold" - no cached data. , performance unpredictable - takes 5 second, 30 , 100. the select optimized maximum (of knowledge, anyway) - created filtered index including columns returned select, operation in execution plan index scan. there huge difference between estimated , actual rows: but overall query seems pretty lightweight. not blame environment (sql azure) because there lot of queries executing time, , 1 1 performance problem. here xml execution plan sql ninjas willing : http://pastebin.com/u5gcz0vw edit: table structure: create table [myproject].[purchase]( [id] [int] identity(1,1) not null, [productid] [nvarchar](50) not null, [deviceid] [nvarchar](255) not null, [userid] [nvarchar](255) not null, [receipt] [nvarchar](max) null,...

php - UPDATE reports successful but not updating the table -

hey trying update table form have: <?php include ('includes/header.php'); require ('../db_con.php'); // check valid document id, through or post: if ( (isset($_get['id'])) && (is_numeric($_get['id'])) ) { // view_docs.php $id = $_get['id']; } elseif ( (isset($_post['id'])) && (is_numeric($_post['id'])) ) { // form submission. $id = $_post['id']; } else { // no valid id, kill script. echo '<p class="error">this page has been accessed in error.</p>'; exit(); } $q = "select * cats cat_id = $id"; $r = mysqli_query($dbc, $q); ?> <form method="post" action="actions/update_cat.php"> <input type="hidden" name="cat_id" value="<? echo $id ?>" /> <input type="text" name="cat_name" /> <br><br> <input type="text...

c# - Dynamically select column name using Linq to Entities (EF6) -

i want encapsulate common scenarios when using ef6. here's example: public class stringrequest : dbrequestproperty { public string name { get; set; } public bool? exactmatch { get; set; } protected override bool isvalid() { return !string.isnullorwhitespace(name); } private bool requestexactmatch() { return exactmatch.hasvalue && exactmatch.value; } protected override iqueryable<t> execute<t>(iqueryable<t> original, string propertyname) { return requestexactmatch() ? original.where(o => getproperty<string>(o, propertyname) == name) : original.where(o => getproperty<string>(o, propertyname).contains(name)); } } but getproperty can't converted query. i'm thinking on selecting dynamically column using "propertyname". protected override iqueryable<t> execute<t>(iqueryable...

github - Error with git rebase ("could not apply...") -

i'm administrator of github repository https://github.com/plison/opendial . reduce number of commits on repository, since repository has few thousand commits, many of whom minor debugging changes squashed (especially ones few years old). i'm therefore trying apply rebasing in order squash part of commits. however, i've experience following issue: when type e.g. git rebase -i head~10 , quite long number of commit lines (much more 10) in interactive editor. reason? more importantly, once close interactive editor start rebasing, systematically error message "error:could not apply ', even when not make change commits (i.e. if leave lines 'pick', without modification or reordering). how can solve these issues? should noted repository automatically imported previous (svn) repository hosted on google code. conversion seemed far have worked well, i'm wondering why these errors when trying rebase commits. the history of project seems conta...

regex - Replace nth occurence of a character by another -

i hope isn't duplicated, didn't find answer , need regexp wizards. i have string , replace second space found in \n , don't know how use indices (this way) in regular expression : for example : # have : "a b c d e f" # want : > "a b/nc d e f" also know how can "repeat" replacement: each 2 occurences of space replace \n . example : "a b c d e f" > "a b\nc d\ne f" (\\s+\\s+\\s+)\\s+ you can use , replace \1\n or $1\n .see demo. https://regex101.com/r/yg7zb9/29

How to relate two column in PHP MYSQL -

i have created 1 request table contain request information. the table containing these columns: requestid , itemrequest1, itemrequest2, itemrequest3, quantity1, quantity2, quantity3 how make relation if itemrequest has value in column itemrequest2 , take quantity column quantity2 . my query this: $query2=mysql_query("select * tbl_request unit='$unit' , (itemrequest1='$itemrequest' or itemrequest2='$itemrequest' or itemrequest3='$itemrequest')"); $record_num=mysql_num_rows($query2); while ($data1 = mysql_fetch_array($query2)) the problem when $itemrequest has value in column itemrequest3 , quantity show quantity column 1. you can use conditions in query in order select right column depending on column's value. select requestid, (case when itemrequest1 = '$itemrequest' quantity1 else ( case when itemrequest2 = '$itemrequest' quantity2 else ( c...

ubuntu - GTK+ make error: undefined symbol: g_mutex_lock -

i trying install opencv 3.0.0 on ubuntu (9.04) computer need gtk+ first. ./configure goes fine, when try make symbol lookup error: /gtk+-2.18.9/gtk/.libs/lt-gtk-update-icon-cache: symbol lookup error: /gtk+-2.18.9/gdk-pixbuf/.libs/libgdk_pixbuf-2.0.so.0: undefined symbol: g_mutex_lock i can't use apt-get these because distribution eol , i'm trying avoid upgrading if can because i'm not 1 uses , don't want risk messing of theirs if can avoid it. g_mutex_lock symbol glib. it glib version old, or somehow missing linker line. verify linking against glib check glib contains symbol (e.g. nm).

iot - I'm trying to send temperature data from arduino to thingspeak through ESP8266, But I don't have code to configure my wifi. Please help me -

i'm trying send temperature data arduino thingspeak through esp8266, don't have code configure wifi. i'm searching code last 2 days, not working. please provide me code connect local wifi using ssid , password. #include <softwareserial.h> #define buffer_size 512 #define get_size 64 #define dbg serial // usb local debug #include <dht11.h> dht11 dht11; #define dht11pin 7 int ledpin = 13; int lightlevel; string apikey = "20ympja0xii0ief4"; softwareserial ser(2,3); softwareserial esp(11, 12); string ssid = "atl-wl"; string pass = "atl#yd81"; string serverport = "80"; char buffer[buffer_size]; // don't touch char get_s[get_size]; char okrn[] = "ok\r\n"; // don't touch string currentcommand = "0000"; byte waitforesp(int timeout, char* term = okrn) { unsigned long t = millis(); bool found = false; int = 0; int len = strlen(term); while (millis() < t + timeout) { if (esp.ava...

objective c - How to prevent entire map from loading in IOS -

i have mapview many annotations loads when user touches button. problem loading , populating map annotations takes long time. there way prevent unused areas of map loading in ios? there way load part of map using on app? thanks the more annotations have slower map be. recommend either showing less annotations @ time or clustering annotations. here few cocoapods annotation clustering https://github.com/choefele/cchmapclustercontroller https://github.com/yinkou/ocmapview https://github.com/itsbonczek/kingpin

html - Coax web page into showing more data? -

this weird question , don't know if asking correctly, writing java program using jsoup extract names of popular manga website: http://www.mangareader.net/popular . each page shows 30 mangas , there 3950 mangas on website, wondering if possible edit webpage each page show more comics (so wouldn't have keep loading new pages on , on again)? noticed url of webpage: if go http://www.mangareader.net/popular/1 , show comics 2 - 31, , if go http://www.mangareader.net/popular/2 , show comics 3 - 32 . can keep changing url way show different range of comics. maybe that's something? anyhow have crawl pages 1 one. if there exists url increase no of results per page, url known web developer created website.

windows - Automated test between Win-app and Web-app -

i have 2 applications windows-desktop-application administration of datainput , web-application visualisation , report generation. is there way automate tests test can 1 thing in win-app, continue in wep-app , go again win-app in 1 testcase? i have been trying combine autoit win-app , selenium web-app, have problem orchestrate both 1 place. as want automate both windows , web application. suggest go sikuli windows (non-web-) applications. sikuli automates see on screen. uses image recognition identify , control gui components. and people combining selenium , sikuli automation , many examples available in internet. , easy use. have store element images , perform operations on them. can use autoit along it.

Sending a String From One Form To another Form C# -

this question has answer here: passing value 1 form (c#) 1 answer i've been trying send string 1 form named mainform other form unlockform. the references i've found sending values things textboxes. want send string. this done in 2 ways. if trying pass string owner form child form, can in parameter, so: class owner : form { private child child; public owner() { child = new child("value pass"); } } class child : form { public child(string value) { //do value } } if want pass child owner, this: class owner : form { public owner() { child = new child(); child.showdialog(); string childvalue = child.value; } } class child : form { public string value{get;set;} public child() { } protected override void onshown(eventargs e) { base.ons...

Paypal Authorization standard and capture through REST API -

i've been asking myself if there possibility use standard payment page of paypal redirect user "authorize" payment using credit card (using "paymentaction" : "authorization" in redirect form). having ipn setup receive auth_id. later on "capture" amount (equals or less) using paypal rest api using "auth_id" received through ipn ? seems "authorization_id" received through paypal rest api "authorize" same length. somehow suppose same value. before implementing such wonder if tried before ? thank you you can using standard (website payments standard) page creat authorization paired "classic" authorization api, cannot mix classic , rest apis described. the rest apis store different/additional information on paypal's server side, in general cannot manipulate transactions created through classic apis via rest apis (and vice versa complicated , not advised).

SAS: converting a datetime to date in where clause -

i have column in sas dataset of datetime 25.6 format; lets call column datetime. want convert date9 format in clause , check against date or date variable. i have following code: proc sql; select rowid, name, dob, country db.testtable cast(datetime date9.) eq '14sep2014'd ; quit; i error when run above code: error 22-322: syntax error, expecting 1 of following: !, !!, &, ), *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, and, between, contains, eq, eqt, ge, get, gt, gtt, in, is, le, let, like, lt, ltt, ne, net, not, notin, or, ^, ^=, |, ||, ~, ~=. error 202-322: option or parameter not recognized , ignored. i same error message if use following proc sql; select rowid, name, dob, country db.testtable cast(datetime date9.) = '14sep2014'd ; quit; is there better way cast datetime date9 format in sas? on appreciated in sas use datepart() function extract date value datetime value: where ...

python - Difference between [y for y in x.split('_')] and x.split('_') -

i've found this question , 1 thing in original code bugs me: >>> x="alpha_beta_gamma" >>> words = [y y in x.split('_')] what's point of doing this: [y y in x.split('_')] ? split returns list , items aren't manipulated in list comprehension. missing something? you're correct; there's no point in doing that. however, it's seen in combination kind of filter or other structure, such [y y in x.split('_') if y.isalpha()] .

javascript - Node.js: running setInterval while certain variable is true? -

i have setinterval function , isrunning variable. how stop setinterval when isrunning gets set false? thanks. see comments inline: var isrunning = true; // define outside can accessed inside setinterval var interval = setinterval(function() { // code here // check if variable false, clear interval if (isrunning == false) { clearinterval(interval); } }, 100);

javascript - parsing directory listing of a webpage in angularjs -

i need parse directory listing of external webpage in angularjs. found few solutions problem, in php. there anyway can in angularjs? i making $http.get call html. want parse html , convert json or xml. structure of html shown below <head> </head> <body> <table> <tbody> <tr> <th> <img src = "abc.jpg"></th> .... </tr> </tbody> <table> </body> $http.get give html content of remote page. parsing has nothing angular. see this answer solutions, html form of xml. once have built json structure, angular can nicely display it.

What tools are there to visualise the merge structure of dozens of git branches? -

Image
i started @ new company few months ago , new git. have used svn , bk before of concepts not alien me. problem have understanding 80+ branches exist. handful of them have names release-#.# or maintenance-#.#.# can guess relate to. many of others seem feature or product branches. logs suggest handful active in last 6 months. background reading far suggests not how git or other vcs repos should end up. what tools available can me visualise spaghetti of on 80 possibly merged or deadended branches? i have found gitg --merges --all 1 gives ok representation although quite cluttered. gitk --merges --all 2 not in prefered aesthetic style can see job of decomposing problem isolated chunks. perhaps let me have a1 plot of in 1 go helpful? ultimately i, , believe few of existing programmers, tidy things bit. knows of these branches meant temporary , finished did merged main development lines? has rather organic growth feeling , want know not cut off root thinking dea...

java - Cannot start another activity through super activity by overriding startActivity(Intent) -

i have a, activity class a overrides startactivity(intent) . checks intent , pass super activity calling super.startactivity(intent) . activity in module. now created project , added module. have activity class inside project named b extends a . b calls activity c within same project. if b not extend a can call c . whenever extends a , nothing happens. might problem. tried print current class , called class in super activity a , can see intent ok. whenever want call c via a through method nothing happens. here code snippet. public class extends activity{ @override public void startactivity(intent intent) { //do here. not modifying intent super.startactivity(intent); } } and in activity b, public class b extends { //somewhere in button handler intent intent = new intent(b.this, c.class); startactivity(intent); } what can see code startactivity inside a called indeed. when pass intent super, nothing happens. if b...

IplImage convert to bitmap -

i writing android program merge 2 video 1 video. willing iplimage video. according finding, need convert iplimage video bitmap can merge them 1 picture. so, tobitmap() method required. can give me idea on how convert imagebox image bitmap base on function?

I'm trying to create my first web form app using c# -

i'm trying create first web form app , trying use checkbox giving me issues. want submit button deduct database , ive done checkbox private void bindgrid() { try { sqlconnection con = new sqlconnection("data source=w-it004\\mssqlserver2012;initial catalog=mydatabase;user id=sa;password=qwerty;pooling=false"); con.open(); sqlcommand cmd = new sqlcommand("select [title], [duration], [oldborrowprice] ,[damage price] movie", con); sqldataadapter da = new sqldataadapter(cmd); datatable dt = new datatable(); da.fill(dt); gridview1.datasource = dt; gridview1.databind(); con.close(); da.dispose(); } catch (exception ex ) { string exx = ex.message; } } protected void borrowbutton_click(object sender, eventargs e) { } here have dat...

linux - Logstash -Could not find any executable java binary -

i have elk installed on vm in laptop.elasticsearch , running. ./bin/logstash -f logstash-filter.conf gives me below error not find executable java binary. please install java in path or set java_home. i tried setting java_home , $ path , still issue persistent. missing something? java /usr/bin/java java -version java version "1.7.0_79" openjdk runtime environment (icedtea 2.5.5) (7u79-2.5.5-0ubuntu0.14.04.2) openjdk 64-bit server vm (build 24.79-b02, mixed mode) echo $java_home /usr/local/java/jdk1.8.0_45 echo $path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/divija/bin:/usr/local/java/jdk1.8.0_45/bin logstash-filter.conf input { stdin { } } filter { grok { match => { "message" => "%{combinedapachelog}" } } date { match => [ "timestamp" , "dd/mmm/yyyy:hh:mm:ss z" ] } } output { elasticsearch { host => localhost index=>"my...

android - How to upload leak traces of leakCanary to HipChat room -

https://gist.github.com/pyricau/06c2c486d24f5f85f7f0#file-squaredebugapplication-java i trying follow code here upload leak traces hipchat room. i'm pretty sure using valid auth token , room number, nothing happens there. did register service , override install() method specific service. has succeeded in doing that? advice appreciable.

opencv - How to set Gabor filter parameters to extract wrinkle features -

i trying implement wrinkle feature extraction method using gabor filters in opencv c++ outlined in study: choi, sung eun, et al. "age estimation using hierarchical classifier based on global , local facial features." pattern recognition 44.6 (2011): 1262-1281. the filters have input patches of skin face image, , need extract thick , fine wrinkles. don't know parameters use wrinkles since examples on internet deal edges formed objects. after getting output image of convolution, need find mean , variance of magnitude response. it great if found study on forming gabor kernels wrinkles, sample code, or neat way figure out best parameters.

java - How to transfer data between spring flows? -

i have set of data not necessary store in database. @javax.persistence.entity @table(name = "users") public class userentity extends entity { private static final long serialversionuid = -7807480090652491368l; @transient private set<long> productsids = new linkedhashset<long>(); } also, have 2 flows: cabinet : <secured attributes="role_user" /> <on-start> <evaluate expression="userservice.loaduserentitybyemail(currentuser.name)" result="flowscope.user" /> </on-start> <view-state id="cabinet" view="main.xhtml"> <transitions... </view-state> <view-state id="cart" view="cart.xhtml"> <transitions... </view-state> <end-states... content : <on-start> <evaluate expression="currentuser!= null ? userservice.loaduserentitybyemail(currentuser.name) : null" ...

java - HQL inner join query exlude objects in ManyToOne set member -

i have translations class e.g.: class translation{ string key; string type; string userid; @onetomany set<translationvalue> translations; } which holds onetomany relationship translationvalue class e.g.: class translationvalue{ string language; string value; @manytoone translation translation; } i query based on translationvalue.language member , return list of translation objects contain set 1 translationvalue object -> 1 used query parameter e.g: translationdao.findallforlanguage("en"); this return every translation object in db has translationvalue.language = "en" , furthermore remove each object translation.translations language not "en". so far i'm returning list of translation objects have translationvalue object language="en" member in respective translations sets. need remove translationvalue objects don't have language="en" though. ed...

android - what is the best way to set the tab layout tabmode for tablets? -

i using tablayout android design support library. how can use mode_scrollable along gravity_fill looks same across devices , orientations? currently if use mode_scrollable, looks on 7" tablet, on 10" tablet, tabs aligned left. want able use gravity_fill sizes. this tablayout: <android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="72dp" /> and setting mode in code tablayout.settabmode(tablayout.mode_scrollable); per tablayout.gravity_fill documentation : gravity used fill tablayout as possible. option takes effect when used mode_fixed . therefore setting mode mode_scrollable, tabs aligned starting edge - difference between tablets , phones mode_scrollable minimum width of tabs, set tabs material design spec . note can specify both gravity , tab mode via xml if want set view scrollable: <android.support.des...

ios - iPhone: URL scheme not working from mail client -

i have created url schemes in app. wanted open app email. copy custom url scheme myapp:// in browser , opening app. when try opening email in ios mail client, doesn't open. there needed done open app email? in e-mail body, should write content in html format. here require hyperlink there should <a href> ... </a> for example: <a href="myapp://">launch myapp</a> hope helps.

javascript - all relative URLs get converted into absolute -

this issue exists in chrome , firefox not ie. i have angular app. once view loaded, xhr requests made relative paths converted requests absolute path. example: i navigate http://example.com/foo/#/bar in chrome dev tools type: var xhr = new xmlhttprequest(); xhr.open("get", "ping", true);//or "./ping" xhr.send(); the result 404 error , network tab shows request made http://example.com/ping instead of http://example.com/foo/ping . what can possibly cause behavior? turned out rogue <base href="/"> tag.

php - Super globals, are they common to all clients? -

are super globals such $_post or $_session common clients or web server have "under hood" method creating new contexts each request? for example, i'm working on site users can browse content on site must login make changes. login done through ajax. lets imagine 2 users "a" , "b", using different computers, have both logged in , navigate same part of site has form can add information, new concert listing. each form sent via ajax php file processing. because both forms instances of same form keys same. user "a" fills out form , submits first. key:value pairs of form in $_post variable. after user "b" submits form different set of values. did user "b" overwrite of form data in $_post super global user "a" had written?

javascript - Trying to find the regex for pretty URLs -

i have website structure this: /docs/one_of_the_resources/one-of-the-resources.html /docs/a_complete_different_resource/a-complete-different-resource.html i want rid of sub-folders in url , this: /one-of-the-resources.html /a-complete-different-resource.html sub-folders should not affected: /docs/one_of_the_resources/assets/* the folder name same html file dashes swapped underline , of course there no suffix. i'm using grunt-contrib-rewrite , grunt-connect. can't wrap head around it. possible? you can use negated character class /\/[^/]+$/ [^/]+ matches other / . quantifier + ensures 1 or more characters. $ anchors regex @ end of string. regex demo example string = "/docs/one_of_the_resources/one-of-the-resources.html"; console.log(string.match(/\/[^/]+$/)[0]); // => one-of-the-resources.html

json - SwiftyJson errors in swift 1.2 -

swiftyjson seems break in swift 1.2, majority of errors as! not as, there more tricky ones https://github.com/swiftyjson/swiftyjson has found resolution this, there mention of xcode6.3 branch think dead really stuggling json parsing now using cocoa pods above comment suggests works

c++ - Cancel connection is boost::asio -

from standard ssl client example. call function. boost::asio::async_connect(socket_.lowest_layer(), endpoint_iterator, boost::bind(&sslclient::handle_connect, this, boost::asio::placeholders::error)); but function called, , program connecting. cancel request , stop connection! how can that? special case: have objects in thread. there way in case? now if try this, program doesn't respond. don't see way force stop! there several ways achieve want ¹. you hard-stop service ( service.stop() ). leaves no control on running operations. it's "nuclear" approach, say. the controlled way call cancel() cancel asynchronous operations associated socket. socket_.cancel() now, have additional task of maintaining lifetime of connection object (presumably this in bound completion handler). common pattern use make connection class derive enable_shared_from_this , ...

Finding a multiple function keeps returning true and is there a simpler way to write this function in python -

this question has answer here: how check whether number divisible number (python)? 8 answers def is_multiple(m, n): """ >>> is_multiple(12, 3) true >>> is_multiple(12, 4) true >>> is_multiple(12, 5) false >>> is_multiple(12, 6) true >>> is_multiple(12, 7) false """ c = m / n d = int(m / n) if (c-d)== 0: return true elif (c-d)!= 0: return false i trying make function decides if m multiple of n. can use have learned functions, if/else, if/elif/else statements, boolean expressions , simple things that. have not gotten for, while, do/while expressions yet. code keeps returning true false in 2 cases. why keep returning true, , there more simpler way write function finding multiple of number? upd...

android - getMaxAmplitude() always returns 0 -

Image
i'm trying sound level pressure expressed in decibel 0 . (the output of textview -infinity because log(0) = -infinity . public class slp extends activity{ textview sound; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.sound_activity); mediarecorder recorder = new mediarecorder(); recorder.setaudiosource(mediarecorder.audiosource.mic); recorder.setoutputformat(mediarecorder.outputformat.three_gpp); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); timer timer = new timer(); timer.scheduleatfixedrate(new recordertask(recorder), 0, 500); } private class recordertask extends timertask { textview sound = (textview) findviewbyid(r.id.decibel); private mediarecorder recorder; public recordertask(mediarecorder recorder) { this.recorder = recorder; } public void run() { runonuithread(new runnable() { @overrid...

java - Invalid <url-pattern> null in servlet mapping in Tomcat 7 -

i know followed specification servlet-mapping , created servlet using netbeans 7.0. here web.xml <servlet> <servlet-name>selection</servlet-name> <servlet-class>com.package.sample.selection</servlet-class> </servlet> <servlet-mapping> <servlet-name>selection</servlet-name> <url-patern>/selection</url-patern> </servlet-mapping> on catalina log files severe: error deploying web application directory client java.lang.illegalargumentexception: invalid null in servlet mapping @ org.apache.catalina.core.standardcontext.addservletmapping(standardcontext.java:3155) @ org.apache.catalina.core.standardcontext.addservletmapping(standardcontext.java:3130) @ org.apache.catalina.deploy.webxml.configurecontext(webxml.java:1301) @ org.apache.catalina.startup.contextconfig.webconfig(contextconfig.java:1350) @ org.apache.catalina.startup.contextconfig.configurestart(contextco...

c - qsort a dynamic array -

i using dynamic array found online header file looks this: typedef struct { int size; // slots used far int capacity; // total available slots void **data; // array of data we're storing } vector; void vector_init(vector *vector); void vector_append(vector *vector, void* value); void* vector_get(vector *vector, int index); void vector_set(vector *vector, int index, void* value); void vector_double_capacity_if_full(vector *vector); void vector_free(vector *vector); i have struct looks this: typedef struct _item{ char name[maxnamesize]; float price; } item; i have created vector using vector vector; vector_init(&vector); and added number of items using vector_append(&vector, item); multiple times item of type item. want sort dynamic array item price. have tried doesn't work qsort(vector.data, vector.size, sizeof(item*), compare); my compare function is int compare(const void* a, ...

javascript - Catching SyntaxError caused by bad JS loaded via jQuery.load() -

i have javascript control loads page containing html , javascript needed page. initially operated under yagni /kiss assumptions , kept javascript in single large functions.js file; number of pages has grown, , moreover, several of them variations need different instantiations of same functions. so find useful able write <div>...<button id="object123">don't click me!</button>... </div> <script> $('#object123').on('click', function(){ alert("i said not click!"); }); </script> and load with // error checking omitted clarity $(divselector).load('page-with-object-123.html'); given have checks in place uniqueness of ids et cetera, problem arises if the script contains syntax error . in case of course execution stops, what's more, error inside jquery (the point .load executes <script> tag). not immediate track down error originating html. i am able error...

objective c - FBLoginView text only english -

Image
i want localize fbloginview text. searched , don´t find how can solved it. implement under objective-c (xcode). declare iboutlet. localizing facebook strings the sdk installer includes facebooksdk.strings file localizable described in apple's localization guide. can include file in app , localize typical strings file. i took shareit sample fb sdk , added facebooksdkstrings.bundle in project , changed language of simulator , works.

how to redirect a dynamic URL using .htaccess? -

is there way redirect link : http://example.com/?page=profile.php&id=100 to http://example.com/profile.php?id=100 using htaccess ?? way know can redirect http://example.com/?page=profile.php to: http://example.com/profile.php using 301 redirect but asking id in first link use & while in second url use ? there way make redirect taking id parameter in consideration try : rewriteengine on rewritecond %{query_string} ^page=([^&]+)&id=([^&]+) [nc] rewriterule ^ /%1?id=%2 [nc,r,l]

Error: Username already exists [403] Meteor -

i have manually created user on meteor app accounts.createuser , have disabled sign ups user. worked until restarted server , started getting error: error: username exists. [403] i have accounts.createuser under if (meteor.isserver), suspect created user may issue. thoughts? you're running accounts.createuser every time run app. try doing this, create user if there none in collection. if(meteor.isserver) { if(!meteor.users.findone()) { accounts.createuser(....) } }

python 2.7 - Esky, no frozen versions found -

just following online tutorial grasp of esky. tutorial here - @ correct timestamp i can "factorial.py" file run, without esky - that's basic. building exe, in both py2exe , esky form, easy enough. however, when running factorial.py (or .exe) new esky lines included, fails, code below traceback (most recent call last): file "factorial.py", line 4, in <module> app = esky.esky(sys.executable, "http://localhost:8000") file "c:\python27\lib\site-packages\esky\__init__.py", line 249, in __init__ self.reinitialize() file "c:\python27\lib\site-packages\esky\__init__.py", line 317, in reinitialize raise eskybrokenerror("no frozen versions found") esky.errors.eskybrokenerror: no frozen versions found i've got esky .zip file on localhost http server, demo does, , can navigate through browser. note: i'm on python2.7 i've written code, letter letter, lecturer does all appreciated ...

android - Listview items loosing changes on scrolling -

my need : i want implement list of variables can have dynamic no of rows. list contains 3 textviews,1 imageview, 3imagebuttons. user can select row tap. on long tap multiple items can selected. on selection selected row ui changed. selected item change background , image of imageview , 1 image button visible on selection. as user tap on imagebutton image change of image button , other image buttons become visible if items selected , user try select single row tapping other selected items removed. listview items should come original condition. imageview reset default image , imagebutton ll disappear. what tried : i try implement listview using base adapter. define custom row need of 3 textviews, 1 imageview , 3 imagebutton. package com.astron.myapplication; import java.sql.date; import java.text.dateformat; import java.text.simpledateformat; import java.util.arraylist; import com.astron.myapplication.r; import com.astron.myapplication.tssvariableinfo; import androi...

multithreading - Qt5: How to create a (cleanup) task that runs once per day at 3:00am? -

Image
this question has answer here: how emit qt signal daily @ given time? 1 answer i using qt5 under windows7. know how create task using qthread, problem is: how run every day @ 03:00am? thinking qtimer, doesn't seem ok... can't linked somehow 03:00am. just make clear : can't use windows application(s). must coded inside qt app cleaning job too: cleanup history list, trim down 1000 lines (or whatever), etc. so, see can't using taskscheduler or similar windows tools... you can use windows task scheduler

How to configure number of results in Kibana 4 -

we using elasticsearch + kibana 4 central logging system. in dashboard (in "search" table) have 10 pages of results 50 entries. because our system composed of several applications cooperating each other 500 logs entries little. possible configure number of results (per page and/or number of pages) in kibana 4? in kibana 3 configure in dashboard settings, cannot find options in kibana 4. i'm sorry, not sure mean "search table". talking "data-table"-type visualization, or has "discovery" tab, or entirely different ? the former has following param : settings > object > yourdatatable > edit "type": "table", "params": { "perpage": 10 } the latter has following : settings > advanced discover:samplesize (default: 500) (ps : sorry posting answer instead of commenting, don't have enough rep add comment question)

android - Navigate back from an Activity to fragment of another Activity -

i have activity(activity1) several fragments. i'm calling second activity(activity2) 1 of fragments(say fragment c) of first activity. want navigate second activity(activity2) fragment c. but, navigating first fragment of activity1 instead of fragment c. please help. block of code have tried far: in fragment c, categorybutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(getactivity(),activity2.class); getactivity().startactivity(i); } }); in container activity i.e activity1, fragmenttransaction transaction= getsupportfragmentmanager().begintransaction(); fragmentc myfragment = new fragmentc(); transaction.replace(r.id.frame_container, myfragment); transaction.commit(); according official android documentation best way have fragment communicate another activity through associated activity. to avoid mess fr...

twitter bootstrap - Inline forms >> Horizontal forms for mobile resolutions -

i'd have 2 form elements inline desktop resolutions, on phone resolutions, screws look. there easy way take below code , break out of inline stack them if phone resolution detected? <form class="form-inline"> <div class="form-group"> <label class="sr-only" for="exampleinputamount">amount (in dollars)</label> <div class="input-group"> <div class="input-group-addon">$</div> <input type="text" class="form-control" id="exampleinputamount" placeholder="amount"> <div class="input-group-addon">.00</div> </div> </div> <button type="submit" class="btn btn-primary">transfer cash</button> </form> we can using 2 columns on small devices. i wrapped form inside container div. i added single row 2 columns of size 6 small devices....

PHP MySQL: decrypt a column value from a MySQL row that was encypted upon insertion and parse to JSON -

everything working, want decrypt db column containing credit card number database following example: $decp = $crypt->decrypt($encp); the row in question is: 'number' => $row['cardnumber'], the entire code is: // cards $jsonresult = $conn->query("select nameoncard, cardnumber, cardtype, carddate, ccvcode cy_user_credit_cards accountnumber='$accountnumber'"); $creditcard = []; while ($row = mysqli_fetch_assoc($jsonresult)) { array_push($creditcard, [ 'name' => $row['nameoncard'], 'number' => $row['cardnumber'], 'type' => $row['cardtype'], 'date' => $row['carddate'], 'ccv' => $row['ccvcode'] ]); } // convert array json string , echo $ccjson = json_encode($creditcard); echo $ccjson; $conn->close(); i th...

css - How to make icon same/similar physical size on range of different devices? -

i've got problem has me stumped. seems must common issue nowadays, i'm surprised couldn't find question it. basically, have icons appear on site. want them appear same size - touchable size - on every device. old cheap 2.3 samsung new high 2560x1440 high res display, want these icons 1.5" across. similar size on tablets, on computers, etc. what reasonable approach figuring out, without instance making complex table of whole range of devices , screen sizes? you should use absolute measure values (cm, pt, mm, in, pc) instead of relative ones (px, em, %) : .my-image { width: 1.5in; height: 1.5in; }

html - URL string cannot pass to GA Custom Variables via javascript -

i attempting parse url string custom variable in ga using javascript. string want parsed value after parameter etid= so example using www.site.com/?etid=1234kks0 , variable gets returned should 1234kkso . the code using seems work in browser console when recall variable name, not return in ga, function getqueryvariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if(pair[0] == variable){return pair[1];} } return(false); } var etid = getqueryvariable("etid"); _gaq.push(['_setcustomvar',4,'user',etid,1]);

polygon - Rasterize spatialpolygons in R giving raster with NA values -

i having issues converting spatialpolygondataframe raster. when ther conversion, raster has na values. shown below: dl3 [1] class : spatialpolygonsdataframe features : 126 extent : -15.04001, 46.1036, 3.759985, 31.71804 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +datum=wgs84 +towgs84=0,0,0 +ellps=wgs84 variables : 1 names : lfrp min values : 14 max values : 335.2 this how rasterize it: ##to convert raster funr<-function(r){ ext<-raster(extent(r)) crs(ext)<-crs(r) d<-rasterize(r,ext,field=1,update=t) d} dl4<-lapply(dl3,funr) dl4 [1] class : rasterlayer dimensions : 45, 40, 1800 (nrow, ncol, ncell) resolution : 1.52859, 0.6212901 (x, y) extent : -15.04001, 46.1036, 3.759985, 31.71804 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +datum=wgs84 +towgs84=0,0,0 +ellps=wgs84 data source : in memory names : layer values : na, na (min, max) what can doing wrongly? need method ensure va...

java - AspectJ - Pointcut at specified method with a param annotated with class level annotation -

in aspect, i'd stop @ specified method. method has 1 parameter annotated class level annotation: the annotation is: @retention(retentionpolicy.runtime) @target(elementtype.type) public @interface auditable {} the parameter object of class annotated like: @auditable public class user {} the method inspect: public object findsingleresultbyexample(final object entity) {} this aspect not working: @afterreturning(value="execution(* org.wtp.repository.genericdao.find*(@org.wtp.aspects.auditable (*)))", argnames = "joinpoint, result", returning = "result") private void auditfindannotation(final joinpoint joinpoint, final object result) {} first of all, advice method must public , not private . please change into public void auditfindannotation(...) it not working because pointcut intercepts methods @auditable parameter annotation. sample method not have such annotation, though. work if method signatur...