Posts

Showing posts from September, 2010

mysql - Replace the id's with name using single query -

select team_with.participant1,team_with.participant2,team_with.participant3 event,team_with team_with.for_event_no=event.event_no , event.event_no=4 , team_with.participant1=9 or team_with.participant2=9 or team_with.participant3=9; i have written particular query, , obtained required id's in row. not able modify query such that, in place of these id's, names connected id's displayed. the student_detatil table consists of pk(sam_id) , attribute name . ids displayed present query fks connected student_detail.sam_id. . it seems bad design multiply columns storing different participants. consider creating separate row each participant , storing them in table. joining logic easier. also, please use explicit join syntax - makes query clearer , easier understand separating join logic conditions data retrieval. remember operator and has precedence on or , event.event_no = 4 not apply each participant condition. believe mistake, 1 judge. as...

Not able to convert RAW Image File(*.ARW) to jpg in java -

i tried using jrawio , other lib couldn't convert arw raw image file jpg. can ? below code tried test : bufferedimage image= imageio.read(new file("d:/sony_a500_05.arw")); imageio.write(image, "jpg", new file("d:/a.jpg")); got exception : exception in thread "main" java.util.nosuchelementexception: no tags key = srf2 key @ it.tidalwave.imageio.raw.directory.getinteger(directory.java:587) @ it.tidalwave.imageio.srf.sonysrfmakernotesupport.getsrf2key(sonysrfmakernotesupport.java:34) @ it.tidalwave.imageio.srf.sonymakernote.loadall(sonymakernote.java:120) @ it.tidalwave.imageio.tiff.tiffimagereadersupport.processmakernote(tiffimagereadersupport.java:447) @ it.tidalwave.imageio.tiff.tiffimagereadersupport.processexifandmakernote(tiffimagereadersupport.java:404) @ it.tidalwave.imageio.tiff.tiffimagereadersupport.processmetadata(tiffimagereadersupport.java:380) @ it.tidalwave.imageio.raw.rawimagereade...

r - Grouping words that are similar -

Image
companyname <- c('kraft', 'kraft foods', 'kfraft', 'nestle', 'nestle usa', 'gm', 'general motors', 'the dow chemical company', 'dow') i want either: companyname2 kraft kraft kraft nestle nestle general motors general motors dow dow but absolutely fine with: companyname2 1 1 1 2 2 3 3 i see algorithms getting distance between 2 words, if had 1 weird name compare other names , pick 1 lowest distance. have thousands of names , want group them groups. i not know elastic search, 1 of functions in elastic package or other function me out here? i'm sorry there's no programming here. know. way out of area of normal expertise. solution: use string distance you're on right track. here r code started: install.packages("stringdist") # install package library("stringdist") companyname <- c('kraft', 'kraft foods', 'kfraft', 'nestle...

mysqli - how to rectify this "SQL syntax" in php&mysql -

i'm trying create tagging sys demo here. , i'm stumped why error you have error in sql syntax; check manual corresponds mariadb server version right syntax use near '#ok )' @ line 1 here code: $insert=mysqli_query($conn, 'insert `hashtag` (posts) values ('.$data1.')') or die(mysqli_error($conn)); any appreciated. in mysqli query don't have put $conn . remove , in query put '".$data1."' , check.

python - How to remove a cell of certain value from a CSV file -

i've csv file has got single cell @ last row. need find delete. e.g. total1254612 the value of total won't same time causing problem. you can leverage fact know there 1 value , first 5 letters 'total' . rewrite lines don't meet these conditions new file: f_original = open(fname, 'r') f_new = open(fname+'_new.csv', 'w') #iterate through lines line in f_original: if line.startswith('total'): f_new.write(line) f_original.close() f_new.close()

php - How to show two views of one controller in the same page CAKEPHP -

i have doubt few days ago. hope explain well, , sorry english. im working cakephp, well, have controllers own views, etc.. happens is: have 2 functions in controller, , want that, when mouse click on 1 element (in case, google chart pie chart) of view "one", want execute other function of controller (that renders view "two") view one, but, in same page. i know how treat click on pie chart, isnt problem. problem is, how keep visible view 1 when treat click on , go other view two. mean, want have in end, page default 2 views, 1 , two, each has own function in controller, isnt simple view, text, table... i have tried solutions: requestaction, href of javascript, helpers... dont solution. i'd grateful if me! question ask me, , hope have explained , understand english! greetings! the way can making element 1 of views , add element in other view. can add element in view $his->element('elementname'); . see http://book.cakephp.org/1.3/e...

jquery - Firefox and IE not downloading MP4 file from different origin -

i've case in chrome working fine firefox , ie not. case: need download mp4 file different origin using button anchor tag. below code it: <a id="lnkdownloadvid" class="btn-download" href="www.downloadlink.com/downloadvideo.mp4" download="testdownload.mp4"> <span>download atv</span> <span> <img src="../app_themes/default/images/example/download-icon.png" style="width: 15px;" /> </span> </a> my domain www.example.com , i'm trying download www.downloadlink.com video file named "downloadvideo.mp4". issue i'm facing in firefox , ie instead of downloading starts streaming video, need download video instead of streaming. can have solution either using jquery or html5 ? don't want use server side because video file size huge (approx 100+ mb).

node.js - Saml Implementation Using NodeJS/Passport -

i want implement saml using passport module of node js using own idp. below links found using openidp/adfs/shibboleth etc. https://github.com/bergie/passport-saml https://github.com/lmarkus/passport-saml-encrypted https://www.npmjs.com/package/saml2js i have created 2 localhost apps ,one functioning sp(service provider) ,other idp(identity provider) , while redirecting sp idp sending encrypted saml , validating user using passport ldap module,but need know whether certificates/public/private key needs present @ idp side ? how idp send response , in format ? if signing authnrequest or encrypting token idp needs public keys. the sp needs idp token signing public key. the idp send authnresponse contains saml token contains assertions (claims). the easiest way see use fiefox saml tracer add-on.

c# - Convert DataRow to Dictionary using LINQ -

i need convert datarow dictionary using linq. the code below datarow, next step need convert dictionary(columnname, rowvale) var workweekdata = data in mworkweekdata.asenumerable () data.field<string> ("code") == code select data; it's possible, yes: var dict = row.table.columns .cast<datacolumn>() .todictionary(c => c.columnname, c => row[c]);

java - Using Adapter and Item Holder, Hide views from List View -

i want show text view shown in image below, have remove other views (as have taken text view, image view , video view in single xml). using item holder show text view, , want hide video view , image view together. m trying code not working. itemholder.textviewmessage = (textview) convertview .findviewbyid(r.id.messagedetail); if (itemholder.textviewmessage != null && messagebean.getmessage()!=null) { itemholder.textviewmessage.settext(messagebean.getmessage()); // here showing text messages. itemholder.imageview2.setvisibility(view.gone); itemholder.videoview.setvisibility(view.gone); } [1]: http://i.stack.imgur.com/psktl.png [2]: http://i.stack.imgur.com/xycmb.png in images given above, don't need space below text. here image view , video view showing space, want invisible. here view.gone not ...

sql - Composite Key becomes not unique -

how go fixing existing year database uses composite key fields school , year no longer represent unique row? 1 of these schools releasing biannual yearbook. should generate id , use primary key? i suggest adding semester or term field. create surrogate key, adding field composite key gives flexibility handle quarters/semesters neatly.

testng - How to run only tests that contain both groupA and groupB (both. not either or) -

is possible in testng run tests contain 2 groups (groupa & groupb) not tests contain 1 or other e.g: method1 has groupa & groupb method2 has groupb method3 has groupa goal: want run tests contain both groupa & groupb not tests contain 1 or other. in case, want method1 executed. is possible? not "plain" xml config operates includes , excludes. take @ tasty feature of using beanshell scripts inside <method-selector> tag. some usage example available @ http://blog.strug.de/tag/testng/

JQuery UI controls not working after jquery.js loads after jquery.ui.js -

i'm having issue working jquery ui. i'm working on product (widgets) deployed in page multiple other widgets installed. i've referred jquery.js first , jquery.ui.js after in widget , i'm using jquery ui controls calendar, tooltip etc. but when deployed in common page see other widgets loading jquery.min.js. getting loaded after jquery ui script file loaded. because of none of jquery ui controls loading since jquery ui objects getting overridden. so how can make sure jquery ui controls work in scenario? maybe put own plug-in , jquery.ui.js after widgets , don't load jquery again? sounds weird situations because normally, widget should not load jquery on own. if allowed modify widgets, maybe go in , remove part loads jquery.

jquery - Pull bean value as String for Javascript use -

i'm trying set component's text based on bean's value. i'm using jquery because text changes depending on conditions. so, jquery code looks this: window.onload =function(){ $('.pnx-inline-input').on("change keyup paste", function(){ var savetext = #{extra.active_save}; $('.save-button .pnx-btn-text').html(savetext); }); the bean handles localization. so, let's locale france, , text enregister. thing when rendered page, code segment looks this window.onload =function(){ $('.pnx-inline-input').on("change keyup paste", function(){ var savetext = enregister; $('.save-button .pnx-btn-text').html(savetext); }); of course, enregister not defined anywhere, , causes error. need have code like var savetext = "enregister"; for make sense. how can make happen? thanks! jsf in context of question merely html code generato...

Wee little issue with using I/O files in C++ (strategic couts didnt help) -

so code take inputfile ( warehouse.txt ) add info ( fruitname , fruitquantity ) array put info file ( warehouse.txt ) plus info array output file ( updated.txt ). now issue want use output file ("updated.txt") input file , in code you'll see how i've done this. problem when open file ( updataed.txt ) try , use input file strategic cout says can't open file cant aggregate data (main aim of program sort files there's 1 fruit name corresponding quantity): (look @ lines 35 , 36 , tell me please if can/cant inputfile?) run program yourselves , you'll see didn't open updated.txt , make quick txt file warehouse.txt e.g { apple 4 apple 2 pear 3 mango2 pear 3 } my code looks this: #include <iostream> #include <string> #include <cstdlib> #include <fstream> #include <stdlib.h> #include <stdio.h> using namespace std; typedef struct items { string name; int quantity; } items_t; void fileopenchecker(ifs...

javascript - Removing object/array difference from different arrays -

this question has answer here: remove objects array object property 8 answers i have 2 javascript objects: object_1 = [ {'value': '9:00', 'text':'9:00 am', 'eventtime':'09:00:00' }, {'value': '9:30', 'text':'9:30 am', 'eventtime':'09:30:00' }, {'value': '10:00', 'text':'10:00 am', 'eventtime':'10:00:00' }, {'value': '10:30', 'text':'10:30 am', 'eventtime':'10:30:00' }, {'value': '11:00', 'text':'11:00 am', 'eventtime':'11:00:00' }, {'value': '11:30', 'text':'11:30 am', 'eventtime':'11:30:00' }, ]; object_2 = [ {'eventtime': '10:30:00'}, ...

How to install GNU gettext on windows 7? -

i need install version 0.15 or higher of gnu's gettext can use i18n feateres django. i've downloaded : http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.1.tar.gz from https://www.gnu.org/software/gettext/ however have no idea how install , there's no installation guide on website. how can install ? i'm maintaining github repository windows binaries of gettext , iconv (i updated latest gettext version: 0.19.3) you can find here: http://mlocati.github.io/gettext-iconv-windows/ to see how compiled them (if want yourself) take @ https://github.com/mlocati/gettext-iconv-windows

php - Creating Encrypted Zip in Codeigniter -

Image
in codeigniter controller have following code zip backup file database. problem when extract zip file, instead of single file inside, there other folder path inside of it. $this->load->dbutil(); $this->load->helper('date'); $this->load->helper('file'); set_time_limit(0); $prefs = array( 'format' => 'txt', // gzip, zip, txt 'filename' => 'backup.sql', // file name - needed zip files 'add_drop' => true, // whether add drop table statements backup file 'add_insert' => true, // whether add insert data backup file 'newline' => "\n" // newline character used in backup file ); $backup = $this->dbutil->backup($prefs); $file = fcpath.'gb_dump_backup/backup.txt'; $zip = fcp...

html - session_start malfunction php -

ok site working while ago happened when tried debugging. session_start(): cannot send session cache limiter - headers sent (output started @ ----------------:2) in ---------------------- on line 3 (the hyphens same site in same page) and here codes in first 4 lines: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <?php session_start(); include("includes/side_reservation.php"); ?> and can assure there no session_start() inside side_reservation.php , anywhere else tried searching file itself. can't figure out anymore. your doctype declaration being output before session start being called, resulting in "headers sent" message when trying set session header, start session before output browser. <?php session_start(); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1...

bash - How could I remove a row which three components of a row in one file is similar to another file? -

this question has answer here: how compare 2 files , remove similar rows in them (bash script) 3 answers i have 2 files format of data , space character in them different. want compare these 2 files , if first 3 columns of each row in file1 similar file2, remove these rows file2 , save rest of file2 in file2. example: file1: 4775.00 5215.28 23.9655 7 2.54766 4568.06 5611.74 22.0619 56 2.36560 file2: 6944.69 5605.22 22.6416 44 2.31929 0.914626 1619.15 5597.93 23.7979 12 2.38169 0.684619 5986.66 5599.89 23.8822 6 2.99171 0.384949 4568.06 5611.74 22.0619 56 2.36560 0.973764 1365.00 5601.16 23.3325 15 3.78138 0.212834 1787.81 5209.01 23.4643 8 3.34705 0.486087 5287.90 5244.40 21.9990 104 5.28082 0.000269982 4775.00 5215.28 23.9655 7 2.54766 0.467107 9024.54 5235.34 21.0784 120 3.13061 0.0357055 cheers. ...

jquery - Setting the height of an absolutely positioned div to the height of its contents -

ok, feel question has been asked before here, after hour of searching google cannot find solution this. i have div styled this: position: absolute; height: 100px; and when contents of div changes, want set height of div height of contents of div. using jquery. how can done? you can use: min-height: 100px; reference: https://developer.mozilla.org/en-us/docs/web/css/min-height if whatever reason can't use that, or want else, can height of content of element, regardless of height of actual element, using scrollheight property of html element: https://developer.mozilla.org/en-us/docs/web/api/element.scrollheight in jquery: $(...).prop('scrollheight')

java - Windows Username using request.getRemoteuser() or request.getPrincipalUser() authentication issue -

i have requirement in need send links user has requests pending @ role. when user clicks on link, can access application skipping login creating session. need use windows username. tried using system.getproperty("user.name") giving user name host dependent, means giving username of particular host. need windows username of user sending request. tried using request.getremoteuser() , getprincipaluser() facing authentication issues. can me regarding issue?

javascript - How to show/hide div tags based on the selection of a radiobutton in a form -

i'm using 2 radiobuttons('reviewed' , 'not reviewed') in search box filter values in admin.php. there 2 buttons('approved' , 'rejected') in search box has displayed when 'reviewed' clicked , hidden when 'not reviewed' clicked. below code of search form. <div class="row"> <?php #echo $form->label($model,'revieweddate'); ?> <?php echo $form->radiobuttonlist($model, 'revieweddate', array('1' => 'reviewed', '' => 'not reviewed') ); ?> </div> <div class="row"> <?php echo $form->radiobuttonlist($model, 'approved', array('0' => 'rejected', '1' => 'approved') ); ?> </div> <div class="row buttons"> <?php echo chtml::submitbutton('search'); ?...

java - Array Initialization: int versus other Objects -

i'm confused on whether need array initialization... for code: private int[][][] rpos = new int[size][size][2]; can start using array right way, following line? getlocationonscreen(rpos[i][j]); // pass array of 2 integers and, code: view[][] allviews = new view[size][size]; i have make nested loop, , initialize every view calling constructors so: for (int = 0; < size; i++) { (int j = 0; j < size; j++) { allviews[i][j] = new view(ctor1, ctor2); } } my question is, why didn't need integer array? , also, did "new" keyword do, when typed view[][] allviews = new view[size][size]; ? why didn't need integer array? whenever create array, array elements assigned default value component type of array. int , default value 0 , int[] , elements initialized 0 default. with reference type, however, default value null . so, issue arrays that, might potential nullpointerexception , when try access property or method in...

windows - Renaming Folder Structure in Batch -

) in order make company (where i'm working) operate more organized , efficiently we've created approved folder structure new projects. new projects , live projects reside on file server , @ same level each other. (live projects have made through planning, new projects go far planning) the project folder structure can meticulous create each time start new project, therefore made windows batch file create it. can find here: http://pastebin.com/mnsu5vnk part works well! the folder structure is: f:\new job\project name\project correspondence f:\new job\project name\project directory f:\new job\project name\project drawings f:\new job\project name\project images f:\new job\project name\project correspondence\arboriculturalist f:\new job\project name\project correspondence\cgi f:\new job\project name\project correspondence\client f:\new job\project name\project correspondence\measured survey f:\new job\project name\project correspondence\planning f:\new job\...

android - Cordova - Unable to access jarfile c:\...\cordova\appinfo.jar -

i've created cordova project following commands: cordova create -d hello cd hello cordova -d platform add android cordova -d build cordova -d emulate android and last command output is: failed application name appinfo.jar + androidmanifest: output: error: unable access jarfile c:\hello\platforms\android\cordova\appinfo.jar any clues why happening? cordova -v : 3.09 ant -version : apache ant(tm) version 1.9.2 compiled on july 8 2013 java -version : java version "1.7.0_13" java (tm) se runtime environment (build 1.7.0_13-b20) java hotspot(tm) 64-bit server vm (build 23.7-b01, mixed mode) so: windows 7 64-bits i had same error - turned out there incorrect version of java in system32 folder (see this answer ). once removed incorrect files able install on emulator.

c++ - Mat subtraction with OpenCV in Java -

i'm trying convert opencv code c++ java, i'm stuck @ code: mat matxyz; // mat mat result; // other mat // ... set above mats values ... result = mat::ones(matxyz.size(), cv_32f) - result; first, don't understand last line does. second, don't know how transfer line java (opencv 2.4.6), there no overloaded operators in c++, , not find comparable method in java class (see opencv javadoc ). what best way transfer java? there matrix operations in org.opencv.core.core class, including subtraction operators. mat endresult; core.subtract(mat.ones(matxyz.size(),cvtype.cv_32f),result,endresult); the last line of code creates matrix filled ones, same size matxyz , data floating point numbers. described in docs linked.

linux - multiarch reposync on redhat -

question here downloading rh repos. have licensed redhat 32 bit system. automatically pulls rhn 32 bit repo using reposync. however, trying pull 64 bit repository on same system. not want burden myself adding 64 bit system. no matter try rh giving me: *this system receiving updates rhn classic or rhn satellite. ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5server/en/os/x86_64/debuginfo/repodata/repomd.xml : [errno 4] ioerror: [errno ftp error] timed out trying other mirror. error: cannot retrieve repository metadata (repomd.xml) repository: rhel-debuginfo64. please verify path , try again* this after took 32 bit repo in /etc/yum.repos.d/* , added new repo modifying old address , adding "x86_64" seen above error. to make things bit more clear... i'm not trying update 32bit system 64 bit rh packages. i'm trying reposync or download 32bit , 64bit rh repositories on 32 bit system. does have advice on doing reposync on both 32 bit , 64 bit rh reposito...

sql - using outer alias in mysql subquery -

i writing mysql query , have question. can / how do this: select rating, user_id, ( -- in here want write subquery number of times user_id in outter query has rated teacher ) user_rated_frequency teachers_rating teacher_id = id essentially trying data , frequency in user rated teacher. possible use alias 1 of items want select in subquery still in select , not in clause? check out this ... select rating, user_id, (select count(*) teachers_rating t1 teacher_id = 3 , t1.user_id = t2.user_id) user_rated_frequency teachers_rating t2 teacher_id = 3; or that one : select avg (rating) average_rating, user_id, (select count(*) teachers_rating t1 teacher_id = 3 , t1.user_id = t2.user_id) user_rated_frequency teachers_rating t2 teacher_id = 3 group user_rated_frequency; links above show sql fiddle example assuming id 3 . alternatively have sub query in from ...

c++ - Modify dll function call in compiled exe -

Image
i have exe file had written while , cannot find source code (it written in c++). it calls messageboxa function in user32.dll , passes necessary parameters it. want modify flags parameter include mb_iconerror (0x10) flag. how go finding bytes in exe file need modified accomplish this? you need disassembler ice or ida. https://www.hex-rays.com/products/ida/support/download.shtml . load executable. find win32 api call on names window, find it, type function name. double click code xref go referenced caller. then want: just select line , click on hex-view address.

c# - Error sending a webRequest -

i error when trying send webrequest in xamarin ios. i want log onto website, works in c# visual studio windows client, ios gives me error. unhandled exception: monotouch.uikit.uikitthreadaccessexception: uikit consistency error: calling uikit method can invoked ui thread. @ monotouch.uikit.uiapplication.ensureuithread () [0x00019] in /developer/monotouch/source/monotouch/src/uikit/uiapplication.cs:49 @ monotouch.uikit.uitextfield.get_text () [0x00000] in /developer/monotouch/source/monotouch/src/uikit/uitextfield.g.cs:919 @ virtualnax.virtualnaxviewcontroller.sendpost (iasyncresult result) [0x00031] in /users/emil/projects/virtualnax/virtualnax/virtualnaxviewcontroller.cs:69 @ system.net.webasyncresult.cb (system.object unused) [0x00000] in /developer/monotouch/source/mono/mcs/class/system/system.net/webasyncresult.cs:151 on line 68 is: post.write("email=" + username.text + "&password=" + password.text + "&remember=on&redir=i...

javascript - Dojo JS ToggleButton show as enabled but disallow click/toggle and hover outline -

i need use togglebutton show image , text , want button appear enabled (colored icon , black text), not want allow click/toggle happen right functionality come later. again need icon colored , text black button not clickable (basically should not button, no outline when hover, etc). this.button = new togglebutton({ "id": title, "label": count, "showlabel": true, "iconclass": "eicon", "class": "buttontext", "disabled": true, }); i cannot css work - tried put color button in css this: .itpbuttontext { color: black !important; } but never gets picked up. maybe need reverse, allow enabled, not allow hover or clicked? does have suggestions? first, there particular reason need use togglebutton implement this? actually, easy us...

php - Don't show blank spaces -

i use sql query php code display fields of database on website. there way delete blank spaces (whitespaces) in output of empty (null) fields? here code: <?php $sql = "select * dining order date desc limit 0, 3"; $dining = new database($sql); while($dining->results()){ echo " <span class='date'>". date("f js, y", strtotime($dining->date)) ."</span> <h3>&nbsp;$dining->title</h3> <h4>&nbsp;$dining->comforts</h4> &nbsp;$dining->com1<br/> &nbsp;$dining->com2<br/> &nbsp;$dining->com3<br/> &nbsp;$dining->com4<br/> &nbsp;$dining->com5<br/> &nbsp;$dining->com6<br/> <h4>&nbsp;$dining->breakers</h4> &nbsp;$dining->break1<br/> &nbsp;$dining->break2<br/> <h4>&nbsp;$dining->wild</h4> &nbsp;$dining-...

bash - Command line combine files at change in part of name and part of file -

i on aix, bash, , cannot install additional software @ time limited command line batch processing , maybe custom java scripts. so, have ton of xml files in different directories. here subset may like. root_dir pages pages_1.xml queries queries_1.xml queries_2.xml queries_3.xml i have put script gets me want, don't know how last piece of puzzle if possible in batch script. create new directory under root, copy of xml files new directory, , rename them remove spaces if there in name, , buffer integer can sorted in alphabetical / numerical order. new output looks this: copy_dir pages_001.xml queries_001.xml queries_002.xml queries_003.xml i there. last piece these separate xml files need combined 1 xml file each type, history_001.xml history_099.xml need combined, queries_001.xml queries_099.xml need combined, after specific point in file. have regex files select parts want, need figure out how loop through each file subset. ma...

math - Least square method in python -

Image
i have 2 lists of data, 1 x values , other corresponding y values. how can find best fit? i've tried messing scipy.optimize.leastsq can't seem right. any appreciated i think simpler use numpy.polyfit , performs least squares polynomial fit. simple snippet: import numpy np x = np.array([0,1,2,3,4,5]) y = np.array([2.1, 2.9, 4.15, 4.98, 5.5, 6]) z = np.polyfit(x, y, 1) p = np.poly1d(z) #plotting import matplotlib.pyplot plt xp = np.linspace(-1, 6, 100) plt.plot(x, y, '.', xp, p(xp)) plt.show()

Elasticsearch: Why is my query returning too many results? -

Image
i'm querying http://elasticsearch.myserver.net:9200/my_index/foo/ following query: { "query": { "ids": { "type": "foo", "values": [ "fff", "bar", "baz" ] } } } but i'm getting response 12 hits, total number of items of type foo in index, rather three, number requested. i'm making query typing "any request" tab of elasticsearch head. going on? update: i've tried { "query": { "bool": { "must": [ { "ids": { "type": "programme", "values": [ "fff", "330930", "200005" ] } } ] } } } with same result. if using request tab in head, make sure have dropdown request method set "...

c# - Prop and field? -

this question has answer here: what difference between field , property in c#? 28 answers what difference between field , property in c#? i have read through topic above full of confusing answers blah blah. i want know, in plain english, code below field or property? . if it's field, property? if it's property, field? class door { public int width { get; set; } } thank much. a property syntax defining getters , setters field. class door { public int width { get; set; } } is similar to class door { private int width; public int getwidth() { return width; } public void setwidth(int i) { width = i; } }

java - Creating a simple Hello world Android Client-Server program -

to keep simple, i'm trying send message android emulator java console server on eclipse contains simple string, want server reply string. ofcourse; ill connect host 10.0.2.2 , use open port (in case 4000). server gets "connected" msg everytime click on connecting button on emulator, cant find way deliver packets or messages. in case want read code, here's (what think is) long code simple task. client package com.example.clienttest; import java.io.ioexception; import java.io.objectinputstream; import java.io.objectoutputstream; import java.net.socket; import android.os.bundle; import android.app.activity; import android.view.view; import android.widget.edittext; import android.widget.textview; public class mainactivity extends activity { thread m_objthreadclient; socket clientsocket; textview servermessage; edittext clientmessage; string sin, sout; objectoutputstream oos; objectinputstream ois; @override public void...

c# - Regex patterns to distinguish four digit numbers -

hi have c# application accepts 4 digit extension number , sets mask it. have situation 2 different masks need applied depending on number. first: if number starts 47 or 5 return mask a. second: if number starts 6 or 55 return mask b. so setup regex way , not sure why getting set wrong. //here trying say, start 47 or 5 next 3 digits taking number match first = regex.match(num, "^(47|(5[0123456789]{3}))"); //anything start 6 or 55 next 2 digits taking numbers 0-5 match secong = regex.match(num, "(6|55[123450]{2})"); if give use above input num=5850 or num=5511 true both 5850 should use mask , 5511 should use mask b how fix this?? thanks! these should you. this matches 4 digit number starting 47 or 5, excluding 5 second digit. ^(47|5([0-4]|[6-9]))\d{2}$ this matches 4 digit number starting 6 or 55. ^(6\d|55)\d{2}$

css - Centering to the screen -

i want put sign in button center both horizontal , vertical of page in here . have tried put anchor tag div hasn't worked. how can that? centering things hardest problem in computer sciences. well depends whether want vertical or horizontal centering. horizontal centering can achieved either setting text-align: center on parent, or giving element explicit width, , margin: auto; vertical centering more difficult. can set margin-top: or absolutely position top: of element push down, have position @ (50% of container height) - (element height / 2), css can't automatically. if element or it's container change heights you'll need adjust manually or javascript. it's still relatively new technique flexible box-model great @ doing this. it's little more complicated, , there lot of vendor prefixes , browser inconsisencies work around, can google it. everybody's gonna hate me saying this, in day we'd have used table , gone on our lives. see t...

java - Copy Linux liveUSB causes errors with init.d scripts -

the overall problem when install simple java application wrote run on boot in background through /etc/init.d/, works on liveusb explicitly install on. when make copy of stick, never boot successfully. when booting liveusb copy java application hang when liveusb boot process reaches script. script, supposed do, every 5 minutes , continue running forever until power down machine. my script blocking else nothing loads beyond script you cannot cancel script there no gui the text can see command line output script setup & test - goes :) i have linux liveusb 3 partitions. simple standard xubuntu image loaded. sda1 > 2gb stoage sda2 > 2gb system sda3 > remaining gb casper i have created simple java application runs in background on start up. far, followed these steps: compiled java application classes placed class files in /home/user/folder/ copied startup.sh script /etc/init.d/ while inside /etc/init.d/ typed "update-rc.d startup.sh...

php - How can I have a user session longer than others? -

i've been trying implement "remember me" option login screen last hours, no success. can give me little help? =d i'm using cakephp 2.3.9 in apache2/mysql 5.5/ubuntu 12.10 server. in "login()" method, inside users controller, i've added code: if ($this->auth->login()) { if($this->request->data('usuario.remember')==="1"){ cakesession::write('session.timeout', '144000');//100 dias } return $this->redirect($this->auth->redirect()); } i hoping make particular user session bigger usual, seems applied users. i'm using cakephp's default auth component. can show me i'm doing wrong , should do? in advance ;] i'm unaware of way you're approaching it. php session timeout lengths server-wide setting defined in php.ini under session.gc_maxlifetime. the way approach overwrite session handler you're using, , rather using phpsessid cookie, create own cookie have co...

Why can't I get an element of this list in R? -

i have list l composed of following elements: > l $quad_freqs [,1] [,2] [,3] [,4] [,5] [,6] sol 0.0002308597 0.004155474 0.00623358 0.02493248 0.02576132 0.0748037 [,7] [,8] [,9] [,10] [,11] sol 0.02493029 0.2318451 0.05612928 0.3593334 0.1916445 i know l list because typed > class(l) [1] "list" however, can't elements of list. example, > l[[1]] [,1] [,2] [,3] [,4] [,5] [,6] sol 0.0002308597 0.004155474 0.00623358 0.02493248 0.02576132 0.0748037 [,7] [,8] [,9] [,10] [,11] sol 0.02493029 0.2318451 0.05612928 0.3593334 0.1916445 > l[[2]] error in l[[2]] : subscript out of bounds > l[[0]] error in l[[0]] : attempt select less 1 element i tried single bracket operator, didn't work either: > l[2] $<na> null > l[0] named list() how can elements of list? this first time using r, sorry ...

windows 7 - IE 10 open tabs AND PDFs -

i having lot of issues ie 10, first issue had ie10 did not want open links in new tabs. found solution creating registry entry: hkey_current_user/software/microsoft/internet explorer/main/tabprocgrowth value of 0 some people said should 1 but, me 0 fixed new tab issue. next, opening pdf... when trying open pdfs small black box x in it. researched issue , everywhere found said solution create: hkey_current_user/software/microsoft/internet explorer/main/tabprocgrowth value of 1 so, changed 1 , sure enough pdfs working now, new tab doesn't work. so question is: missing? need both of these features work. has else encountered issue. this ie10 on windows 7. update so, had no other choice called microsoft. got of solution still not resolved 100%. apparently don't need above registry entry @ all. preliminary solution has been given is: open regedit , go below registry, hkey_classes_root\interface\{79eac9c5-baf9-11ce-8c82-00aa004ba90b}\proxystubclsid32 ...

vb.net - Proper use of shared vars in Visual Basic.NET -

class klass private shared state boolean public sub savestate (byval value boolean) state = value end sub public function getstate () boolean return state end function private sub work() savestatet(false) end sub private sub work2() if getstate() .... end sub ... end class is correct use shared variables in way or accessing them state = false, , if state... something . usually done using property clearer syntax, but, per se, not wrong using couple of get/set functions. private shared internalstate boolean public property state() boolean return internalstate end set(byval value boolean) internalstate = value end set end property but keep in mind shared variable 'shared' between every instance of class. if declare dim c1 = new klass() c1.state = true dim c2 = new klass() console.writeline(c2.tostring) ' prints true' i want add using property way better...

php - Android sending data to database gets blank -

This summary is not available. Please click here to view the post.

ios - How to create an APNs server using Helios? -

i looking create backend server push notifications on ios app. have seen lot of different options, came across 1 looks great way go! here link framework. i wondering if has used method or has come across tutorials on how set up.

Sardinas–Patterson algorithm -

is code c = {00, 11, 0101, 111, 1010, 100100, 0110} uniquely decodeable? my answer no, because according sardinas–patterson algorithm: c1 = {1} c2 = {1, 11, 010, 00100} so c2 , c = {11}, c not uniquely decodable code. i wondering right this? you correct code not uniquely decodable. consider string 111111, can parsed 11 11 11 or 111 111.

database - Java DB (Embedded) Connect using -

helo everybody, i have created database named emb4 in java using netbeans ide, 1 table , trying create application embedded db. have created embedded driver , using code : > /* * change template, choose tools | templates * , open template in editor. */ package embededbaza4; > > import java.sql.connection; import java.sql.drivermanager; import > java.sql.resultset; import java.sql.statement; > > > /** * * @author admin */ public class embededbaza4 { > > > private static final string driver = "org.apache.derby.jdbc.embeddeddriver"; > > /** > * @param args command line arguments > */ > public static void main(string[] args) { > // todo code application logic here > > try > { > class.forname(driver).newinstance(); > connection conn = null; > conn = drivermanager.getconnection("jdbc:derby...

objective c - Changes to sqlite in ios 7/XCode 5 -

i working on app built support ios 5.1/6.0/6.1. upgraded xcode 5 , sqlite 'select' queries return null although correct database there, , have been connected , tables recognized. strange part app working flawlessly on simulators 5.1-7.0 not on actual device. have 5.1 device available test. i reinstalled xcode 4 , app compiling , running expected on ios 5.1 device. there changes sqlite or compiler or other component in xcode 5 give problem? code provided if assist in helping troubleshoot problem. verify sqlite's file size, have same problem resolved copying pre populated .sqlite documents directory via finder @ /users//library/application support/iphone simulator//applications//documents. first let core data create wrong sqlite before replace file created correct one. seems xcode doesn't copy pre populated sqlite file main bundle instead create new 1 based on core data model.

xaml - How to Make Content Hidden in Expander Windows Phone Control -

Image
i playing around example of expander control windows phone toolkit (i using wp7). when load stripped down version seems expanded. when click on customer pizza or 2 nothing happens. sub stuff collapsed don't know how. <phone:phoneapplicationpage x:class="expanderviewsample.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone" xmlns:shell="clr-namespace:microsoft.phone.shell;assembly=microsoft.phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:toolkit="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone.controls.toolkit" mc:ignorable="d" d:designwidth="480" d:designheight="76...