Posts

Showing posts from February, 2014

properties - QLineEdit/QLabel won't stay enabled when saving .ui -

i have built .ui-file in qt creator includes few different stacked containers: tool box contains qwidgets qlabels, qlineedits etc. in various tabs. few of widgets disabled in beginning , should enabled open other action. able calling widget.setenabled(true) items on widget, should appear enabled now, must enabled in qt creator, correct? my problem is, few items on qwidget not stay enabled. can check properties checkbox "enabled", navigate different tab in tool box , return qwidget, these 2 items disabled again. doesn't save status enabled when save file. distinguishes items stay enabled ones don't ones don't, in properties editor, properties "enabled" , "cursor" appear bold, whereas others don't. other properties appear similar , items children of same qwidget. i tried replacing them copied versions of similar item on same tab, doesn't help.

c++ - Offsetting polygon using Boost Geometry API -

the boost polygon library states possible offset polygons(symmetrically ).but haven't found method in api or example of how .anyone can confirm boost geometry can it? have found question : https://stackoverflow.com/questions/7668331/outline-of-a-polygon-in-boost seems asking similar question. please keep in mind libs polygon clipper can wonderfully point of interest in boost is fast , supports floats. help. update: talking both boost geometry , polygons library because not sure 1 contains or lacks feature. using boost geometry, function want called buffer . docs: buffer calculates buffer of geometry. description the free function buffer calculates buffer (a polygon being spatial point set collection within specified maximum distance geometry) of geometry. http://www.boost.org/doc/libs/1_49_0/libs/geometry/doc/html/geometry/reference/algorithms.html

Proper way of transforming 3D primitives in C#/XNA? -

i have block class contains array of 36 vertices, constructor builds block around origin (0, 0, 0), , method updating. i'm using physics library manipulate blocks. assign body , collision skin block , update physics step every update. after every update matrix block's new position, orientation, etc. now, can't wrap head around best way go applying matrix block , efficiently updating vertex buffer every frame. this have @ moment, i'm positive there's better method... class block { const float fullblocksize = 20f; const float halfblocksize = fullblocksize / 2; public vertexpositionnormaltexture [] vertices = new vertexpositionnormaltexture[36]; public vertexpositionnormaltexture [] currentvertices = new vertexpositionnormaltexture[36]; public dynamicvertexbuffer vbuffer; vector3 position; public block(vector3 blockposition) { position = blockposition * fullblocksize; /* * build 6 faces of block...

Is it bad to use enum('y','n') instead of a boolean field in a MySQL table? -

so few years ago saw db schema of system developed 3rd party , noticed used enum('y','n') instead of boolean (tinyint) field. don't know why loved much, found made things easier read (totally subjective know) adopted , started using ever since then. suppose swap "true" , "false" but, can say, liked it. now being said, there setbacks doing things way -- aside maybe annoying programmer who'd come in late in game? yes, bad. lose intuitive boolean logic ( select * user not banned becomes select * user banned = 'n' ), , receive strings instead of booleans on application side, boolean conditions there become cumbersome well. other people work schema bitten seeing flag-like column names , attempting use boolean logic on them.

excel vba - Creating a folder and sub folder where none exist, but don't if they do -

ok, i've been working people on code, , have have come this: this works universally between mac , pc. option explicit sub createfolders() dim sheet1 worksheet 'sheet1 dim lastrow long, fstcell long dim strcompany string, strpart string, strpath string dim basefolder string, newfolder string dim cell range set sheet1 = sheets("sheet1") application .screenupdating = false .displayalerts = false .enableevents = false end sheet1 lastrow = sheet1.cells(rows.count, "b").end(xlup).row basefolder = "lists!$g$1" 'folders created within folder – change sheet of like. if right(basefolder, 1) <> application.pathseparator _ basefolder = basefolder & application.pathseparator each cell in range("s3:s" & lastrow) 'change suit 'company folder - column newfolder = basefolder & cell.value if len(dir(newfolder, vbdirectory)) = 0 mkdir...

ajax - mediaelement.js dont work in ios after infinite-scroll -

i made media items(video,audio) mediaelement.js in list page infinite-scroll , isotope jquery plugin. use infinite-scroll going next page. it's ajax plugin. there viedo item(c1) in first page , audio item(c2) in second page. when scroll bottom, second page(c2 audio item) loaded. problem when page runing in ipad , iphone, when infinite-scroll second page, c1 video can't played, it's loading. works fine in firefox , chrome of pc. please me check codes. (this's link.) i got answer. this codes ok, hope somebody: jquery(newelements).find('audio,video').mediaelementplayer();

rails admin - Rails_admin and paperclip : File out of public folder, how to download? -

i'm using last rails_admin gem , paperclip. i save attachment folder not accessible browser. my model : class mymodel < activerecord::base has_attached_file :file, :path => ":rails_root/storage/:rails_env/attachments/:id/:style/:basename.:extension" end but know can't retrieve file rails_admin. when click on link have : no route matches [get] "/system/files/20/original/my_pdf.pdf" it's normal because file isn't in public folder. do know solution ? of course tried set :url. you won't able serve normal file / asset. you'll want create new controller#action sending file via send_file, e.g. class downloadscontroller < applicationcontroller def show item = product.find(params[:id]) if current_user.downloads.include?(item) send_file "#{rails.root}/#{item.downloadable.url(:default, false)}" else redirect_to(root_url, :notice => "you not have access content.") ...

wcf - How to host and connect to a net.tcp service -

i need code scratch wcf service net.tcp binding, self-hosted on iis7, , call console application. can give me step-by-step guide service , sample client application? please see following guides , tutorials: http://msdn.microsoft.com/en-us/library/ms731758.aspx http://www.youtube.com/watch?v=fprqpa9qmuw

jquery posting to php file -

trying jquery code post value php file have, , return array of data. the basic idea search database, fill bootstrap's typeahead value. working in codeigniter. search controller: <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class search extends ci_controller { public function index() { } public function getsearchresults() { $partialsearch = $_post['partialsearch']; if (strlen($partialsearch) > 5) { $this->db->select('mobile_number'); $this->db->like('mobile_number', $partialsearch); $query = $this->db->get('phone_lines'); $result = $query->result(); $data = ""; foreach($result $row){ $data = $data . "<div>" . $row->mobile_number . "</div>"; } echo $data; } } } jquery fills typeahead: <script> //searches database mobile numbers $(function() { var se...

Issue with Android's onTouchEvent() -

i creating first android app using this guide reference. currently, have red button on canvas , when user clicks button boolean (green) set true in order button's bitmap green button. that part of application works, works regardless user clicks on canvas. want boolean changed when user clicks on button's bitmap. here have in code: the ontouchevent() method @override public boolean ontouchevent(motionevent event) { if (event.getaction() == motionevent.action_down) { button.handleactiondown((int)event.getx(), (int)event.gety()); if (button.istouched()) { green = true; } } if (event.getaction() == motionevent.action_move) { } if (event.getaction() == motionevent.action_up) { if (button.istouched()) { green = false; button.settouched(false); } } return true; } the handleactiondown() method public void handleactiondown(int eventx, int eventy) { if (eventx ...

How to make a section show all the content? (in a UITableView) -

Image
i playing piece of code , have gotten far. app gets xml feed display job advertisements, , shows them in images attached. what trying figure out is, how make "description" part display information taken xml file. would answer hidden in changing in method? - (uitableviewcell *)tableview:(uitableview *)tv cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithframe:cgrectzero reuseidentifier:cellidentifier] autorelease]; } switch(indexpath.section) { case 0: cell.text = abook.title; break; case 1: cell.text = abook.author; break; case 2: cell.text = abook.summary; break; } return cell; } try implement this: -(cgfloat ) tableview:(uitableview*) tableview heightforrowatindexpath:(nsindexpath*) ind...

Codeigniter URI Routing -

i have check codeigniter user guide, not lucky solve problem. i have created webpage on localhost. when go http://localhost/webpage/ okay. go default controller. my default controller homepage , there methods named index , guarantee , about when go routes.php, added this: $route['guarantee'] = "homepage/guarantee"; $route['about_us'] = "homepage/about"; then try access http://localhost/webpage/guarantee , http://localhost/webpage/about_us show error 404 but when $route['default_controller'] = "homepage/guarantee"; guarantee page displayed. can me issue? thanks. you need remove index.php. in application/config.php file change $config['index_page'] = 'index.php'; to $config['index_page'] = ''; then put .htaccess file in root folder (in same folder index.php is: options -indexes options +followsymlinks # set default file indexes directoryindex index.php <...

android - What should I do to activate ListView in class which not extends ListActivity? -

i have http://developer.android.com/resources/tutorials/views/hello-listview.html tutorial , want same in class. don't want in activity class!!! //you need extends activity and in oncreate() method you need listview id listview mylistview=(listview)findviewbyid(r.id.mylist); mylistview.setadapter(...);

uibinder - How to make a Button displaying a drop down list using GWT? -

Image
i'm trying using gwt 2.4 make widget below: button, when clicking can show drop-down list under it. picture google's new blogger system. anyone shed light on this? you use menubar widget single menu item (being button) having submenu (the dropdown menu). or use button , , within clickhandler you'd show popuppanel containing vertical menubar relative to button (which you'd set auto-hide partner )

wpf - Unable to click on button placed over WindowsFormsHost Control -

i have windowsformshost control on have placed button. however, unable click button. ensured button's isenabled property set true. appreciated. this known 'airspace' issue. windowsformshost controls always rendered on wpf controls. supposedly fixed in future release according this article .

fortran - How can gfortran tell if I am compiling f90 or f95 code? -

i understand gfortran can compile f90 or f95? how know 1 compiling? can compile f77 code? ubuntu have fortran compiler or need download gfortran? gfortran can guess things file extension; if file has extension of .f, .f90, f95, .f03, or .f08 assume fixed (.f) or free format appropriate standards. can force compile (say) fortran2003 code option -std=f2003. eg, documentation , -std=std specify standard program expected conform, may 1 of `f95', `f2003', `f2008', `gnu', or `legacy'. default value std `gnu', specifies superset of fortran 95 standard includes of extensions supported gnu fortran, although warnings given obsolete extensions not recommended use in new code. `legacy' value equivalent without warnings obsolete extensions, , may useful old non-standard programs. `f95', `f2003' , `f2008' values specify strict conformance fortran 95, fortran 2003 , fortran 2008 standards, respectively; errors given...

Which algorithm use to analyze an image (to find dirty point) using C or C# language? -

i have small project program used analyze image find out "is dirty or not". detail, use camera (maybe mobile phone) take picture, , use program i've talk above determine location dirty apear. sorry english, looks cleaning-robot (take picture, if place have dirty place, robot clean it) hope me :) lot :) you might able make work using imagemagick , sounds you'll have using full opencv .

c# - Serializing a JSON array to an instance of a class -

if have json data such as: { "datapoints":[ [null, 1234567890, "point1"], [null, 1234567890, "point2"] ] } is there way deserialize data following classes: public class result { public datapoint[] datapoints {get;set;} } public class datapoint { public string name {get;set;} public string value {get;set;} public datetime timestamp {get;set;} } can specify index of array member serialize property? if open custom deserialization using json.net string json = @"{""datapoints"":[ [null, 1234567890, ""point1""], [null, 1234567890, ""point2""] ]}"; var result = (jobject)jsonconvert.deserializeobject(json); var datapoints = result["datapoints"] .select(t => new datapoint() { timestamp = string.isnullorempty(t[0].tostring()) ? datetime.minvalue : datetime.parse(t[0].tostring()), value = t[...

C# XML attribute being created improperly -

i'm creating node programmatically, 1 of attributes comes out differently specified in code: xmlnode xresource = docxmlfile.createnode(xmlnodetype.element, "resource", docxmlfile.documentelement.namespaceuri); xmlattribute xrefidentifier = docxmlfile.createattribute("identifier"); xmlattribute xrefadlcp = docxmlfile.createattribute("adlcp:scormtype"); xmlattribute xrefhref = docxmlfile.createattribute("href"); xmlattribute xreftype = docxmlfile.createattribute("type"); xrefidentifier.value = "res-" + strres; xrefadlcp.value = "sco"; xrefhref.value = datarow["launch_url"].tostring().tolower(); xreftype.value = "webcontent"; xresource.attributes.append(xrefidentifier); xresource.attributes.append(xrefadlcp); ...

node.js - Finding a match in an array field -

in image sharing application can create albums , add images them. when image deleted site, should removed album(s) stores references image (name, id). the thing need find albums has stored image (reference) that's removed. in route below i've tried far, error on query. i've checked mongodb docs , syntax looks this: db.collection.find( { field : { $in : array } } ); in route field , array has switched places, doesn't seem work. i appreciate help. in advance! my models looks following: var albumschema = new schema({ title : string, imagename : [string], <-- array contains of images names imageid : [string] <-- array contains of images id's }); modelobject.albumschema = albumschema; modelobject.album = mongoose.model('album', albumschema); var imageschema = new schema({ name : string, size : number, type : string }); modelobject.imgschema = imgschema; modelobject.image = mong...

objective c - How to select object by touch.view and isKindOfClass? -

i've got simple if case in touchesbegan method: if ([touch.view iskindofclass:[direction class]]) { //select tapped object , something... } i've got on view many direction objects, , when tap on 1 want select it, like: direction *d = [touch.view].selectedobject; //something that. can in obj-c? or how can correctly? if ([touch.view iskindofclass:[direction class]]) { //do something... direction *d = (direction*)[touch view]; }

java - Recommend a Mac OS X Git GUI for comparing different commits side-by-side -

i know can configure git use alternate diff tool, such tkdiff, , can compare 2 arbitrary commits entering them on command line "git diff commit# commit#". there free or inexpensive mac os x program provides gui showing commit network lets me select commits want compare? ability site-by-site diffs important me. unfortunately, repo i'm working not structured work eclipse/egit. xcode comes opendiff/file merge works fine. github's mac app works.

Adding random and unique images to imageviews android -

i have 16 imageviews on activity......named img1->img16. want diff image on each image view , cannot hardcoded, depening on number passed extra, e.g. 1, 2 , 3..... images added these views must different. i have code adds 16 images these not unique..... duplicated... int[] imageviews = { r.id.img1, r.id.img2, r.id.img3, r.id.img4, r.id.img5, r.id.img6, r.id.img7, r.id.img8, r.id.img9, r.id.img10, r.id.img11, r.id.img12, r.id.img13, r.id.img14, r.id.img15, r.id.img16 }; int[] images = { r.drawable.img1, r.drawable.img2, r.drawable.img3, r.drawable.img4, r.drawable.img5, r.drawable.img6, r.drawable.img7, r.drawable.img8, r.drawable.img9, r.drawable.img10, r.drawable.img11, r.drawable.img12, r.drawable.img13, r.drawable.img14, r.drawable.img15, r.drawable.img16 ...

c# - Adding other items in toolbox from dll, do I still need the dll if I give someone the source? -

i have ajaxcontroltoolkit.dll , i've added dll items toolbox , i've worked items in asp.net project. my question : if give entire source without dll located on desktop , , in project used items dll , still working(the items) on pc ? thanks it shown missing reference path( yellow icon) when else opens it. best way handle add folder called "project resources /whatever name like" under solution , keep these dlls there. add reference location. available when give soultion files else.

c# - Connect to FTP site using SFTP and download files -

i need download files ftp site. need connect sftp connect. unable find examples/tutorials download files ftp site using sftp connect. can please point me tutorial or provide sample code begin ? tamir's sharpssh library handles sftp pretty well. , there plenty of examples, gist is: sftp sftp = new sftp(sftphost, sftpuser); console.writeline("success"); // assuming public/private key authentication here... sftp.addidentityfile(privatekeyfilename, privatekeyfilepassphrase); sftp.connect(sftpport); arraylist files = sftp.getfilelist("."); foreach (string file in files) { console.writeline("\t{0}", file); } sftp.close();

oracle - sql count performance -

possible duplicate: count(*) vs count(1) if have table, 'id' primary key, these 2 commands have different performance ? select count(*) t; select count(id) t; thanks these have same performance. in databases, count() results in scan of table or available indexes. whether or not uses index instead of table depends on query optimizer. if optimizer smart enough use index, should smart enough in both cases. using available metadata tables, can number of rows in table mroe efficiently using count() query.

r - Plot only Edges with a specific weight - igraph -

i have large edge list, , plot edges have particular weight, how can that? i have far tried plot.graph(e(sgdf)[e(sgdf)$weight==3])) but error error in v(g) : not graph object copy graph first, remove edges don't need, , plot rest: > sgdf.copy <- delete.edges(sgdf, which(e(sgdf)$weight != 3)-1) > plot(sgdf.copy) the -1 needed in delete.edges because igraph uses zero-based edge indices while r uses 1-based indices. update : anonymous editor (whose edit sadly rejected) pointed out, igraph uses 1-base edge indices igraph 0.6 onwards. therefore, subtract 1 if using igraph 0.5.x or earlier.

ruby - Using CanCan in engines. Ability.rb example -

i'm new in rails development, , i'm trying create first engine. engine use cancan authorization , restricting user's permissions. i have permissions in engine, , want inherit them in main application. for example: file app/models/my_engine/ability.rb in engine module myengine class ability include cancan::ability def initialize(user) user ||= myengine::user.new # guest user if user.role? "admin" can :manage, :all else can :read, :all end end end end file app/models/ability.rb in main application class ability < myengine::ability def initialize(user) user ||= myengine::user.new # guest user super(user) can :create, somemodel if user.manager? end end file app/controllers/my_engine/application_controller.rb module myengine class applicationcontroller < actioncontroller::base def current_ability @current_ability ||= myengine::ability.new(current_user) ...

Removing round corners from the button in jquery mobile -

i have following button markup in single/multiple page jquerymobile page template. <a href="#" data-role="button" data-icon="arrow-r" data-iconpos="right" >about us</a> i need disable round corners of button using button option given in jquerymobile docs. i have tried $('a').buttonmarkup({ corners: "false" }) in every events such pagebeforecreate, pageinit, pagecreate , mobileinit i never got working , have been struggling make quite long time. dont want use data attribute data-corners="false" now. please suggest ideas this should work: $('a').buttonmarkup({ corners: false }) note "false" should not string. anyway, if want make default behaviour, try like: $(document).bind('mobileinit', function(){ $.fn.buttonmarkup.defaults.corners=false; }); that should work same having data-corners="false" on every button.

statistics - Is there a java library for the Jarque-Bera test? -

i looking open source java library can use jarque-bera statistical test. the library should include tests' critical values sample sizes varying between 8 , 250. does knows such library? appreciated! ok, had same issue had. have finished issue creating own implementation: calculate kurtosis , skewness yourself calculate jb test-statistic yourself. if ever necessary, can provide code here. most of other possible libs needed integration (r related projects) or commercial (suanshu).

twitter - Truncate a tweet while leaving links intact using jQuery -

i'm using tweet echo tweets , want truncate tweet character limit possibly keep links intact (if truncated). there way this? you try doing searching links within tweet (grab between <a> , </a> ), extract them, truncate tweet "x characters minus extractedlinklength" sort of thing, add link end of truncated tweet. not sure of code should work theory.

c# - Bind simple json to MVC Form Collection -

i'm trying bind simple json object (just key value pairs) mvc form collection or of sort javascript: function cmsmodel() { var self = this; self.enable = ko.observable(true); self.cmsaddress = ko.observable(); self.cmsaddressextension = ko.observable(); self.username = ko.observable(); self.password = ko.observable(); self.protocol = ko.observable(); self.port = ko.observable(); self.interval = ko.observable(); self.area = "cms"; self.submitcms = function () { //validate numbers $.ajax({ url: "/config/@model.model/" + self.area, contenttype: "application/json", type: "post", success: function (result) { alert(result); }, error: function (result) { alert(result); }, data: ko.tojson(self) }); } } and on mvc side: publi...

javascript - Remove last element from url -

i need remove last part of url span.. i have <span st_url="http://localhost:8888/careers/php-web-developer-2" st_title="php web developer 2" class="st_facebook_large" displaytext="facebook" st_processed="yes"></span></span> and need take st_url , remove php-web-developer-2 http://localhost:8888/careers/ . but not sure how that. php-web-developer-2 not won't have / in it. - separated string. any help!!?? $('span').attr('st_url', function(i, url) { var str = url.substr(url.lastindexof('/') + 1) + '$'; return url.replace( new regexp(str), '' ); }); demo

c++ - Intersection between multiple images in Xcode -

hey guys have been making game in user presses button , every time presses button, screens adds new uiimageview (which same every time). these uiimageviews separately draggable uitouch function. want them detect intersection well! , want know 2 uiimageviews intersected can change image-url of 2 uiimageviews intersected. -(ibaction)cltouched:(id)sender { imgview2 = [[uiimageview alloc] initwithframe:cgrectmake(120, 20, 80, 80)]; imgview2.backgroundcolor = [uicolor clearcolor]; imgview2.userinteractionenabled = true; imgview2.image = [uiimage imagenamed:@"cl.png"]; [self.view addsubview:imgview2]; } // move image touch can - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event { imgview.userinteractionenabled = true; // touch event uitouch *touch = [[event alltouches] anyobject]; cgpoint touchlocation = [touch locationinview:self.view]; if ([self.view.subviews containsobject:[touch view]]) { [touch view].center = touchlocation; } if (cgrectin...

hadoop - How to find different fragments of a file in HDFS -

is there way find out have fragments of file have put in hdfs gone? mean information file fragments stored in hdfs? you can use fsck command: #> hadoop fsck /path/to/file -files -blocks -locations -racks this lists file, blocks , associated metadata: block name/id block length block replication locations (datanodeip:port) rack (prefix datanode ip's associated rack id) for example: /user/chris/file1.txt 123 bytes, 1 block(s): ok 0. blk_432678432632_3426532 len=123 repl=2 [/rack1/1.2.3.4:50010, /rack2/4.5.6.7:50010]

jquery mobile - jquerymobile listview custom css -

http://jsfiddle.net/weuzb/11/ on example i'm tring display comment message anchored on left, , commenter on right, but larger message (or smaller screen) not overlap shown in example, i'm looking wrap text + float right property of course margin-right: 250px, not on comments' div (for small screen there nothing thx edit ; if can explain why solution http://jsfiddle.net/weuzb/12/ doesn't work (text hidden reason) edit 2 : working http://jsfiddle.net/weuzb/13 , or http://jsfiddle.net/weuzb/31/ , commenter on bottom right corner, , better comment text wrapping width 60% cool if possible edit3: doing li data-role="list-divider" author name, , li message, simpler better http://jsfiddle.net/xhellzx/weuzb/26/ like this? i moved using "position:relative" , manipulating top , right edge values.

javascript - jsp how to escape double quotes -

<center> <span class="reportsubsectiontitle">report type</span> <br /> <html:radio styleid="summary" property="reportoutputstyleid" onclick="dodetail();" value="2" />pending funding &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <html:radio styleid="detail" property="reportoutputstyleid" onclick="dosummary();" value="1" />previously funded </center> so, on loading, want default option 2 selected. <body topmargin="0" leftmargin="0" rightmargin="0" onload="window.moveto(0,0); window.resizeto(screen.availwidth,screen.availheight); window.focus(); insert...

mysql - Old entries containing UTF8 characters saved incorrectly in UTF8 database -

ok, i've ensured mysql (5.1.61) database utf8, table utf8, field utf8, , mysql client's charset set utf8. can store , retrieve utf8 entries successfully. i've ensured terminal's encoding set utf8. create table `cities` ( `name` varchar(255) default null ) engine=myisam default charset=utf8; the issue when comes 200,000 entries exist in database. appears people inherited project messed lot of encoding, saving string hörby hörby à , ¶ valid utf8 characters. is, mysql receiving utf8 string of hörby , storing such . here example first entry 1 of old entries, , second inserting " hörby " database set utf8: mysql> insert cities set name = 'hörby'; query ok, 1 row affected (0.00 sec) mysql> select * cities; +----------+ | name | +----------+ | hörby | <--- old entry | hörby | <--- new entry +----------+ what can convert squished characters once were? we're pretty ready @ point, re-typing 200,000 records not feas...

How can I create a new document out of a subset of another document's pages (in InDesign (CS6) using ExtendScript)? -

Image
i need offer feature allows indesign users select page range in indesign document , create new document out of pages. sounds simple, isn't... i have tried many different ways of doing have failed degree. methods put pages in single spread (which makes indesign crash). best i've been able (see code below) still has problems @ beginning , end (see screenshots below): the original document: the new document: the question: how can create new document out of subset of document's pages (in indesign using extendscript) without having problems shown in screenshots? note: behavior of script quite different in cs5.5 , cs6. question concerns cs6. the second screenshot obtained applying following code document shown in first screenshot: code var firstpagename = { editcontents: "117" }; // page number entered user in integereditbox var lastpagename = { editcontents: "136" }; // page number entered user in integereditbox var sourcedocumen...

Java Dynamic Web project with Maven and Eclipse -

i have several questions creating java web application maven , eclipse: how create java web project servlets, jsp, , other classes maven? it creates simple directory structure, src->main->java. , how put web-inf folder? do need add jdbc-drivers manually folder inside web-inf/lib, or ok point out dependency? is there way test servlets junit? wow that's lot of questions @ once. admit setting webapp project maven , eclipse can tricky, i'll try answer them all. creating web application project maven how create java web project servlets jsp , other classes maven? creates simple directory structure, src->main->java. when creating java web project, final product should war or ear file. war , ear files jar files specific structure can deployed in application server or servlet container. as mentioned, easiest way set maven project web applications use archetypes: mvn archetype:generate -darchetypeartifactid=maven-archetype-webapp if create...

objective c - iPhone app crashes randomly without any error or stack trace -

i new here . sorry if question being repeated have different issue others. my app crashes randomly after amount of time interval without error logs or stack trace. suspect it's memory issue . have following questions : 1.) how stack trace (i have tried nszombie enabled , nsunacughtexcpetion handler) didn't worked 2.) memory warning in app. how confirm whether it's prime suspect above issue? (i have used leaks, app crashes when has 4mb usage not quite sure whether memory leak causing app crash. know application take heap memory more 4mb .) 3.) upper limit memory leak application in ios before app crashes ? 4.) arc me in situation ? also, have tried debug issue using nslog statements since crashes randomly , hard me detect root cause using technique. any ideas or appreciated my app crashes randomly after amount of time interval without error logs or stack trace. suspect it's memory issue. to confirm it's memory issue, s...

php - Using returned data to perform additional javascript tests with ajax -

i have mail.php file gets called ajax script. completeness, ajax script attached below. mail.php file perform server-side validation, , if passes, sends email mail() , data sent ajax request. what want perform additional javascript actions based on response of request. can see @ current state, response of request echo'd screen, fine. want modify html elements based on response. for example, want append image called "ok" page if mail sent, , else append image called "false" page if mail not sent. i'd (in pseudocode) this: if ( request okay ) $('.contact').append('<img src"ok"'); else ( $('.contact').append('<img src="bad''); is there way perform this? thanks! the ajax script shown below: $('.submit').click(function() { $('div.load').html('<img src="images/load.gif" alt="loading..." id="loading" />'); //creation...

how to publish a web service in juddiv3 using eclipse -

i new web services. trying publish jax-ws web service apache juddiv3 using eclipse(indigo) web service explorer. each time try publish following error produced: iwab0135e unexpected error has occurred. uddiexception message part {urn:uddi-org:api_v2}get_authtoken not recognized. (does exist in service wsdl?) i using following components: (i) eclipse indigo (ee version). (ii) juddi-portal-bundle-3.1.2 (iii) windows 7 while publishing web service using following entries under 'actions' section of eclipse 'web service explorer': publish=business publication format=simple publish url= "http://localhost:8080/juddiv3/services/publish" userid = root password = root name = business1 many times when press 'go' button 'please wait. operation still in progress' message displayed after long time. kindly me issue. kindly suggest if there other framework other juddiv3 used create private uddis on local machines. thanks ...

search - Unable to delete by range in SOLR -

i have instance of solr 3.6 running, json default updatehandler. i able delete individual documents following: curl "http://myurl/update?commit=true" -h 'content-type:application/json' -d '{"delete": {"id":"1730887464"}}' what right way delete range of ids? i have tried following: curl "http://myurl/update?commit=true" -h 'content-type:application/json' -d '{"delete": {"id":"[* 1730887464]"}}' curl "http://myurl/update?commit=true" -h 'content-type:application/json' -d '{"delete": {"id":"[0 1730887464]"}}' and following exception. help/pointers appreciated. i've looked up: http://wiki.apache.org/solr/updatejson http://lucene.apache.org/solr/api/doc-files/tutorial.html <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> ...

FFMPEG scale down image -

this ffmpeg gurus! i have video take screenshot image of. works fine: ffmpeg -i sourcemovie.mp4 -ss 0 -vframes 1 destimage.jpg but hoping scale down image 150 px wide, in 1 fell swoop. apparently, should add scale=150:-1 but , how insert in command? i have tried everything; nothing works ... scale videofilter, use "-vf": ffmpeg -i sourcemovie.mp4 -ss 0 -vframes 1 -vf "scale=150:-1" destimage.jpg

actionscript - How to edit a _root function in Flash Pro CS 5.5 -

i need create global function in .fla file. understand should put in _root . i'm having trouble finding how edit _root in flash pro cs 5.5. sorry naive question. this bad idea, global functions pollute global scope, make unextendable , unscalable code not play nice other code. that said, inn actionscript 2 following should work: _root.myfunctionname = function(){ trace("do whatever here"); //your actions }; // can call _root.myfunctionname;

css - 3 Column Fluid Div Display Glitch: "Hanging" Individual Divs -

i have responsive fluid design portfolio 3 columns. wrong css having trouble pinpointing. if have 3 items on row, appears fine. however, if last item ends on line 1 or 2 columns, whole format gets distorted. can seen resizing browser. if can me pinpoint css fix this, appreciate greatly. the example page here: http://bit.ly/kzfn2g i believe main css style culprit of problem, wrong: .mosaic-block-three { margin-right:3%; width:29.3%; background:url("../img/progress.gif") no-repeat scroll center center #f5f5f5; border:1px solid #ffffff; box-shadow:0 0 4px 0 #888888; float:left; margin:10px 40px 30px 0; overflow:hidden; position:relative; width:291px; } whoa, holy registered trademark batman! put <sup>&reg;</sup> if :) question @ hand... why have many lists 1 item? you've got styles in there aren't defined, think biggest problem have items within <li> that floated while contai...

java - Asyncrhonous socket client -

i'm developing asynchronous socket client based on threads. when program calls readline() , blocks indefinitely , never returns. public class adnclient { socket socket = null; dataoutputstream dataoutputstream = null; datainputstream datainputstream = null; thread listener = new thread(new runnable() { @override public void run() { string line; try { // stop here , doesn't progress while ((line = datainputstream.readline()) != null) { //do } } catch (ioexception e) {} }); public adnclient() { try { socket = new socket("192.168.1.5", 5000); dataoutputstream = new dataoutputstream(socket.getoutputstream()); datainputstream = new datainputstream(socket.getinputstream()); listener.start(); //sender.start(); } catch (exception e) { log.e("adn", e.getmessage()); } } public void close() { listener.stop(); try { ...

c++ - Qt::Tool appear too fast when parent restored -

i have qt application, window several child widgets qt::tool windows. when minimize window , restore on windows 7 child widgets appear immediately, parent window not because of animation. is there way prevent behavior , make child windows appear after main window? why don't hide tool windows while main window restoring? can use piece of code , adapt needs: void mainwindow::changeevent( qevent* e ) { if ( e->type() == qevent::windowstatechange ) { qwindowstatechangeevent* event = static_cast< qwindowstatechangeevent* >( e ); if ( event->oldstate() & qt::windowminimized ) { qdebug() << "the window has been restored!"; } else if ( (event->oldstate() == qt::windownostate) && (this->windowstate() == qt::windowmaximized) ) { qdebug() << "the window has been maximized!"; } } } for example, can start timer amount of time, , have slot connected chi...

iphone - Custom Number Pad with $ sign -

okay have custom number pad works , shows numbers 0.00 in label (numberfield), need show $0.00. nsstring *digit = sender.currenttitle; numberfield.text = [numberfield.text stringbyappendingstring:digit]; nsnumberformatter *numberformatter = [[nsnumberformatter alloc] init]; [numberformatter setnumberstyle:nsnumberformatterdecimalstyle]; [numberformatter setgroupingseparator:@""]; [numberformatter setmaximumintegerdigits:4]; [numberformatter setmaximumfractiondigits:2]; [numberformatter setmaximumfractiondigits:2]; numberfield.text = [numberfield.text stringbyreplacingoccurrencesofstring:@"." withstring:@""]; nsdecimalnumber *currency = [[nsdecimalnumber decimalnumberwithstring:numberfield.text] decimalnumberbydividingby: [nsdecimalnumber decimalnumberwithstring:@"100"]]; nsstring *numberfieldformat = [numberformatter stringfromnumber:currency]; numberfield.text = numberfieldformat; i tried $%1.2f crashes because not recognize $ sign num...

dependencies - Making GNU Make locate the correct library dependency -

i've got simple makefile in 1 target depends on library: test49: test49.c -lpthread the binary built using implicit rule turning .c file executable. problem is, trying cross-compile, make interpreting -lpthread pointing /usr/lib/libpthread.so , quite incorrect. have defined path cross-compiler using cc=/path/to/bin/gcc , assume figure out -lpthread should somewhere in /path/to/lib , not. you replace test49: test49.c -lpthread with test49: test49.c /path/to/lib/lpthread.so

iphone - How to improve imageView appear from behind -

i have 2 imageviews , 1 on one. when scroll gesture, below 1 appear in front. not satisfied that, pic below appear suddenly. effect want gradually appear. can have @ this website (try changing pic). can 1 give me clues achieving or advise improve imageview appear behind? you want use animation gradually change alpha of imageview 0 1. achieve desired affect. something this... imageview.alpha = 0; [uiview animatewithduration:0.3 delay:0.0 options:uiviewanimationcurvelinear animations:^{ imageview.alpha = 1; } completion:nil];

flash - How can I set a color to transparency for an import image in AS2 -

how can set color black: 0x000000 transparent, normaly magic pink transparent want set black be. if don't understand: http://j.imagehost.org/0829/woodygx_0.jpg i have image, , when converting 80x80 sprite want background transparent, meaning: no background, character. notice: answer in actionscript 3, in case either decide migrate actionscript 3, moreso other people , general info. can create new bitmapdata source bitmapdata black pixels removed (converted alpha channel). i've created function you: // takes source bitmapdata , converts new bitmapdata, ignoring // dark pixels below specified sensitivity. function removedarkness(source:bitmapdata, sensitivity:uint = 10000):bitmapdata { // define new bitmapdata, size constraints ensure loop // doesn't time out / crash. // demonstration only, consider creating class manages // portions of bitmapdata @ time (up 50,000 iterations per // frame) , dispatches event new bitmapdata whe...

selenium - C# Webdriver - Upload file(silverlight) -

my c# webdriver automation script trying upload file using browse button silverlight object. please let me know how upload file using webdriver. below code worked html file upload not in case of above scenario. driver.findelement(by.xpath("//input[@id='fileinput']"), waittime).sendkeys("\\\\...\\....\\test.txt"); the file upload methods in webdriver intended work <input type='file'> elements. working non-html mechanisms of uploading files (which include silverlight , flash), you'll need investigate other libraries.

mysql - If I already have a database, what PHP cart can implement it easily? -

at internship, tasked setting whatever php shopping cart me , co workers think best. installed magento, , looks nice, develops own mysql database. that's not bad thing, job invested lot of time in implementing system automatically synchronizes mysql database quickbooks data. database has 1300+ items in , ready go. magento forums saying magento stuck it's own database. is there solution this? can magento community modified works database in place? or there php mysql shopping cart out there can work item/customer database that's in place? unless company has invested gigantic amounts of money build current system, , unless it's heavily customized, may profit admitting possible might have gone in wrong direction in trying build wheel has been re-invented many times already. i've never used magento, quick google search shows have quickbooks support , , i'm sure quick import script solve ~1300 items have added system.

android - Cannot connect to Facebook -

i have problem connecting facebook application. had connected, logged-in , posted facebook via android emulator failed when exported physical devices (both android smartphone , tablet). don't know problem be. please update below code of application. public void loginandposttowall() { facebook.authorize(this, permissions, facebook.force_dialog_auth, new logindialoglistener()); }

algorithm - Swapping Integers Efficiency -

simply, x = integer y = integer z ( if used ,integer temp ) what's efficient method ? method : z = x x = y y = z method ii : x ^= y y ^= x x ^= y edit i [ assembly view ] method : mov mov mov method ii : test ( , ) jz xor xor xor notes : mov slower xor test , jz used xor equality safe `method uses register in cases, using temporary variable (usually register @ assembly level) best choice, , 1 compiler tend generate. in practical scenarios, trivial swap algorithm using temporary register more efficient. limited situations in xor swapping may practical include: on processor instruction set encoding permits xor swap encoded in smaller number of bytes; in region high register pressure, may allow register allocator avoid spilling register. in microcontrollers available ram limited. because these situations rare, optimizing compilers not generate xor swap code. http://en.wikipedia.org/wiki/xor_...

html - Same font, character spacing and line-height but different results -

Image
the introduction of @font-face in css3 allows web designers use fonts same across browsers. thought until trying out following code in jsfiddle : html : <div> the_quick_brown<br> fox_jumps_over<br> the_lazy_dog </div> css : @font-face { font-family: 'open sans'; font-style: normal; font-weight: 400; src: url('http://themes.googleusercontent.com/static/fonts/opensans/v6/cjzkeoubrn4kerxqtauh3t8e0i7kzn-epnyo3hzu7kw.woff') format('woff'); } div { display: block; width: 496px; height: 86px; font-size: 1.3em; font-family: 'open sans'; font-style: normal; margin: 0; border: 0; padding: 0; background: cyan; letter-spacing: 1.44em; line-height: 1.44; overflow: hidden; } this view firefox 12.0. take note of partially obscured 'o' in 'brown', position of 'g' in 'dog' , underscore '_' @ bottom edge. this view go...

javascript - Absolutely reference-free array copy with nested arrays -

at first thought arr.slice(0) doing deep unreferenced copy, doing shallow unreferenced copy, if array contains nested arrays, they still referenced : var = [1,2] var b = [3,4] var c = [a,b] var d = c.slice(0) d[0] === // true, means /same/ object d[0][0] = "hi!" // ["hi!", 2] (example source) the solution on links provided easy when know structure of array (just .slice(0) ing again nested arrays trick), gets complicated if don't know how structure of nested arrays is. my first idea loop on whole thing, on levels, until fails find array object. is approach acceptable? are there built-in functions missing? i can't believe need copying silly array like nonnb suggests, serializations / deserialization cycle result in deep copy. this: //a array arbitrary levels of nesting. var c = json.parse(json.stringify(a));