Posts

Showing posts from July, 2014

javascript - How to append string in jQuery without quotes? -

let's have paragraph: <p>txt0</p> ... , want append text: $("p").append("_txt1"); $("p").append("_txt2"); $("p").append("_txt3"); the result be, expected: txt0_txt1_txt2_txt3 however if inspect result in browser, is: <p> "txt0" "_txt1" "_txt2" "_txt3" </p> there 4 different strings rendered one. problem i'm creating flash object dynamically , appending strings way not work because of quotes. need 1 continuous string this: <p> txt0_txt1_txt2_txt3 </p> is there way append in such way? or remove quotes afterwards? ps. before make 1 big string before appending, won't work because string big , ex. works in chrome not in firefox or iexplorer (but that's different issue). use text , otherwise you're appending new textnode everytime: var $p = $('p'); $p.text('txt0'); $p.tex

ios - how to prevent popover from overlapping the navigation toolbar? -

in ipad app, present popover tableview editing style insert control. how can prevent popover overlapping navigation bar when anchor in high position? sadly, i'm not allowed post image. the cgrect in code seems move popover anchor , size, not relation between them. (or: anchor on popover frame) any hint appreciated! in commiteditingstyle if uitableviewcelleditingstyleinsert: popovercontroller.popovercontentsize = cgsizemake(320.0, 400.0); cgrect rect = cgrectmake(cell.bounds.origin.x+200, cell.bounds.origin.y+10, 50, 30); [popovercontroller presentpopoverfromrect:rect inview:cell permittedarrowdirections:uipopoverarrowdirectionleft animated:yes]; }

java - Deleting certain data from a file -

i have file stored in system , want delete data it. i accomplish making temporary file, write of original file data it, without data don't want. then, rename temporary file same name of original file in order replace it. everything goes well, except there problem deleting original file , renaming temporary file. at first, had original file data, after running application had original file same data without deletion, , temporary file named (file) data after deletion. here's method i'm using: public void remove(string path, string link, string ext) throws ioexception { file file = new file(path); file temp = file.createtempfile("file", ext, file.getparentfile()); string charset = "utf-8"; bufferedreader reader = new bufferedreader(new inputstreamreader(new fileinputstream(file), charset)); printwriter writer = new printwriter(new outputstreamwriter(new fileoutputstream(temp), charset)); (string line; (line = reader.r

arrays - How do I randomly jumble a string imploded by ',' in PHP (ex: a,b,c = c,b,a) in a oneliner? -

how randomly jumble string imploded ',' in php (ex: a,b,c = c,b,a) in one-liner? here example srand((double)microtime*1000000); $foo=array( => "a", b => "b", c => "c"); echo "the jumbled comma separated values are: ".randomlyjumble(.implode(",",$foo))."<br />"; use shuffle before imploding. keep in mind shuffle takes parameter reference inline modification, need on separate line.

security - Nginx block POST for certain countries -

i have reverse proxy nginx tomcat. my goal ban total access countries , ban post countries except one. total access ban countries can achieved via iptables @ kernel level. easy task. my dilemma how ban post countries except one. rest of them can see website (get) don't want them create accounts, or post data. i filter listing forms use post, many. is way filter nginx post? thank you geo $ip_country { ranges; default zz; include /usr/local/nginx/conf/ip_country.conf; } set $method_country $request_method$ip_country; if ($method_country ~ "post(?!au)") { return 405; } ip_country.conf format like: 0.0.0.0-0.255.255.255 eu; 1.0.0.0-1.0.0.255 au; 1.0.1.0-1.0.3.255 cn; 1.0.4.0-1.0.7.255 au; 1.0.8.0-1.0.15.255 cn; 1.0.16.0-1.0.31.255 jp; 1.0.32.0-1.0.63.255 cn; 1.0.64.0-1.0.127.255 jp; 1.0.128.0-1.0.255.255 th; 1.1.0.0-1.1.0.255 cn; ... and use $ip_country value inside scripts with: fastcgi_param ip_country $ip

Grabbing String from Embedded MongoID in JSON Java Android -

i working on grabbing information json. server responds with: { "id" : { "$id" : "515a4f1d03cfebb61800097b" }, "body" : "this body" } i can grab body string body = json.getstring("body"); but not know how string contained in 'id'. thanks in advance help! do not know how string contained in 'id'. because current jsonobject contains 1 jsonobject , 1 body key. $id inner jsonobject can as: jsonobject jsonobj_id=json.getjsonobject("id"); // $id id jsonobject string str_id=jsonobj_id.optstring("$id");

python - What is a good way to extend a list with a repeated number? -

i want extend list number 2450, 50 times. way this? for e in range(0,50): l2.extend(2450) this add 2450 , 50 times. l2.extend([2450]*50) example: >>> l2 = [] >>> l2.extend([2450]*10) >>> l2 [2450, 2450, 2450, 2450, 2450, 2450, 2450, 2450, 2450, 2450] or better yet: >>> itertools import repeat >>> l2 = [] >>> l2.extend(repeat(2450,10)) >>> l2 [2450, 2450, 2450, 2450, 2450, 2450, 2450, 2450, 2450, 2450]

php - Search multiple tables in mySQL database -

i want search mysql table , want show results different tables. following setup in tables, first table "user_initials": user pic kashif images/kashif.jpg asif images/asif.jpg second table "user_data": user user_id kashif 155 asif 156 i have made query search keywords user_initials "user" field. want show results as: if search kashif, result should kashif 155 what should query? use join select * user_initials inner join user_data on user_initials.user = user_data.user user_data.user = 'kashif'

java - Parsing user input - getting integers from strings and exception handling -

my application have text box user edit numbers (hopefully) i using integer.parseint() convert string integer, however, there's chance user not pass in numbers throw exception during parseint() . not sure convention error handling in gwt. work? int number = -1; try { number = interger.parseint(inputfromuser); } catch (exception e) { // error handling telling user try again } you on right track. change exception numberformatexception , should fine.

java - Updating a Server Side Text File via Android -

i'm building app needs periodically append lines server side text file. far, best way i've come doing using dropbox api, user has download text file, update it, , upload - not ideal. best (free) way this? i'd solution don't have host server, can use third party cloud (like dropbox). google's android backup service seems appropriate this, , free.

video - Show/Hide Videojs controls at runtime -

is there way show/hide video controls on videojs player @ runtime (e.g. player.controls.hide()). ideas how this? thanks! this how hide controls after 1 second mouse inactivity timeout. var inactivitytimeout = null; $('#vmr_video').mousemove(function(event) { player.controlbar.fadein(); if (inactivitytimeout != null) { cleartimeout(inactivitytimeout); } inactivitytimeout = settimeout(function(){ player.controlbar.fadeout(); controlbarvisible = false; }, 1000); });

c++ - possible misunderstanding of map iterators with for loops -

very specific question i'm afraid (and i'm rather novice, apologies in advance): i'm trying finish final project university object-oriented c++ course. i'm creating student database store exam results students. setup has loads of custom classes work (or @ least want them do). the project set follows: i have "master" map of "course"s, points (so course isn't duplicated if more 1 student taking it). a "student" vector of pointers "course"s , corresponding double "result", , have master map of students in system. a "degree" class of 2 vectors of pointers, 1 courses offered degree, , 1 students taking degree. when degree created, searches both master maps. if first x letters in course id matches degree prefix, course added. if student's subject matches course name, student added. my problem this: as have options manually input courses , students after initial setup csv files, have writen f

url rewriting - I am looking to re-write a specific URl with php -

i using php script change download link " http://mydomain.com/get.php?download/ " looking further change show "/get.php?download/ or more specific "?php" on web page button holds link. here code: <?php $path = 'folder/blank.file/'; $mm_type="application/octet-stream"; header("pragma: public"); header("expires: 0"); header("cache-control: must-revalidate, post-check=0, pre-check=0"); header("cache-control: public"); header("content-description: file transfer"); header("content-type: " . $mm_type); header("content-length: " .(string)(filesize($path)) ); header('content-disposition: attachment; filename="'.basename($path).'"'); header("content-transfer-encoding: binary\n"); readfile($path); //output exit(); ?> how possible? help! edit: using lighttpd , invision power board. i dont know if have made (its old ques

ffmpeg - Why does av_write_trailer fails? -

i processing video file. use ffmpeg read each packet. if audio packet, write packet output video file using av_interleaved_write_frame. if video packet, decode packet, data of video frame, process image, , compress packet. write processed video frame packet output video file using av_interleaved_write_frame. through debugging, read audio packets , video packets correctly. however, when goes "av_write_trailer", exits. output video file exists. the error information is: *** glibc detected *** /opencv_videoflatten_20130507/debug/opencv_videoflatten_20130507: corrupted double-linked list: 0x000000000348dfa0 *** using movie player (in ubuntu), output video file can plays audio correctly, without video signals. using vlc player, can show first video frame (keep same video picture), , play audio correctly. i tried debug "av_write_trailer", since in ffmpeg library, not detailed information wrong. another piece of information: previous version of project

how to disable longclick for listview in android -

i want disable response click , long click on items listview in android. have set isenabled(int position) of adapter return false, cells in listview not response click operation, still respond long click operations(that is, highlighted when long clicked). question is, can make cells not highlighted when long clicked. thank you. try setclickable instead of setenabled

node.js - How to display a Mongo field on Nodejs with Mongoose and Jade? -

currently see displaying entire document, not 1 field. how display 1 field? i have tried following i'm getting "undefined"s don't see displayed. way 1 main js: // app.js var schema = new mongoose.schema({ a_field : string }, { collection : 'the_col_with_data' }); var documentmodel = mongoose.model('doc', schema); var a_document = documentmodel.findone({}, callback); app.get('/', function(req, res) { res.render('index', { pass_var: a_document.a_field }); }); way 1 view: // index.jade #{ pass_var } way 2 main js: // app.js var schema = new mongoose.schema({ a_field : string }, { collection : 'the_col_with_data' }); var documentmodel = mongoose.model('doc', schema); var a_document = documentmodel.findone({}, callback); app.get('/', function(req, res) { res.render(

php - Convert from .net rich textbox to tiny mce -

currently need transform data .net rich textbox have data below : {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 arial;} {\f1\fnil\fcharset204 microsoft sans serif;}}\viewkind4\uc1\pard\fi-360\li720\sb120\sa120 \qj\f0\fs20 2- workers demand company provide 1 free meal workers required work overtime on holidays or sundays (as company never provide them). company states not provide workers volunteer work on holidays or sunday because work 8 hours. \f1\fs18\par} this data not understand tinymce , think may have tool convert format of .net rich textbox standard html. thank kind help, you may have @ following link http://forums.codeguru.com/showthread.php?8168-how-to-convert-contents-of-rich-text-box-to-html or use google https://www.google.de/search?q=convert+from+.net+rich+textbox+to+html&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:de:official&client=firefox-a

android - Differerentiate layout for two devices with same dpi -

i have 2 layout folder: layout-sw800dp , layout-sw600dp app use layout-sw600dp both devices , samsung galaxy tab 7 , nexus 7 ,and makes fonts , styles bigger nexus 7! how can differentiate layout 2 devices? in advance you can check 10 , 7 inch table screen size following code displaymetrics metrics = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(metrics); float widthininches = metrics.widthpixels / metrics.xdpi; float heightininches = metrics.heightpixels / metrics.ydpi; double sizeininches = math.sqrt(math.pow(widthininches, 2) + math.pow(heightininches, 2)); here sizeininches gives proper inch of table take 0.5 inch in buffer , give condition according below. boolean is7inchtablet = sizeininches >= 6.5 && sizeininches <= 7.5; and whenever need check check below. if(is7inchtablet){ // whatever 7-inch tablet }else{ // whatever 10-inch tablet }

Connecting to MS SQL Server with Windows Authentication using Python? -

how connect ms sql server using windows authentication, pyodbc library? i can connect via ms access , sql server management studio, cannot working connection odbc string python. here's i've tried (also without 'trusted_connection=yes' ): pyodbc.connect('trusted_connection=yes', driver='{sql server}', server='[system_name]', database='[databasename]') pyodbc.connect('trusted_connection=yes', uid='me', driver='{sql server}', server='localhost', database='[databasename]') pyodbc.connect('trusted_connection=yes', driver='{sql server}', server='localhost', uid='me', pwd='[windows_pass]', database='[database_name]') pyodbc.connect('trusted_connection=yes', driver='{sql server}', server='localhost', datab

java - Procedure to add a new Filter in alfresco? -

i want create new sso filter in existing alfresco bundle. steps tried are; creating simple java project in eclipse , creating class implements filter , writing code there. then extract project jar file , putting share/web-inf/lib. registering filter in share/web-inf/web.xml. is right way of adding new filter? if not, please share right procedure... imho right procedure. filter must respect rules work well, btw in web.xml definition order of filters important.

java - Powermock verify private static method call in non static method -

dear stackoverflow comrades, again have problem in getting specific powermock / mockito case work. the issue is, need verify call of private static method, called public non-static method . similar example posted on how suppress , verify private static method calls? this code: class factory { public string factorobject() throws exception { string s = "hello mary lou"; checkstring(s); return s; } private static void checkstring(string s) throws exception { throw new exception(); } } and testclass: @runwith(powermockrunner.class) @preparefortest(factory.class) public class tests extends testcase { public void testfactory() throws exception { factory factory = mock(factory.class); suppress(method(factory.class, "checkstring", string.class)); string s = factory.factorobject(); verifyprivate(factory, times(8000)).invoke("checkstring

android - ArrayAdapter's add method adding twice -

i have iconicadapter extending arrayadapter : class iconicadapter extends arrayadapter<string> { iconicadapter() { super(myservice.this, r.layout.activity_listview, r.id.text1, entries); } @override public view getview(int position,view convertview,viewgroup parent) { view row=super.getview(position, convertview, parent); imageview icon=(imageview)row.findviewbyid(r.id.img1); icon.setimageresource(r.drawable.ic_launcher); return(row); } } when using add method, adding twice: iconicadapter ia=new iconicadapter(); lv.setadapter(ia); ia.add("1000"); any reason why so? i think problem this. iconicadapter ia=new iconicadapter();` you adding adapter list, here adapter. lv.setadapter(ia); then here wanted . iv.add("1000"); here add in listview not in adapter

backbone.js - Update values passed to Backbone view -

in addone m creating new object of view that this.section = "aaa"; var sectionview = new aa(model:this.model,section:this.section); section global variable of view m passing aa view.but after passing section value change @ end of add 1 this this.section = "aaa"; var sectionview = new aa(model:this.model,section:this.section); . . . . . . this.section = "sss"; then how can update value of section passed @ time of creation of view aa??? expected answer is this.options.section = "sss" not "aaa" in aa view the usual approach sort of thing extend backbone.events build global pub/sub event dispatcher: window.pub_sub = _({}).extend(backbone.events); then view listen events pub_sub : initialize: function() { this.listento(pub_sub, 'change:section', this.section_changed); //... }, section_changed: function(section) { this.section = section; // , whatever else needs happen... } then trigge

php - mysqli get_result alternative with multiple parameters -

select * `ware_house_indents` `has_cancel` = ? , `eid`= ? i need result above query in mysqli. cant use get_result() function because not working in server.i have found below function , working fine.but function not possible pass multiple parameters.please me solve problem. function db_bind_array($stmt, &$row) { $md = $stmt->result_metadata(); $params = array(); while($field = $md->fetch_field()) { $params[] = &$row[$field->name]; } return call_user_func_array(array($stmt, 'bind_result'), $params); } function db_query($db, $query, $types, $params) { $stmt = $db->prepare($query); $bindret = call_user_func_array(array($stmt,'bind_param'), array_merge(array($types), $params)); $stmt->execute(); $result = array(); if (db_bind_array($stmt, $result) !== false) { return array($stmt, $result); } $stmt->close(); return false; } if (($qryres =

c# - how to access elements in a StackPanel in listbox -

i have listbox contains stackpanel contains image , textblock . want access textblock via c# (code-behind) change it's font manually. relevent xaml: <listbox x:name="categorieslistbox" margin="0,0,-12,0" itemssource="{binding categories}" selectionchanged="categorieslistbox_selectionchanged" > <listbox.itemtemplate> <datatemplate> <stackpanel margin="0,0,0,17" width="432" height="62"> <grid> <grid.columndefinitions> <columndefinition width="40"/> <columndefinition width="*"/> </grid.columndefinitions> <image x:name="catimage" source="{binding icon}"/> <text

android - Reset CirclePageIndicator library -

i wanted have image lazy loading in listview. put images in viewpager , , set circlepageindicator viewpager: public void fetchdrawableonthread(final viewpager viewpager, final circlepageindicator indicator) { final handler handler = new handler() { @override public void handlemessage(message message) { imagepageradapter adapter = new imagepageradapter((drawable[]) message.obj); viewpager.setadapter(adapter); indicator.setviewpager(viewpager); } }; thread thread = new thread() { @override public void run() { drawable[] drawables = fetchdrawables(); message message = handler.obtainmessage(1, drawables); handler.sendmessage(message); } }; thread.start(); } this custom adapter class in main activity: private class multiadapter extends arrayadapter<string>

c# - Suppress WebBrowser mailto -

i have webbrowser control in form. i want when user click on link (href mailto) register website button clicked, not open new window (neither outlook nor other website). i have found code, doesn't work: private void webbrowser1_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { textreader tr = file.opentext(webbrowser1.url.tostring()); string htmlfile = tr.readtoend(); tr.close(); tr.dispose(); if (htmlfile.contains("mailto:")) { htmlfile = htmlfile.replace("mailto:", @"mail"); //recreate new file fixed html file.delete(e.url.localpath); textwriter tw = file.createtext(e.url.localpath); tw.write(htmlfile); tw.flush(); tw.close(); tw.dispose(); refresh(); } } the answer doesn't have how fix code, if there's simpler way it? better. this apply wp8 webbrowser apply case too. register navigating event.

javascript - How to get raw http header string in node.js with express.js -

i work node.js , express.js. current project need access raw strings of http headers (charset , accpeted). there function in express.js returns charsets , accepted headers, however, these sorted quality , therefore not useable me in special case need. req.accepted // returns sorted array of accepted header req.acceptedcharsets // returns sorted array of accepted lang header however, need raw strings (iso-8859-5;q=.2, unicode-1-1;q=0.8, text/*;q=.5, application/json). now there way how can access raw strings in express app? best regards, crispin req.headers as in var express = require('express'); var app = express.createserver(); app.get('/', function(req, res){ console.log(req.headers); res.header('time', 12345); res.send('hello world'); }); app.listen(3000);

linux - I'm trying to write a shell command to find and compile all C programs -

i'm trying write shell command find , compile c programs find . -type f -name '*.c' -exec sh -c 'gcc {} -o $(dirname {})/$(basename {} .c)' \; is have now, , compile c files, returns these errors. /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crt1.o: in function `_start': (.text+0x20): undefined reference `main' collect2: error: ld returned 1 exit status i'm stuck , appreciated. you don't have main defined c file/files. check individual inclusions trying create separate executable each of c file. want show #include of compiled files.

Accessing files saved by android emulator camera app on my laptop -

Image
i have written camera application records video , saves file @ address: content://media/external/video/media/filename i using android bluestacks app player windows , want know how can access recorded files on laptop. in eclipse click ddms -> file explorer -> find path! -> pull file device! (note ofcourse emulator should working..) like :

Ruby on Rails w/ Devise - AssociationTypeMismatch User expected -

i'm new ror , i'm struggle creation of authorization instance belongs user. works fine when user doesn't exist, create user , it's first authorization. associationtypemismatch when tried create authorization existing user. idea ? here's user class. class user < activerecord::base has_many :authorizations, :dependent => :destroy devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable attr_accessible :email, :password, :password_confirmation, :remember_me end my authorization class class authorization < activerecord::base attr_accessible :accesskey, :code, :provider_id, :refreshkey, :user_id, :authorization, :user, :user_attributes belongs_to :user end and method returns error on authorization.create begin generatedauthorization ... user_email = s['email'] #check if user exists user = user.where(:email => user_email) if user.any? flash[:notice] = 'old

display google map with php and mysql using the longitude and latitude stored in the database is not workingg -

i have map page include google map display users static locations using php , mysql because longitude , lattitude stored in database in village table village id in foreign key in user table used inner join problem browser not show anything. map.php <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php print "$firstname $lastname"; ?></title> <link href='http://fonts.googleapis.com/css?family=oswald:400,300' rel='stylesheet' type='text/css' /> <link href='http://fonts.googleapis.com/css?family=abel|satisfy' rel='st

intersection - The mesh contains self intersecting faces after mesh smoothing -

all i obtain triangle mesh after reconstruction process. remove noise, try smooth mesh. triangles appear dark in meshlab after smoothing operation. smoothing operation move positions of vertices. motion cause intersection , normal inconsistency. think inevitable smoothing methods. correct? postprocessing required? regards jogging

c++ Remove line from .txt file -

i'm trying remove line .txt file. file contains information regarding account. the line says "newaccount" , made when creating account. use can boot tutorial when first log in. after tutorial want remove line in next login not tutorial. heres snippet of code: (doesn't work) void loginscreen(string user){ system("cls"); cout << "hello " + user << endl; ifstream file(user + ".txt"); string line1; getline(file, line1); // begin reading stream here string line2; getline(file, line2); if(line2 == "newaccount"){ cout << "your account new"; char cuser[200]; strcpy_s(cuser, user.c_str()); std::ofstream newfile( user + ".txt.new" ); // output...!!!!!!! newfile << line1; newfile.close(); if ( newfile ) { remove( cuser + ".txt" ); rename( cuser + &q

asp.net - How to get this CSS Right? -

the more work css, more depression want set background picture stored on same folder aspx , cs files located, still wont put background picture: /* defaults ----------------------------------------------------------*/ body { background-image:url(banner.gif); display:block; // have tried without well, no change :( } default.aspx: <%@ master language="c#" autoeventwireup="true" codebehind="site.master.cs" inherits="webapplication1.sitemaster" %> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head runat="server"> <title></title> <link href="~/styles/site.css" rel="stylesheet" type="text/css" /> <asp:contentplaceholder id="headcontent" runat="server"

Reading from a file using JAVA IO in android App -

i have file external jar needs. tried adding file assets , provided path straight away. din't work , threw error java.io.filenotfoundexception: /assets/model/en2hi/tune/1/joshua.config: open failed: enoent (no such file or directory) the line external jar trying read file is: fileinputstream fis = (filename.equals("-")) ? new fileinputstream(filedescriptor.in) : new fileinputstream(filename); please suggest on how can handled. there other way keeping application out of android app? or how allow android app read java io? you can have file in /assets directory of project , access using assetmanager class: assetmanager amgr= context.getassets(); inputstream ipstream = amgr.open("filename.txt"); or can have /res/raw directory , use using: inputstream = getresources().openrawresource(r.raw.test);

android - Default facebook application gets called eventhough I am using facebook sdk in my aplication -

i using facebook sdk in application. working fine when there no facebook app installed in mobile.but when download , install facebook app playstore, application facebook redirected facebook app installed playstore. how can restrict app should use sdk used in application. thanks it default. if have facebook app in device app redirected if dont have facebook webview called. cant change it. so if want webview uninstall facebook app.

Android getting Black Screen when Switching from SplashActivity to AnotherActivity -

i'm facing problem when moving splashscreen activity anotheractivity . problem i'm getting blackscreen after splashscreen disappears , before mainactivity screen loads. does have suggestions? here code: public class splash extends activity{ public list<saxmessage> torimsg = new arraylist<saxmessage>(); static final int dialog_error_connection = 1; static final int dialog_error_connection2 = 2; static final int dialog_error_connection3 = 3; boolean connected; string dialogmessage; context context; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); splashhandler mhandler = new splashhandler(); setcontentview(r.layout.splash); context=getapplicationcontext(); connected=isonline(getapplicationcontext()); log.d("connection","connection:"+connected); // create message object me

javascript - jquery dialog gives missing : after property id error -

i trying popup jquery dialogue box here. when dialog has following code.. var opt = { autoopen: false, modal: true, width: 550, height:650, title: 'details' }; it works fine. popup window. adding additional info getting me error. updated post <script> $(document).ready(function(){ $(".editbt").click(function(event) { event.preventdefault(); $.ajax({ type: "get", url: this.href, cache:false, success: function(response){ var opt = { box :$( "#box" ), itemname:$( "#itemname" ), size:$( "#size" ), potency:$( "#potency" ), quantity:$( "#quantity" ), allfields:$( [] ).add( box ).add(itemname).add(size).add(potency).add(quantity), tips :$( ".validatetips" ); function updatetips( t ) { tips .text( t ) .addclass( "ui-sta

java - Cannot import EclipseLink MOXy -

i downloaded latest eclipselink (2.4) , put eclipselink.jar in folder. however, not see @xmlinversereference annotation anywhere , cannot import org.eclipse.persistence.oxm.*; what doing wrong? using netbeans 7.2.1. alternatively, might alternate solution bidirectional relationships jaxb annotations? have parent , child class, child has reference parent because of jpa foreign key. unmarshal, reference gone. update i created web application using netbeans 7.3 , needed include eclipselink right click libraries icon in project panel , choose add jar/folder... , subsequently point @ eclipselink.jar in eclipselink install. the import @xmlinversereference following: import org.eclipse.persistence.oxm.annotations.xmlinversereference; for more information http://blog.bdoughan.com/2013/03/moxys-xmlinversereference-is-now-truly.html http://blog.bdoughan.com/2010/07/jpa-entities-to-xml-bidirectional.html

algorithm - python mmap regex searching common entries in two files -

i have 2 huge xml files. 1 around 40gb, other around 2gb. assume xml format this < xml > ... < page > < id > 123 < /id > < title > abc < /title > < text > ..... ..... ..... < /text > < /page > ... < /xml > i have created index file both file 1 , file 2 using mmap. each of index files complies format: id <page>_byte_position </page>_byte_position so, given id, index files, know tag starts id , ends i.e. tag byte pos. now, need is: - need able figure out each id in smaller index file (for 2gb), if id exists in larger index file - if id exists, need able _byte_pos , _byte_pos id larger index file (for 40gbfile ) my current code awfully slow. guess doing o(m*n) algorithm assuming m size of larger file , n of smaller file. with open(smaller_idx_file, "r+b") f_small_idx: line in f_small_idx.readlines():

node.js - Aggregate: return document with no subdocument OR with latest subdocument only -

this more complex version of the query in question i've got these mongoose schemas: var thread = new schema({ title: string, messages: [message] }); var message = new schema({ date_added: date, author: string, text: string }); how return threads latest message subdocument (limit 1) , threads without message subdocuments well?

neo4jclient - Neo4j .NET Client Wrap transactions -

is possible wrap several transactions 1 using neo4j client .net? problem need delete 1 node, relationships , end nodes attached these relationships 1 acid transaction. understand using rest batch possible. can neo4j .net client? thank support! do in single cypher call: start n=node(123) match n-[r]->m delete r, m, n in c#: graphclient.cypher .start(new { n = (nodereference)123 }) .match("n-[r]->m") .delete("r, m, n") .executewithoutresults();

gstreamer - Python script Import error while running through apache server -

i have problem. using python script uses pygst library. have no problem executing script manually through command line. tried switching user _www , executing script (since few path few libraries might not set) seems work fine... problem not able reproduce error manually. know missing small. file "/••••••.py", line 2, in <module> import os, sys, pygst importerror: no module named pygst **edit call script made through php script ?? problem ?

How to undo a revert in mercurial -

this question has answer here: are changes gone after “hg revert”? 1 answer after had accidentally added several files with hg add i wanted revert with hg revert --all unfortunatelly hadn't committed intended changes reverted well. can content back? you did not specify --no-backup , there should backup files right next actual file. documentation support this modified files saved .orig suffix before reverting. disable these backups, use --no-backup.

PHP: clear a text file if it exceeds 50 lines -

ok, missing? trying clear file if exceeds 50 lines. this have far. $file = 'idata.txt'; $lines = count file($file); if ($lines > 50){ $fh = fopen( 'idata.txt', 'w' ); fclose($fh); } $file = 'idata.txt'; $lines = count(file($file)); if ($lines > 50){ $fh = fopen( 'idata.txt', 'w' ); fclose($fh); }

jax ws - What should I change to get a different element name on the response XSD of an automatically generated JAX-WS? -

i have created web service in java jax-ws . simple 1 returns uppercased version of string : @webservice(endpointinterface = "mod2.mod2") public class mod2impl implements mod2 { @override public string mod2(string x) { return x.touppercase(); } } and interface: @webservice public interface mod2 { @webmethod string mod2(string x); } jax generates mod2.jaxws package me relevant classes. response this: @xmlrootelement(name = "mod2response", namespace = "http://mod2/") @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "mod2response", namespace = "http://mod2/") public class mod2response { @xmlelement(name = "return", namespace = "") private string _return; /** * * @return * returns string */ public string getreturn() { return this._return; } /** * * @param _return * value _return property

How to flip rows in a 1D short/int array representing a 2D array in Java -

i need flip 1-d 64-element array of shorts (i can switch ints if it's easier, assume same processes work either) on it's head in java. represent here square table ease of understanding, since actual problem on chessboard. for example: short[] example = new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; would become: 7 8 9 4 5 6 1 2 3 please note not same reversing array (every answerer similar questions have found has made mistake, hence having ask!). reversing array give: 9 8 7 6 5 4 3 2 1 apologies if i've missed important info, appreciated! edit: array 1d , contains 64 elements, short[64], , reversed array separate original. far i've tried, i'm struggling wrap head around it. know how reverse array, that's not i'm after, , had tried reverse index using: byte index = (byte)(((byte)(position + 56)) - (byte)((byte)(position / 8) * 16)); which code snippet found on chessbin , returns incorrect values , gives indexoutofbounds error

android - How to make all buttons to be of the same height (and keep their weigths)? -

Image
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightsum="6" tools:context=".mainactivity" > <button android:text="btn1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="fill_vertical" android:layout_weight="1" /> <button android:text="btn2" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="fill_vertical" android:layout_weight="2" /> <button android:text="btn3" android:layout_width="0d

android - Saved image takes minutes to appear in Gallery -

i'm saving bitmap in sd card , called intent.action_media_mounted right after. it displays in gallery takes 5 minutes image appear. there way make instantaneous? file newfile = new file(newfilename); if (newfile.exists()) { newfile.delete(); } try { fileoutputstream out = new fileoutputstream(newfile); bitmap.compress(bitmap.compressformat.jpeg, 100, out); out.flush(); out.close(); context.sendbroadcast(new intent(intent.action_media_mounted, uri.parse("file://" + environment.getexternalstoragedirectory()))); toast.maketext(context, "photo appear in gallery in few minutes.", toast.length_short).show(); } catch (exception e) { e.printstacktrace(); } you need pass file mediascannerconnection : http://developer.android.com/reference/android/media/mediascannerconnection.html . way system can instantly knows there new file needs added gallery. right now, have wait until system scans filesystem , see file, of course not

Rails + Cucumber/Selenium/Capybara: Compare the text values of two h4s with the same class? -

i have 2 <h4> s surround name of search result. need compare values of first , last results make sure in alphabetical order. h4's have class of search-result-name . both in same form tag id #search-results . this broken cucumber test: then(/^the results should alphabetical$/) first_product_name = page.all('.search-result-name')[1] #first('.search-result-name').text last_product_name = page.all('.search-result-name')[2] first_product_name[0].should <= last_product_name[0] end this giving me error undefined method '[]' nil:nilclass (nomethoderror) , i'm thinking i'm doing find incorrectly. can't find documentation on how find 2nd, 3rd, etc matches of element. thing both in same div , have same class. how use selenium/capybara it? use mighty xpath . //form/h4[@class="search-result-name"][1] refers first h4 node, similarly, //form/h4[@class="search-result-name"][2] refers second h4

c++ - SQL server 2008 Task Scheduler will not create a file from the program -

i running sql server 2008 , have .exe file on creates .txt file saved in same directory. (so, before running .exe file exists, after running .exe, .exe file , .txt file exist.) there, .exe file sends email using .txt file attachment. here works perfectly: if double click on .exe file, .txt file created , email sent. or if .txt file there, overwritten new one. if double click on batch file runs .exe, works too. here doesn't work: if try start either .exe or .bat file in task scheduler on server, peculiar: .txt file not overwritten or created. if .txt file doesn't exist, new 1 isn't created , no email sent. if put old .txt file there, email sent old file (i.e. file not overwritten). so, condensing down: task scheduler not allow .exe file create .txt file. fun, modified program (it created c++) creates .txt file no email , still won't create .txt file. i'm assuming using code like: if (!file.exists("logfile.txt")) { log = ne

opencv - java.lang.ExceptionInInitializerError in Android Project -

i'm trying create android application can record video and, during recording, should capture frames in order process them. when try run app on emulator (using eclipse juno, opencv4android ver. 2.4.5, , android-ndk), have result in logcat: 05-13 18:15:34.555: d/dalvikvm(1595): trying load lib /data/app-lib/com.example.provavideocapture-1/libjnivideocapture.so 0x40ce89b0 05-13 18:15:34.555: e/dalvikvm(1595): dlopen("/data/app-lib/com.example.provavideocapture-1/libjnivideocapture.so") failed: cannot load library: soinfo_link_image(linker.cpp:1635): not load library "libopencv_java.so" needed "libjnivideocapture.so"; caused load_library(linker.cpp:745): library "libopencv_java.so" not found 05-13 18:15:34.555: w/dalvikvm(1595): exception ljava/lang/unsatisfiedlinkerror; thrown while initializing lcom/example/provavideocapture/mainactivity; 05-13 18:15:34.555: w/dalvikvm(1595): class init failed in newinstance call (lcom/example/provavideo

Improving Git workflow and optimization for PHP [magento] -

background information we working shift using svn git, work on magento stores , have staging server , production server every project. the process in simple terms: code first developed on local machine project setup on every dev machine, committed staging repo , tested client , qa , master goes production , final testing qa. we use codebase/github repositories , deployment staging automatic using deployhq , deployment master production done sys admins using deployhq. the git workflow has been derived after being influenced different workflows suggested on internet , uses chunks of http://nvie.com/posts/a-successful-git-branching-model/ , proper way use git/github - php system dev/testing/production servers along others includes commands think consistent model. git workflow 0] setting new git project locally git clone [path_to_repo] -b [branch_name] [local_dir] path_to_repo can either remote repository or branch bundle (repo.bundle) 1] setting remote path in cas