Posts

Showing posts from September, 2014

matlab - Asking mex to use several directories for #include files -

i read in documentation matlab's mex here following: -ipathname : add pathname list of folders search #include files. not add space after switch. how can ask mex use multiple include folders? provide them -ipath1 -ipath2 etc? yes; example: mex -iinclude/path/one -iinclude/path/two -i"include/path/with spaces" mymexfile.c

perl - Win32::Serial Binary Communication -

i trying communicate uart on embedded system using win32::serial port (perl module). seems work fine in terms of sending data, ever reason unable receive data. hoping there function besides read() show read data? # write serial data port in little endian form foreach $intermvalue (@writedata) { $msb = int($intermvalue/256); $lsb = ($intermvalue - $msb*256); # writing lsb first , msb after (little endian form) print "writing: lsb: ".$lsb." msb: ".$msb."\n"; $class->{"serialport"}->transmit_char($lsb); $class->{"serialport"}->transmit_char($msb); } # read data serial port ($countin, $recieveddata) = $class->{"serialport"}->read($expectedbytes); thanks thanks reply, turns out there input function in library, using , 1 second sleep able make module work. # write serial data port in little endian form foreach $intermvalue (@writedata) { $msb = int($intermvalue/256);

Decorator pattern with Castle Windsor -

i'm using ver. 2.53. i'm trying decorate services, takes ifoo in constructor: regs: container.register( component.for<ifoo>().implementedby<cachefoo>().dependson(property.forkey("wrapped").is("bar")), component.for<ifoo>().implementedby<bar>().named("bar") ); i keep getting: can't create component 'xyz.cachefoo' has dependencies satisfied. xyz.cachefoo waiting following dependencies: services: - xyz.ifoo. dependency cannot satisfied itself, did forget add parameter name differentiate between 2 dependencies? bar registered , matching required service, cannot resolved. i've tried parameters , serviceoverrides, same result. ken

asp.net mvc - Ajax.ActionLink repeating the same exact GET request multiple times -

Image
i'm learning mvc , making simple scrum tracking system go along. the problem i'm having when ajax.actionlink clicked, run same ajax action once every scrum card displayed on page. as can see, have 9 cards displayed , 9 identical requests. (the action link color wheel image in lower right hand side of card). singlecard.cshtml (view) - "colorpicker" name of action. <script src="@url.content("~/scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script> ... <div class="card_footer" id="card_footer_id_@(model.id)"> <div class="card_tags"> [tag1] [tag2] [tag3] </div> <div class="card_colorwheel_icon"> @ajax.imageactionlink("../content/images/color_wheel.png", "color wheel", "colorpicker", new { cardid = model.id }, new ajaxoptions { updatetargetid = "colorpickerdisplay" })

php - How do I get this URL without considering the Apache settings? -

hello have url need php http://www.domain.com/forum/#forum/general-discussions-0.htm the problem not real url, mask created .htaccess. i need visible url , not real path of file, because need compare php variables have. in fact real path this: http://domain.com/modules/boonex/forum/index.php and in way totally useless me. how first url is? you can't http://www.domain.com/forum/#forum/general-discussions-0.htm . after fragment ( # ) not send server, there no way retrieve save delayed update javascript. you'll http://www.domain.com/forum/ send server, , on onload event of document can possibly load in javascript.

Linq to SQL SubmitChanges() not working if textbox modified by listbox -

in simple test form, have listbox , textbox. form bound datacontext, has single table. listbox has 2 items, , not bound. textbox bound datacontext. when select item listbox, following code runs: txttest.text = lsttest.selecteditems(0).tostring then when push save button, following code runs: me.textdc.submitchanges() but - database field textbox bound not updated. if manually type in value textbox , push save button, database field updated. i've been trying solve on , off several days, , made simple text form confirm or deny happening. no errors occur. so, reason submitchanges() not recognize textbox needs updated if it's .text property has been updated listbox, recognize needs updated if manually type in value. any thoughts? solved! somehow, don't know how exactly, connection string sql server in dbml file , connection string in application settings file different. made absolutely sure both pointing same sql server database, , works corr

C# parallel programming with list - is reading thread-safe? -

i'm reading book parallel programming says it's not thread save add elements list without using lock result unpredictable. example if have add 800 000 elements list, final result have less 800 000 elements. now wondering if thread save read elements list. example lets have list blacklistednumbers list<int> blacklistednumbers = new list<int> {10, 50 ....... n}; //lets there 500 000 elements in list and list numbers containing 10 000 000 numbers, i'll use parallel.foreach complete task , want final list containing numbers numbers not in blacklistednumbers list list<int> finallist = new list<int>(); parallel.foreach(numbrs, num => { if (!blacklistednumbrs.contains(num)) { lock (finallist) { finallist.add(num); } } }); i know not efficient way done i'm trying illustrate problem. so question is: thread save read result list blacklistednumbrs , 100% accurate results

c# - How do we use a LINQ query on a Dictionary with a nested object? -

what trying bulk insert values dictionary database. here how dictionary setup: public class record { public int valuenumber; public string valuestring; public byte[] valuebinary; public datetime valuedatetime; } public dictionary<string, record> elements = new dictionary<string, record>(); i want ultimately, this: ienumerable<datarow> query = elements.asenumerable(); // create table query. datatable dt = query.copytodatatable<datarow>(); // insert database sqlbulkutilities.bulkinsertdatatable(connectionstring, "orders", dt); here sqlbulkutilities looks like: public class sqlbulkutilities { public static void bulkinsertdatatable(string connectionstring, string tablename, datatable table) { using (sqlconnection connection = new sqlconnection(connectionstring)) { sqlbulkcopy bulkcopy = new sqlbulkcopy (

ANTLR C target and XMLLib -

i have program written in c uses xmllib , lexer/parser generated antlr. my includes like: #include "myparser.h" #include "mylexer.h" #include "antlr3.h" #include <libxml/tree.h> #include <libxml/parser.h> the problem program refuses compile, erroring with: in file included /usr/include/libxml2/libxml/parser.h:19:0, /usr/include/libxml2/libxml/globals.h:18, /usr/include/libxml2/libxml/threads.h:35, /usr/include/libxml2/libxml/xmlmemory.h:218, /usr/include/libxml2/libxml/tree.h:1248, myprogram.c:4: /usr/include/libxml2/libxml/valid.h:276:21: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant /usr/include/libxml2/libxml/valid.h:302:21: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant in file included /usr/include/libxml2/libxml/globals.h:18:0, /usr/include/libxml2/libxml/threads.h:35, /usr/include

entity relationship - How can I have one content type be a child of another content type in Drupal? -

i create new content type family in drupal. content type have fields ask choose list of child child custom content type. furthermore, i'd restrict choose child field show children content has been created. example: i'd create new family based on family content type. while i'm creating family, i'd ask me children want, , can choose bob, john or sarah of created content of content type child . i installed relation module don't understand how works i'm not sure if need or if can achieve somehow taxonomy or in drupal core. i'm not sure relationship module have not used it, worth time @ references module . pretty port of node reference , user reference field types part of cck in drupal 6. installs new field types can use in content types. once install module (be sure install node reference) can add node reference field "family" content type , allow reference nodes "child" content type.

c - Stack assignment to a thread -

i've been trying piece how stack memory handed out threads. haven't been able piece whole thing together. tried go code, i'm more confused, i'm asking help. i asked question little while ago. assume particular program (therefore, threads within same process). if write printf s each beginning of stack pointer, , how allocated them, stuff table @ end of message, first column time_t usec , second doesn't matter, third tid of thread, fourth guard size, begin of stack, end of stack (sorted beginning of stack), last 1 allocated stack (8 megs default) , last column difference between end of first allocated stack, , beginning of next stack. this means (i think), if 0, stacks contiguous, if positive, since stack grows down in memory, means there "free space" of many mbs between tid , next (in memory). if negative, means memory being reused. may mean that stack space has been freed before thread created. my problem is: algorithm assigns stack space thre

Maven: Compiling package-info.java to package-info.class? -

i have package-info.java in package, hibernate wants features (programatic entity scanning). however, mvn package not result in package-info.class being in classes/ not in artifact. how can force happening? mvn -v apache maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) java version: 1.6.0_26 java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre default locale: en_us, platform encoding: utf-8 os name: "linux" version: "2.6.35-30-generic" arch: "amd64" family: "unix" give -xpkginfo:always option javac. see javac documentation .

ruby on rails - Bundle install installs gems in ./mysql2 folder -

i upgraded mysql on machine. result i'm attempting update mysql2 gem accordingly. in process of doing that, run "bundle install", , reason of gems in gemfile getting installed in ./mysql2 directory?? ruby-1.9.2-p180 [dev]:project.git$ bundle install note: gem.source_index deprecated, use specification. removed on or after 2011-11-01. gem.source_index called /users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3. note: gem.source_index deprecated, use specification. removed on or after 2011-11-01. gem.source_index called /users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/source.rb:162. note: gem::sourceindex#each deprecated no replacement. removed on or after 2011-11-01. gem::sourceindex#each called /users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/source.rb:162. note: gem.source_index deprecated, use specification. removed on or after 2011-11-01. gem.source_index called /users/al/.rvm/gems/ruby-1.9.

Java Data Binding and Custom Converter -

i'm attempting bind atomicboolean "enabled" property of jcheckbox. since atomicboolean not replacement boolean i'm using custom converter. however, converter shown below results in classcastexception. why? org.jdesktop.beansbinding.binding binding = org.jdesktop.beansbinding.bindings.createautobinding(org.jdesktop.beansbinding.autobinding.updatestrategy.read, isidle, org.jdesktop.beansbinding.objectproperty.create(), cornercb, org.jdesktop.beansbinding.beanproperty.create("enabled")); binding.setconverter(new converter<atomicboolean, boolean>() { @override public boolean convertforward(atomicboolean value) { boolean b = value.get(); return b; } @override public atomicboolean convertreverse(boolean value) { return new atomicboolean(value); } }); resulting exception java.lang.classcastexception @ java.

objective c - How do I enable the various menu items created by default in a cocoa application? -

i trying make gui simple hex editor have made. can't enable of default menu items (i.e. "open...", "save", etc) no matter grayed out , un clickable. i have tried link "open..." menu item first responder object's received action opendocument: making new class name filemenucontroller.m has 1 method -(ibaction)opendocument:(id)sender; new xcode, interface builder, , objective-c , @ loss how proceed. note: not document based application. thanks help! you've got right idea. there 2 ways enable menu items, described in enabling menu items . automatic enabling, system check responder chain looking objects implement action each item in menu. if finds responder appropriate action, enables menu item. so, you've connected menu item first responder, , you've implemented same action in filemenucontroller class. other things need are: make sure filemenucontroller inherits nsresponder, can part of responder chain create

css - Problems with vertical centering and divs taking up space -

i've got few problems i've been trying remedy today. i have image 930 pixels high want center in exact middle of screen. used recommended css snippet. position: absolute; top: 50%; left: 50%; width: 1280px; height: 930px; margin-top: -465px; margin-left: -640px; but unfortunately, if viewport smaller 930px, starts crop top of area. i've tried few methods, nothing seems help. also, in chrome i've managed number of sized, moved divs don't require scrolling, in firefox , ie seem still take space before moving (using left: , top:) any appreciated, thanks. i have ugly solution works except ie<8: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title></title> </head> <body> <div id="positioner"></div><!-- --><img src="yourimage" alt="" id="image" /> </body> </html>

gwt - Disable ButtonCell in a celltable -

in celltable, 1 column has buttoncells. need disable theses buttoncells clicking on button located outside celltable. you create own button cell class. example: import com.google.gwt.cell.client.abstractsafehtmlcell; import com.google.gwt.cell.client.cell; import com.google.gwt.cell.client.valueupdater; import com.google.gwt.dom.client.element; import com.google.gwt.dom.client.eventtarget; import com.google.gwt.dom.client.nativeevent; import com.google.gwt.safehtml.shared.safehtml; import com.google.gwt.safehtml.shared.safehtmlbuilder; import com.google.gwt.text.shared.safehtmlrenderer; import com.google.gwt.text.shared.simplesafehtmlrenderer; /** * {@link cell} used render button. */ public class styledbuttoncell extends abstractsafehtmlcell<string> { private string disabledstring = ""; private boolean disabled = false; /** * construct new buttoncell use {@link simplesafehtmlrenderer}. */ public styledbuttoncell() { this(simplesafehtmlrendere

Curvy tabs in Eclipse RCP App -

Image
i using eclipse helios service release 1. new both ide , platform. my question is, how same curvy tab on app of ide? according this thread , blog post : see " eclipse look&feel customization " more. all see " java-tips ": to change shape of title of view following line of code can written in prewindowopen() method of applicationworkbenchwindowadvisor . platformui.getpreferencestore().setvalue(iworkbenchpreferenceconstants.show_traditional_style_tabs, false); note there might issue long titles when there many tabs: see bug 322623 : "editor tabs not show ellipsis long filenames when using new style tabs."

Facebook Authentication Without Redirect? -

is there way use facebook authentication (the oauth 2.0) without redirecting? i not using facebook login button, supposed redirect https://www.facebook.com/dialog/oauth ? client_id=your_app_id&redirect_uri=your_url, don't want redirect user outside of page. there way open url in popup window (how do btw?), , catch sessionchange event when working normal facebook login button? using jquery , pyramid. thanks! i made application client couple weeks ago behavior using facebook js sdk fb.login(function(response){ if(response.session){ var user_id = response.session.uid, access_token = response.session.access_token; } } ); you can send access_token server ajax if want. careful if you're using ajax, session expire if don't make calls fb.getloginstatus() every often.

python - About Twisted Documents -

i beginner twisted. recently, reading book "twisted network programming essentials".the example 2-3 in book below: class quickdisconnectprotocol(protocol.protocol): def connectionmade(self): print "connected %s." % self.transport.getpeer( ).host self.transport.loseconnection( ) ================================== self.transport.loseconnection( ) where member "transport"? couldn't find 1 in protocol. same question when comes ex2-4... does have clue on how read twisted documents? thanks! def makeconnection(self, transport): ([source][1]) """ overridden in twisted.protocols.amp.binaryboxprotocol, twisted.protocols.ftp.protocolwrapper, twisted.protocols.ftp.senderprotocol, twisted.protocols.policies.protocolwrapper, twisted.protocols.stateful.statefulprotocol` make connection transport , server. sets 'transport' attribute of protocol, , calls connectionmade()

Jquery UI Scroll Bar not fitting the contents -

i using jquery ui scroll bar http://jqueryui.com/demos/slider/#side-scroll link customized scroll bar http://providentfeed.com/beta/search.php . can see @ bottom using pagination. problem scroll bar starting middle , don't move on start , when move right shows empty space after means not able move corners. in jquery default demo, perfect. idea please, fix problem? regards i inspect page , think problem css . div of class .scroll-bar , child div class .ui-handle-helper-parent not equal. if 2 div have same width work required. in page computed width of class .scroll-bar 289px . try $('.ui-handle-helper-parent').width('289px'); or $('.ui-handle-helper-parent').width($('.scroll-bar').width()); if have border in .scroll-bar actual width of div including right , left border.

Finding Difference between Dates in Javascript ( Yui Calendar ) -

i have been working orangehrm project. uses yui calendar. have been working on leave module. leave module lets user choose , date - time frame wants apply leave ! i want show number of working days once user has chosen dates . simple subtract statement not work because want exclude saturdays , sundays equations since don't count working days ! function filltodate(frmleaveapp) { var fromdate = frmleaveapp.elements['txtleavefromdate']; var todate = frmleaveapp.elements['txtleavetodate']; var result = frmleaveapp.elements['txtleavetotalday']; if(!fromdate || !todate || !result) { return; } var = fromdate.value; var b = todate.value; var c = a.split('-'); var d = b.split('-'); var ac = new date(); ac.setfullyear(c[2], c[1], c[0]); var bd = new date(); bd.setfullyear(d[2], d[1], d[0]); result.value = (bd.gettime() - ac.get

java - "Cannot read git config" when configuring Git default remote and merge -

i´m using egit eclipse sync dev environment 2 different computer. have slight problem 1 created project , pushed remote git repo (which happens github). now searched web , found pointers indicating have add key/value pairs myself config file. keys branch.master.merge , branch.master.remote my config looks this: [core] repositoryformatversion = 0 filemode = false logallrefupdates = true autocrlf = false [remote "origin"] url = https://dan-lind@github.com/dan-lind/prime-sweet.git fetch = refs/heads/master:refs/remotes/origin/master the info found add follwing lines: branch.master.merge = refs/heads/master branch.master.remote = origin question: supposed put them? tried putting them both under core , under remote sections, fire eclipse error message saying git config file cannot read. if remove 2 lines again, fine (except still have no defaults , cannot use pull) any suggestions? cheers! the branch.master translates section called [branch "master

android - Access GUI elements before it is created? -

in activity lifecycle onactivityresult method called before oncreate methode, buttons etc. initialized. how possible access them though? thx background knowledge! the way onactivityresult event should happen if used startactivityforresult create new activity generates event. which means calling activity should in stack , created paused oncreate called. unless there orientation change in between have never tried , poses interesting question. are having issue or trying understand mechanism? if having , issue post code.

asp.net mvc 3 - Bind dropdown list from database -

i have been struggling create dropdown list display country names database. the situation is: have controller "advertisementcontroller", model"advertisementmodel" , view "create.cshtml". on view need create dropdown list display country names database. i know thing create viewmodel. how shall that? bunch of code appreciated. :) i have following code shows 'null reference' error. viewmodel: public class communicationviewmodel { public string categoryid { get; set; } public ienumerable<selectlistitem> categorylist { get; set; } } model: public class createadmodel { [required] [display(name = "title")] public string title { get; set; } [required] [display(name = "description")] [datatype(datatype.multilinetext)] public string message { get; set; } [required] [display(name = "ad type")] pub

Return URLS from php string -

i have php array of strings looks this array ( [1] => lorem ipsum dolor sit amet http://www.google.com/search?q=stackoverflow consectetur adipiscing elit. [2] => phasellus tempor vehicula fringilla. www.google.com/search?q=stackoverflow&ie=utf-8 [3] => google.com/search?q=stackoverflow&ie=utf-8 aenean in cursus libero. ); urls sorts of forms, need array of links. this: array ( [1] => http://www.google.com/search?q=stackoverflow [2] => http://www.google.com/search?q=stackoverflow&ie=utf-8 [3] => http://www.google.com/search?q=stackoverflow&ie=utf-8 ); the code you: $pattern = '/((https?|ftp)\:(\/\/)|(file\:\/{2,3}))?(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(((([a-za-z0-9]+)(\.)?)+)(\.)(com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|[a-z]{2}))([\/][\/a-za-z0-9\.]*)*([\/]?(([\?][a-za-z0-9]+[\=][a-za-z0-9\%\(\)]*)([\&][a-za-z0-9]+[\=][a-za-z0-9\%\(\)]

GWT + Tomcat Session without Cookies! -

i'm working on web-project uses gwt on client , java on server side (tomcat7). if cookies enabled on browser, works fine. can use sessions without problems. if cookies disabled on browser, sessions doesn't work. i guess, gwt apps being single web-page application requests data server via ajax. is there way sessions working under such circumstances? help appreciated! all best, thomas if using gwt rpc, need modify rpc urls burn in jsessionid discussed in forum post . though not sure if line cookies.getcookie("jsessionid") shown forum post work in case. might need parse location.href

selection - OpenGL ES 2.0 Object Picking on iOS -

what best method select objects have been drawn in opengl es 2.0 (ios)? i drawing points. here working prototype of color picking, tested on old ipads , working well. part of project called incube chess 1 may find in app store. main code see located in class derived glkviewcontroller this: @interface incubeviewcontroller : glkviewcontroller this means have glkview in it: ((glkview *)self.view). here properties: @property (strong, nonatomic) eaglcontext *context; @property (strong, nonatomic) glkbaseeffect *effect; don't forget synthesize them in *.m file. @synthesize context = _context; @synthesize effect = _effect; the idea have chess pieces on table (or objects in 3d scene) , need find piece in list of pieces tapping on screen. is, need convert 2d screen tap coords (@point in case) chess piece instance. each piece has unique id call "seal". can allocate seals from 1 something. selection function returns piece seal found tap coords. having

c# - Specifying Notepad as OLE object -

for word application, have word.application program identifier. program identifier notepad , calculator? word.application name of com object forms part of word api. notepad simple application not have com api. if wish start instance of notepad, locate notepad.exe file in %windir% or %windir%\system32 (for w2k8), , start new process application. the same applies calc.exe .

java - Why is my JTextArea not updating? -

i have code follows: class simplifiedclass extends japplet { private jtextarea outputtext; // lots of methods public void doeverything() { string output = ""; for(int = 0; <= 10; i++) { output += taskobject.somelongtask(i); outputtext.settext(output); } } } however, instead of updating text area after each iteration of loop when settext called, appears update text when runs of task done. why happen, , how can resolve it? you're using swing thread waiting code execute before can update ui. try using separate thread loop. public void doeverything() { swingutilities.invokelater(new runnable() { public void run() { string output = ""; for(int = 0; <= 10; i++) { output += taskobject.somelongtask(i); outputtext.settext(output); } } }); }

httpserver - android and sending files to HTTP server -

i try write application send file http server. here android-side code: public void send(view view) { httpurlconnection connection = null; dataoutputstream outputstream = null; datainputstream inputstream = null; string pathtoourfile = "/data/file.txt"; string urlserver = "http://localhost/zad1.php"; string lineend = "\r\n"; string twohyphens = "--"; string boundary = "*****"; int bytesread, bytesavailable, buffersize; byte[] buffer; int maxbuffersize = 1*1024*1024; try { fileinputstream fileinputstream = new fileinputstream(new file(pathtoourfile) ); url url = new url(urlserver); connection = (httpurlconnection) url.openconnection(); // allow inputs & outputs connection.setdoinput(true); connection.setdooutput(true); connection.setusecaches(false); // enable post method connection.setrequestmethod(

iphone - Navigation-based app with TabBar -

i'm using navigation-based application template core data. please tell me how , tabbar on bottom of view. using uitableview , if add uitabbar subview, tabbar moving along tableview when scrolling. switch between views tabbar, first "segment" of tabbar should open rootview (navigationbar tableview),and second other view. now did this: uitabbarcontroller *tabbarcontroller = [[uitabbarcontroller alloc] init]; tabbarcontroller.viewcontroller = [nsarray arraywithobject:yournavigationcontroller]; self.window.rootviewcontroller = tabbarcontroller [tabbarcontroller release]; that works fine, how can add more items uitabbar , each item other view? tabbar has 1 item on rootview loaded thanks! use uitabbarcontroller root view controller in application delegate: uitabbarcontroller *tabbarcontroller = [[uitabbarcontroller alloc] init]; tabbarcontroller.viewcontroller = [nsarray arraywithobject:yournavigationcontroller]; self.window.rootviewcontroller = tabbarc

asp.net mvc - Export to CSV from MVC Controller and View displays CSV raw data on Page -

i've got mvc view export excel working great, however, because i'm setting location.href leaving me page full of csv data rather neat grid results before user hit export button. i'm trying think how change following script doing leave page alone. tried making call search go server again @ runtime user see's csv on webpage momentarily, not good. any ideas appreciated, cheers $(function() { $('#exportbutton').click(function() { var url = $('#absolutepath').val() + 'waste.mvc/export'; var data = { searchtext: $('#searchtextbox').val().tostring(), searchtextsite: $('#searchtextboxsite').val().tostring(), startdate: $('#startdate').val(), enddate: $('#enddate').val() }; $('#resultslist').load(url, data, function() { $('#loadinggif').empty();

Middleman, Compass and Formalize -

i have been trying middleman, compass , formalize work together, far without luck. i did install compass formalize plugin sudo gem install compass_formalize ... , did add obligatory require config.rb require "compass_formalize" ... effect stylesheets can located (with @import "formalize"; ), don't know how pull in javascript files. anyone? jquery example: cd project_dir compass install formalize/jquery jquery.formalize.js should in javascript directory specified in config.rb

c# - How do I make all but a certain colour black in an image? -

i have image lot of green in it, large amount of different coloured pixels. green not issue. how can turn non-green pixels black? in p-code: for each pixel if pixel not green pixel <- black

xml - parsing .xsd in python -

i need parse file .xsd in python parse xml. using libxml2. have parse xsd follow: <xs:complextype name="classtype"> <xs:sequence> <xs:element name="ieplcheader"> <xs:complextype> <xs:sequence> <xs:element name="device-number" type="xs:integer" fixed="1"/> </xs:sequence> <xs:attribute name="version" type="xs:integer" use="required" fixed="0"/> </xs:complextype> </xs:element> when access with doc.xpatheval('//xs:complextype/xs:sequence/xs:element[@name="ieplcheader"]'): tells me cannot find path. while if remove xs: follow <complextype name="classtype"> <sequence> <element name="ieplcheader"> <complextype> <sequence> <element name="

utf 8 - Problem encoding with utf-8 -

i referred serhio utf-8 encoding problem , hv been trying whole day different methods searched net :( want show chinese characters in subject lines when received in gmail shows rubbish characters. had tried put header('content-type: text/html; charset=utf-8'); on top of page not working i tried add "\r\n" not working my code below $mail->charset = 'utf-8'; $mail->body('',$strinv); $mail->subject('"=?utf-8?b?".base64_encode(我的问题)."?=" #'.$inquiry_no); when received in gmail subject looks : "=?utf-8?b?".base64_encode(订å •Ã§¡®Ã¨®¤)."?=" #00016 i appreciate can me this. thank you. when fix subject string should this: =?utf-8?b?russiannnn?= use echo function debug subject string before call $mail->subject or do $ssubject = '=?utf-8?b?' . base64_encode('russian') . '?='; $ssubject = $ssubject . $inquiry_no; $mail->subject($ssubject);

html - Displaying a web page inside another without frames -

i want display webpage inside website page. how safe approach below, , how practice this? <div style="margin: 0 auto; width:100%; height:400px;"><object type="text/html" data="http://answers.yahoo.com/" style="width:100%; height:400px; margin:1%;"></object></div> it will, effectively, iframe fewer features , weaker support. use iframe instead.

How to run android2.2 google maps application in android 2.3.4 device -

i working on android2.3.4 version. install previous application 2.3.4 version device . when iam installing iam getting error installation error: install_failed_missing_shared_library can please explian me regarding , needfull me thanks in advance your 2.3.4 device not have google maps, based on error message.

parse json with a callback function in android -

i firing request through android application using httppost , request returning json callback function , don't know how handle , parse it. returned format: handleemployeeresponse({ "records": [ { "fulldesc": "records employe", "id": "emp_1", "name": "jack" } ] }); in firebug can see response text handleemployeeresponse({"records":[{"fulldesc":"records employe","id":"emp_1","name":"jack"}]}); if parse above response using jsonobject jobject = new jsonobject(jstring); surely gonna json parsing error above response not valid json @ have remove "handleemployeeresponse , ( , ); " form response string need pass jsonobject can tell me how parse json callback function in android it looks service returning response in jsonp format (json padding). either need regex out json message, o

Correcting spelling rule in StyleCop -

stylecop rule sa1642 insists documentation header constructors must begin 'initializes new instance of...'. whereas agree rule itself, can't bring myself accept stylecop enforcing spellings consider ugly. it's 'initialises' 's'!!! is possible modify expected text, or must disable sensible rule? current stylecop version doesn't support customization documentation rules. , there no short-term plans support it. as possible workaround (instead of disabling entire rule) refer third-party custom rules. example, stylecop+ allows writing "initializes new instance." "initializes new instance of class1 class." so guess extended allow "initialises ..." . if want force "initialises" , prohibit "initializes" seems need wait customizable documentation rules support.

c++ - BOOST ASIO multi-io_service RPC framework design RFC -

Image
i working on rpc framework, want use multi io_service design decouple io_objects perform io (front-end) the threads perform rpc work (the back-end). the front-end should single threaded , back-end should have thread pool. considering design front-end , back-end synchronise using condition variables. however, seems boost::thread , boost::asio not comingle --i.e., seems condition variable async_wait support not available. have question open on matter here . it occured me io_service::post() might used synchronise 2 io_service objects. have attached diagram below, want know if understand post mechanism correctly, , weather sensible implementation. i assume use " a single io_service , thread pool calling io_service::run() " also assume frond-end single-threaded avoid race condition writing multiple threads same socket. the same goal can achieved using io_service::strand ( tutorial ).your front-end can mt synchronized io_service::strand . posts back

regex - Remove BBCode tags and their content in PHP -

possible duplicates: recursive bbcode parsing strip bbcode via regex what best way remove bbcode tags of string , content in php? <?php function stripbbcode($text_to_search) { $pattern = '|[[\/\!]*?[^\[\]]*?]|si'; $replace = ''; return preg_replace($pattern, $replace, $text_to_search); } echo stripbbcode($text_to_search); ?> demo

sql - xls to mysql with foreign keys -

Image
i've xls file type: group_name | name my_groupe1 | name1 my_groupe4 | name2 my_groupe2 | name3 my_groupe1 | name4 and database: users id | id_group | name and groups id | name i export xls data in database. must replace "group_name" id of real record in database. all group record exist in database. i've think make webservice prefer export directly. thx my recommendation create dynamic sql insert statements in excel based on data. below gave formula d2 , e2. d2: ="insert group (id,name) values ( ,'" & b2 & "')" becomes: insert group (id,name) values ( ,'my_group1') e2: ="insert user (id,name,group) values ( ,'" & b2 & "'," & a2 & ")" becomes: insert user (id,name,group) values ( ,'my_group1',1)

mysql - A datetime equivalent in java.sql ? (is there a java.sql.datetime ?) -

so far, have not found clear answer this. i'd know equivalent sql type datetime , java type, using preparedstatement. i have found: http://www.java2s.com/code/java/database-sql-jdbc/standardsqldatatypeswiththeirjavaequivalents.htm but states sql type "datetime" same sql.date, when looking @ sql date docs ( http://download.oracle.com/javase/7/docs/api/java/sql/date.html ), says time truncated (all zeros). what want able specify preparedstatement.setdatetime() or sort. the other way see using timestamp, require me change column type, while cannot imagine else never had problem before? any hints? edit: using mysql. the java.sql package has 3 date/time types: java.sql.date - date (no time part) java.sql.time - time (no date part) java.sql.timestamp - both date , time you want last one: java.sql.timestamp . if using these types, don't need call specific setter; use: java.util.date date = new date(); object param = new java.sql.tim

Javascript scope and calling a function -

my code: for (var = 0; < mapinfos.length; i++) { var x = function () { dostuff(i); }; google.maps.event.addlisteneronce(mapinfos[i].map, 'tilesloaded', x); } the dostuff method alerts value of i. mapinfos has 2 entries, you'd expect alert 0 , 1, instead alerts 2 , 2. can appreciate vaguely why doing (although var should keep local scope of loop?) how can make work intended? edit — note when first posted, original question included link jsfiddle seemed relevant example of current question trying achieve, appears work ... the code in jsfiddle works because there's 1 "i" in code. "i" used in second loop (where functions called) same "i" used in first loop. thus, right answer because second loop running "i" through values 0 through 4 again . if added: i = 100; functions[0](); you'd 100 printed out. the way introduce new scope in javascript function. 1 approach write separat

c# - Consume WCF .svc WebService in Java -

i new webservices. have created .net webservice (wcf service .svc). i able consume service .net client application. here have added service via (add service reference) in .net client. now want consume .net service java desktop application. how add service reference? how consume service in java? you can use wsdl2java , pass wsdl file , automatically generate whole client can communicate webservice. if using eclipse can use plugin: wsdl2java eclipse plugin

Convert String to latlng google maps -

i want convert string pattern "(53.324523, 43.252352)" latlng. found right function: var input = latlngarray[i]; var latlngstr = input.split(",",2); var lat = parsefloat(latlngstr[0]); var lng = parsefloat(latlngstr[1]); latlngarray[i] = new google.maps.latlng(lat, lng); the problem can't proper lat. when use alert display it says nan, while lng variable displays right value. got it. thx help. var input = latlngarray[i].substring(1, latlngarray[i].length-1); var latlngstr = input.split(",",2); var lat = parsefloat(latlngstr[0]); var lng = parsefloat(latlngstr[1]); latlngarray[i] = new google.maps.latlng(lat, lng); quick fix after var input. looks '(' messing lat conversion: input = input.replace('(','');

ruby on rails 3 - Problem saving data using Nested Attributes -

i'm i'm building website on ruby on rails 3.0.7 , want save store object , languages . so, have following models: class store < activerecord::base belongs_to :user has_many :languages, :through => :store_languages has_many :store_languages accepts_nested_attributes_for :store_languages #validations validates :title, :presence => true, :length => 5..100 validates :contact_email, :presence => true, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } end class language < activerecord::base has_many :stores, :through => :store_languages has_many :store_languages end class storelanguage < activerecord::base belongs_to :store belongs_to :language validates :store_id, :presence => true validates :language_id, :presence => true end storescontroller's relevant actions: def new @store = store.new @store.store_languages.build respond_to |format| format.html # new.html.e

Explain the below Linq Query? -

results.where(x=>x.members.any(y=>members.contains(y.name.tolower()) i happened see query in internet. can explain query please. suggest me linq tutorial newbie. thank all. edited: what x , y stands for? x single result, of type of elements in results sequence. y single member, of type of elements in x.members sequence. these lambda expressions ( x => x.whatever ) introduced language c# 3, x input, , right side ( x.whatever ) output (in particular usage scenario). an easier example var list = new list<int> { 1, 2, 3 }; var oddnumbers = list.where(i => % 2 != 0); here, i single int item input expression. i % 2 != 0 boolean expression evaluating whether input or odd. entire expression ( i => % 2 != 0 ) predicate, func<int, bool> , input integer , output boolean. follow? iterate on query oddnumbers , each element in list sequence evaluated against predicate. pass become part of output. foreach (var item in oddnumbers

java - when will finalize() be called on my class instance in this scenario? -

i know finalize() called whenever class instance collected garbage collector. however, little bit confused when passing instance of class thread via queue. let's skeleton of thread1: for(i=0; i<1000; i++) { packet pkt = new packet(); // instance of class pkt.id = i; thread2.queue.put(pkt); } then, thread 2 remove packet queue , perform lengthy operations. second thread "copy" of packet, or form of reference? importance that, if copy, finalize() on instance created in thread 1 can called before thread 2 done packet. if reference, guaranteed finalize() called once information in packet. this basic example may not show importance, storing c-pointer (from jni) in packet destroy memory when done object. if passed copy, memory may destroyed before second thread done it. if passed reference, should destroyed once gc sees no longer in use both threads (my desired behavior). if latter scenario not guaranteed, not use finalize() , use else more compl

wmi - VBScript to uninstall a Windows 7 application -

i attempting write script uninstall program when run. problem program not have exact same name each time, have version number attached. there anyway grab program name list, assuming contains i'm looking for? use name finish uninstall? the uninstall function i've found is: strcomputer = "." set objwmiservice = getobject("winmgmts:" _ & "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2") set colsoftware = objwmiservice.execquery _ ("select * win32_product name = 'personnel database'") each objsoftware in colsoftware objsoftware.uninstall() next you can use like operator instead of = in query test product name against pattern, this: set colsoftware = objwmiservice.execquery _ ("select * win32_product name '%personnel database%'")

asp.net - How can I test a User Control without adding to an ASPX file? -

currently if want test user control, add custom tags existing .aspx page (or create new 1 if have to), , view page in browser. is there quicker, better way test user controls i'm not aware of? you cannot run user control page. create simple test form testing it...

IntelliJ IDEA updating classes takes too much time -

i idea, when work webapp running on tomcat , modify single java class file, have update classes , resources , takes more time in eclipse. in eclipse it's instant, @ least don't notice anything, in idea make , updates caches , don't know else it's annoying. why , how can solve this? update depend on project , configuration in idea. should not take long required steps performed. compilation incremental , instant. in order understand why takes long project, we'll need sample project , exact steps reproduce it, please file issue our issue tracker . if want fast updates, may consider using jrebel , has plug-in idea .

xml - How can I put result of a calculation with xsl in a new element -

i use xsl calculate cumulative total per element "basisproduct". output has put in same xml, after "totals" in new elements, this: <totals> <totalproduct> <basisproduct>110</basisproduct> <cumul_amount>1,52</custinvoice_lineamount> </totalproduct> <totalproduct> <basisproduct>198</basisproduct> <cumul_amount>294,77</custinvoice_lineamount> </totalproduct> <totalproduct> <basisproduct>992</basisproduct> <cumul_amount>163,32</custinvoice_lineamount> </totalproduct> <totalproduct> <basisproduct>993</basisproduct> <cumul_amount>193,78</custinvoice_lineamount> </totalproduct> <totals> <-----i have xml input.------> <?xml version="1.0" encoding="utf-8"?> <report name="salesinvoice"> <reportname>salesinvoice<