Posts

Showing posts from January, 2013

Python GUI html+css package -

i want create python gui application. want use html+css drawing controls (buttons, comboboxes , other) because have source code them. want have executable file (generated pyinstaller or other 'py exe' packages). don't want use packages represent webserver because going use application on winpe has many of limitations , problems. what package can use it? there may better way this, there multiple gui packages in python have web browser objects (or can used make them). here's example pyside: https://deptinfo-ensip.univ-poitiers.fr/ens/pyside-docs/pyside/qtwebkit/ you can search examples on tkinter (pythons standard gui package), pyqt similar pyside. pygtk has possibilities. you can use these packages build primitive (or not if put lot of time it) browser pipe templates based on user input.

java - SocketInitiator getSession give session not at the same order as in the config file -

when try sessionconfig index exist in file contains sessionconfig (in our case "initiatorsettings.cfg") [default] filestorepath=data filelogpath=log heartbtint=30 reconnectinterval=5 [session] sessionname=badisinit1 beginstring=fix.4.2 sendercompid=client1 targetcompid=server1 connectiontype=initiator socketconnectport=9878 socketconnecthost=localhost usedatadictionary=n [session] sessionname=init0badis beginstring=fix.4.2 sendercompid=client1 targetcompid=server12 connectiontype=initiator socketconnectport=9878 socketconnecthost=localhost usedatadictionary=n [session] sessionname=test211 beginstring=fix.4.2 sendercompid=badis targetcompid=server connectiontype=initiator socketconnectport=9878 socketconnecthost=localhost usedatadictionary=n i sessions in different orders, in first 2 sessionids: session id fix.4.2:client1->server12 session id fix.4.2:client1->server1 session id fix.4.2:badis->server there code have used load sessions , print them

php - How can I retain selected images in form if submitted form invalid? -

i try attach few images symfony form. if submitted form invalid, entered text persist, images lose. how can retain selected images if submitted form invalid? p.s. need use form submitting without ajax , images should locating text fields in same form.

Android Exception: UnknownFormatConversionException -

hi setting text inside robototext positioned inside of viewholder calling this: viewholder.txtsimilarads.settext((((property) ads.get(position)).getsimilar_items_count() == 1 ? context.getstring(r.string.ad_data_similar) : context.getstring(r.string.ad_data_similar_plural, ads.get(position).getimagescount()))); however (sometimes not always)for reason keep getting error exception unknownformatconversionexception , points line inside of class. problem? doing wrong? check string in r.string.ad_data_similar_plural contains valid placeholder integer. should "here number: %d" . string format specification as aside, one-liner these harder understand, , make debugging more difficult. more readable approach have given erroneous line more easily: string similaradstext; property adsproperty = ads.get(position); if (adsproperty.getsimilar_items_count() == 1) { similaradstext = context.getstring(r.string.ad_data_similar); } else { similaradstext = con

c# - Is there a way to stay in a coroutine until a condition is met? -

i trying program simple dialogue system. when player gets dialogue box, box remains until press key. second dialogue box appears. again, press key, , on. i realizing, however, method of using coroutines doesn't work, because every dialogue box displays @ once. using simplified version: ienumerator test() { //code displays message yield return startcoroutine(waitforkey(keycode.space)); } ienumerator waitforkey(keycode keycode) { while (!input.getkeydown(keycode)) yield return null; } void start(){ startcoroutine(test()); startcoroutine(test()); } the results of above code 2 messages displayed. plus, display immediately--once condition met, process jumps courtine initiating, runs next line of code, , periodically returns first coroutine see if has finished. how 1 coroutine finish before continues rest of code following it? the easy way go creates arrays of canvas dialog. disable of t

csv - Excel 2013: Automatic data update from external URL -

i have webservice continuously generate/update csv file can downloaded externally. use excel file continuously content of csv file, , calculation , visualization accordingly. e.g. csv file contains 4 rows, 3 columns. in excel sheet, a1:c4 used store contents of csv file. a5:c5 average of each column. , bar chart of contents in each column displayed in a5. how can ask excel download csv file specifying url, , store in a1:c4? , how make automatically update contents when csv file updated?

javascript - Why am I not able to use this script in dreamweaver -

i'm not able use code in php.. i'm using dreamweaver { <script language = "javascript"> var counter = 0; // call update function in 2 seconds after first load id = window . settimeout("update();", 2000); function update() { counter++; window.status = "the counter @ " + counter; document.form1.input1.value = "the counter @ " + counter; // set timeout next count id = window . settimeout("update();", 2000); } </script> } you not outputting script: page needs have html content in execute javascript (by browser). echo script , go there. <?php { echo'<script language = "javascript"> var counter = 0; // call update function in 2 seconds after first load id = window . settimeout("update();", 2000); function update() { counter++; window.status = "the counter @ " + counter; document.form1.input1.value = "the counter

c++ - opencv: Mat constructor from rect -

i attempting generate subimage opencv matrix data structure follows: cv::rect sub_image = cv::rect(10, 10, 200, 200); cv::mat submat = original_image(sub_image); my question if have low level memcpy operations , use submat.data source, pointing correct subimage? guess not documentation seems allude points same dataset. if so, how can use construct cv::mat submat = original_image(sub_image); to copy data well? use cv::mat submat = original_image(sub_image).clone(); this deep-copy data of original_image new (probably continuous) matrix. you use original_image(sub_image).copyto(submat); reach same, .clone() leads shorter code.

html - Rendering in Dreamweaver different than live site -

i responsible site needs work in ie 9 current browsers. site http://www.wtc.army.mil/ have made changes current live site , need push them live, when render inside dw in ie 9, few minor elements on page not render though haven't changed these sections of code (these elements being: social media icons @ top right of page not display, glyphicons (i think that's they're called) next of links @ bottom won't display, , 1 other image next paragraph on right side of page). i have compared new code current live site , there no differences within code besides minor changes should not affect failed elements mentioned. changes have made should in no way affect these elements not displaying properly. dw rendering page differently how show when push live, , these elements aren't rendering correctly in dw fine when push them live? thing note new code works perfect in other browsers. ie causing issue. main question is: possible dw render code in ie differently how appears

Excel VBA - Loop to insert formulas -

i've come across worksheet full of formulas mistakes. project repetitive decided write simple vba code in order save me time. the problem code did not work. thought indeed simple problem has been pain in neck. i've cut out repetting pieces of code make easier understand. sub corrigirerro() dim r, integer r = 17 28 = r - 16 worksheets(r).select range("d73").clearcontents range("d73").formula = "=seerro(somarproduto('rd - " & & "'!d266:d268;'rd - " & & "'!e266:e268)/soma('rd - " & & "'!d266:d268);0)" your formula using semi-colon system has set list separator in regional settings. vba sets range .formula property comma regardless of regional settings have range .formulalocal property use regional settings. range("d73").formula = "=seerro(somarproduto('rd - " & & &

html - List isn't centering and wraps when the page exceeds 1 page of content -

here's code : ul { width: 100%; position: relative; left:10%; margin: 0; padding-left: 100px; } li { float:left; box-align:right; } li { display: block; width: 265px; background-color: #800000; color: #fff; text-align: center; font-weight: bold; text-transform: uppercase; padding: 5px; border-right: 1px solid; border-left: 1px solid; } #list { background-color: #800000; padding: 0.02px 0; margin-bottom: 10px; overflow: hidden; width:70%; text-align:center; clear:left; } <ul> <center> <li><a href="homepage.html">introduction</a></li> <li><a href="biography.html">biography</a></li> <li><a href="songs.html">brand new</a></li> <li><a href="pictures.html">pictures</a></li> </center> </ul> so i

html - Bootstrap columns not working when writing in php while loop -

Image
i using bootstrap in website when adding php loop show products products shown @ end of page instead of showing in area 'product show here'. <div class="col-sm-9 padding-right"> <div class="features_items"> <h2 class="title text-center">features items</h2> <?php function fetch($table){ $result = mysqli_query($conn,"select id ,name menshirt"); while($row = mysqli_fetch_assoc($result)) { echo '<div class="col-sm-4"> <h2>$56</h2> p> '.$name =$row['name'].'</p> <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-cart"> </i>add cart</a> </div> </div>'; } mysqli_close($conn);} ?> </div></div> you creates function fetch isn't called. , inside open less div s closed. <div class="col-sm-9 padding-right"> <div class="

javascript - jqplot highlighter tooltip text overlaps -

Image
i've given highlighter set width of 200px , text within overlaps , can't figure out how stop happening. see attached. add css parent class white-space: normal;

java - Spring / Tomcat - Error in DataSource (NameNotFoundException) -

i trying connect spring mvc 4 application sql local bbdd. this files: spring mvcconfiguration file: @bean public datasource datasource() throws exception { context cts = new initialcontext(); datasource dts = (datasource) cts.lookup("java:/comp/env/jdbc/etielabbdd"); return dts; } tomcat context.xml: <resourcelink name="jdbc/etielabbdd" global="jdbc/bbdd" auth="container" type="javax.sql.datasource" /> tomcat server xml: <resource name="jdbc/bbdd" global="jdbc/bbdd" auth="container" type="javax.sql.datasource" username="xxxxxx" password="xxxxxx" driverclassname="com.mysql.jdbc.driver" url="jdbc:mysql://localhost:3306/confluenceuseunicode=true&amp;characterencoding=utf8" maxactive="15" maxidle="7" defaulttransactionisolatio

mysql - Sphinxql - How to use query having order by while using Sphinxql in PHP without using sphinxapi.php -

i have been using mysql fts , switched sphinx testing purpose. installed sphinx on centos 7 linux production 3.10.0-123.8.1.el7.x86_64 #1 gnu/linux sphinx.conf source content_src1 { type = mysql sql_host = localhost sql_user = sql_pass = sql_db = t_prod2 sql_port = 3306 # optional, default 3306 sql_query = \ select content.record_num, \ content.title, \ content.category, \ content.upload_date, \ content.comments_count, \ content.verified, \ content.uploader, \ content.size \ content enabled = 1 sql_attr_uint = record_num sql_attr_string = title } index content_index1 { source = content_src1 path = /var/lib/sphinx/content_index1 morphology = stem_en min_word_

html - How to use dowloaded Google Fonts in my app offline? -

this question has answer here: downloading google font , setting offline site uses it 8 answers i have downloaded couple of fonts in folder of app in www/css folder: /oxygen this folder consist of: oxygen-bold.ttf oxygen-light.ttf in traditional way, include link following in index.html have access these font styles, e.g. <link href='http://fonts.googleapis.com/css?family=source+sans+pro:700|oxygen:400,700' rel='stylesheet' type='text/css'> however, since want fonts available offline , wondering steps need undertake able use these fonts well? be careful, css generated google fonts depends on requesting user agent every browser uses different font formats, ttf, eot, woff, woff2 , svg. there no way directly download font variants directly google, other faking user agent , inspecting generated css rules. you can use

How to integrate java API into ruby? -

i new integrating outside api programming languages have several questions ask: 1) can api online used in programming language or should maker specify programming language can used? 2) found api based on java language processing . prefer program on ruby can integrate ruby? 3) source code provided api, how can use advantage? (install?) 4) how can entegrate api language(is there common way or should specific way provided developer) ? i have more questions based on answers get. want understand more topic. thank you if want interface api written in java, have write java yourself. there version of ruby runs in java called jruby ( http://jruby.org/ ) allows use java classes within ruby. it looks tool linked can run command line. can run commands within ruby enclosing them in backticks, example `bin/mallet import-dir --input /data/topic-input --output topic-input.mallet` hope helps

c# - Linq query not returning values -

i have 2 dbcontexts, not sure if makes difference. applicationdbcontext , companydbcontext. tables have been setup within database , have added data within companydetails table. i have couple problems code, not sure have done within view regarding companyid correct, question not sure why linq query not return results when have data in table. my companydbcontext goes is public class companydbcontext : dbcontext { public dbset<companydetails> companies { get; set; } } and here model public class companydetails { [key, databasegenerated(databasegeneratedoption.identity)] public int? companyid { get; set; } [display(name = "company name")] public string companyname { get; set; } } i have written linq query should have got 1 row put the database. linq query construct list of selectlistitems pass viewbag, , want able have dropdown box company name in, in user selects. public actionresult register() { //var regviewmodel =

ios - Opening ViewController programmatically -

i have viewcontroller inside same story board want switch clicking button. problem when try control-drag second view controller create outlet inside viewcontroller.m file of primary viewcontroller, outlet isn't created. in android can open new activity different ui inside of activity . sure same can achieved in ios well, question how can create outlet of second view controller , open programmatically ? it not possible in ios create iboutlet 1 viewcontroller viewcontroller , can use uistoryboardsegue purpose. i suggest follow tutorial: storyboards apple documentation. understand how viewcontrollers connected.

android - Is there a way to implement rounded corners to a Mapfragment? -

Image
i want give map nice looking rounded corners 2 boxes below have. can't map fragment self because there not background property fragment. setting map inside layout , setting background rounded shape didn't me , result: i merge map make smaller , avoid it. edit: @ryan new result #2: i guess not bad, no close corners on other boxes, still not bad little more work somewhere close dont have normal image editor. 1 thing still bothers me separation between "location" textview , map it's self. painted patch in other way there distance? how did it: well have figured out: this used patch: thanks. i haven't tried this, i'd put view rounded corners , transparent middle on top of mapview / mapfragment. that is, put mapfragment , rounded corner view in framelayout both filling framelayout, make middle of rounded corner view transparent. for further clarification, in layout follows:- <?xml version="1.0" encoding="

javascript - Getting length, id and name of "input" tags -

how length, id , name of input tags inside div having class name only? html: <div id="division1" class="clonedinput kudd"> <div class="set1"> <label for="eee">name</label> <input id="ee2" type="text" value="" name="ee2"> <input id="ee3" type="text" value="" name="ee3"> </div> jquery: $('.set1 > input').attr('id').length; $('.set1 > input').attr('id'); //no output you can use each : $('.set1 input').each(function() { var $this = $(this); // caching var id = $this.attr('id'); var name = $this.attr('name'); var length = $this.val().length; console.log('id: ' + id + ' name: ' + name + ' length: ' + length); }); a generic iterator function, can used seamlessl

c++ - InvalidateRect in Windows API, Charles Petzold checker4.c program -

full program here: http://examples.oreilly.com/9781572319950/cd_contents/chap07/checker4/checker4.c the code in childwndproc confuses me: case wm_lbuttondown : setwindowlong (hwnd, 0, 1 ^ getwindowlong (hwnd, 0)) ; setfocus (hwnd) ; invalidaterect (hwnd, null, false) ; return 0 ; // focus messages, invalidate window repaint case wm_setfocus: idfocus = getwindowlong (hwnd, gwl_id) ; // fall through case wm_killfocus: invalidaterect (hwnd, null, true) ; return 0 ; why in childwndproc in case of message wm_lbuttondown : the last statement before return 0 invalidaterect , since right before program sends wm_setfocus message setfocus function, falls through wm_killfocus , has invalidaterect , last argument true , instead of false . in understanding program should work without invalidaterect in wm_lbuttondown since calls setfocus , makes invalidate window, when comment out invalidaterect wm_lbuttond

java - Add Object to JPanel after button click -

Image
i have created jscrollpane jpanel inside , want add jpanel/jlabel/other objects after pressing button. example after 3 button presses want this: i tried myjpane.add(testlabel) testlabel.setbounds() but no result, don't want use gridlayout because of unchangeable sizes. if added objects had different sizes - adjusted text content. what should use , how? thanks in advance. best regards, tom. here jpanel inside jscrollpane adds jlabel s when pressing button: public class example extends jframe { public example() { jpanel boxpanel = new jpanel(); boxpanel.setlayout(new boxlayout(boxpanel, boxlayout.page_axis)); jtextfield textfield = new jtextfield(20); jbutton sendbutton = new jbutton("send"); sendbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { jlabel label = new jlabel(textfield.gettext());

c# - WillCascadeOnDelete without base entity knowing of foreign entity -

i have entity in core application: public class contact : baseentity { //some properties } i have entity in plugin (not part of main dll) so: public class additionalcontactdata { public string somepropertythatisntonthemaincontact { get; set; } public contact contact { get; set;} } after binding models etc via ef, creates tables foreign keys expect. issue have want able delete contact entity , cascade down remove additionalcontactdata . wouldn't issue if contact know additionalcontactdata i.e: hasrequired(m => m.contact) .withoptional(m => m.additionalcontactdata) .willcascadeondelete(); this work (and i'd in normal circumstances) how can achieve same thing without contact knowing additionalcontactdata . possible? i'm hoping i've been clear enough please let me know if more information required. assuming, code additionalcontactdata configuration, remove optional property expression withoptional : hasrequired

java - Difference between Eclipse Build Project and Maven Compile command -

is eclipse " build project " command same maven command " mvn compile "? both same thing? if yes , why need "build project" in sts after running "mvn clean install" in order run application without issues? running "mvn clean install" should have compiled project. shouldn't refreshing project in sts enough run it? if no , eclipse build different because java compiler implements java language specification build classes? following apache maven link says default compiler javax.tools.javacompiler (by way using java 1.6). the short answer no , maven build , eclipse build not same. basically, eclipse has own way of building things, has little maven. @ basic level, eclipse java compilation, using own java compiler (part of eclipse jdt). a precise answer how differ hard give, situation quite complex, , depends precisely on stuff (eclipse plugins) have installed. to close possible approximation eclipse does, resembl

javascript - XML3D css transformations vs custom transform property -

which one: css transform property or custom xml3d <transform> element i'm supposed use when using library? providing 2 mechanisms same thing kinda unclear me. see transformations based on transform element flawed somehow because need define them unique id in order use, therefore clutter document namespace. are css property based transform attempt fix it? 1 should use in long run? agreed there 2 mechanisms same thing. on long run, support css transform. however, still able reference dataflow graphs, i.e. <data> elements provide transform entry in order able generate dynamic transformations. <transform> element become obsolete in 5.0.

c# - Need to get element id from .net COM winform control -

i have created .net usercontrol , exposed com control. can used in html web page object tag html object tag looks like <object id=control01 class=mycontrol classid=clsid:c2a76664-69fa-45c8-b052-7322b14cb206></object> and .net control code below [classinterface(classinterfacetype.autodual), comvisible(true), guid("c2a76664-69fa-45c8-b052-7322b14cb206"), progid("mycontrol")] public partial class mycontrol : usercontrol { private void mycontrol_load(object sender, eventargs e) { //need object id here "id=control01" } } when load control in html page , called in browser. should element id in control class either in load event or constructor please me on how html element id in .net control class.

javascript - remove the inherited CSS value? -

i'm trying remove value of inherited css property using jquery. .class1 #id1 div.class2 input.class-input{ border-color: #bbb3b9 #c7c1c6 #c7c1c6; } anyone tell me how remove "border-color". thank. create new class example .new_class{ border-color: #00ffdd !important; } !important trick! check this

Excel/VBA: Can't open workbook -

function getproductstatus(adr range) string dim networklocation string, networkpath string, filereference string, srcsheetref string, c_formula string dim sheet_src worksheet, sheet worksheet, wb_src workbook, wb workbook dim sheetname_src string, sheetname string networklocation = activeworkbook.path networkpath = networklocation & "\locations\" sheetname_src = "sheet1" sheetname = "sheet1" set wb_src = thisworkbook set sheet_src = wb_src.sheets(sheetname_src) filereference = networkpath & region_eval & "\productlist.xlsx" workbooks.open filename:=filereference, readonly:=true set wb = workbooks("productlist.xlsx") set sheet = wb.sheets(sheetname) c_formula = application.worksheetfunction.index(sheet.range("$k$2:$k$5000"), application.worksheetfunction.match(sheet_src.range("a" & adr.row), sheet.range("$a$2:$a$5000"), 0)) getproductstatus = c_formula wb.close end function the

cocoapods - How to specify output dir name for ios simulator when using xcodebuild cli in combination with a xcworkspace? -

i build xcode (6.3.1) project uses workspace because i'm using pods. when do: xcodebuild \ build \ -workspace myproject.xcworkspace \ -scheme myproject \ -configuration debug \ -sdk iphonesimulator \ -archs=i386 \ valid_archs=i386 \ symroot="/tmp/build/emulator" \ shared_precomps_dir="/tmp/build/sharedpch" it outputs app to: /tmp/build/emulator/debug-iphonesimulator/myproject.app is there way xcodebuild command build to /tmp/build/emulator/myproject.app i have tried replace symroot with configuration_build_dir="/tmp/build/emulator" now builds to /tmp/build/emulator/monsenso.app but not work smoothly cocoapods frameworks (e.g. typhoon di) ~ build fails with: the following build commands failed: generatedsymfile /tmp/build/emulator/typhoon.framework.dsym /run/emulator/typhoon.framework/typhoon

mysql order by greatest then second greatest -

i've got table of scores: user / score 1 / score 2 / score 3 person 1: 10 21 7 person 2: 21 4 20 person 3: 1 5 22 i'm trying sort them highest individual score , second highest individual score. the first part can do. i know how order greatest(score1, score2, score3) desc but i'm not sure how set secondary ordering second greatest if it's tie it's decided players second highest score. so ideally results be: user / score 1 / score 2 / score 3 person 3: 1 5 22 person 2: 21 4 20 person 1: 10 21 7 does have ideas? try this. select name, score1, score2, score3 score order greatest(score1, score2, score3) desc, (score1+ score2+ score3) - greatest(score1, score2, score3) - least(score1, score2, score3) desc, least(score1, score2, score3) desc;

Changing the remote url of a repository in libgit2sharp -

how can change remote url of repository? using (var repository = new repository(repositorypath)) { //change remote url first //then checkout } how can change remote url of repository? var newurl = "https://github.com/owner/my_repository.git";"; remote remote = repo.network.remotes[name]; // update remote configuration, persist // , return new instance of updated remote remote updatedremote = repo.network.remotes.update(remote, r => r.url = newurl); for it's worth, of remote properties can updated following same pattern. feel free take peek @ remotefixture.cs test suite more detailed examples.

Array in C# with data of XML -

i xml , want value of role make array in c#, , remove same value make one.xml goes here: <phrase role="2"></phrase> <phrase role="2"></phrase> <phrase role="1"></phrase> <phrase role="1"></phrase> <phrase role="2"></phrase> <phrase role="1"></phrase> <phrase role="2"></phrase> here start up, role, when add them in array doesn't show value of role, system.int32[]. load xml , transform class code goes here: xmldocument doc = new xmldocument(); doc.loadxml("<phrase role="2"></phrase> <phrase role="2"></phrase> <phrase role="1"></phrase> <phrase role="1"></phrase> <phrase role="2"></phrase> <phrase role="1"></phrase>

sql - what is the difference in writing styles of these 2 queries? -

i using ms sql server 2012: the 2 queries are: 1: with cte ( <some code> ) delete p table p join cte on p.id=cte.id , p.date>cte.date 2: with cte ( <some code> ) delete p table p join cte on cte.id=p.id , cte.date>p.date the difference in 2 queries writing join condition of either of table columns first. how should decide efficient or correct? the equality = operator symetric. flipping order of operands doesn't have functional or performance impact. the greater ( > ) operator, on other hand, is, of course, not symertic. p.date>cte.date , cte.date>p.date functionally different, , should choose correct 1 according business logic, regardless of performance. no matter how fast delete statement runs, if it's deleting wrong thing, it's pretty useless (not mention down right harmful).

gruntjs - Parameters binding in grunt tasks -

i have problem grunt tasks: watch: { jshint: { files: ['gruntfile.js', '<%= version %>/src/**/*.js', '<%= version %>/src/*.js'], tasks: ['jshint', 'concat', 'uglify'], options: { livereload: true } } }, i call in function grunt.registertask('server', 'a task runs server', function(version) { if (arguments.length === 0) { grunt.log.writeln("please specify version in arguments (grunt "+this.name+":version)"); } else { grunt.log.writeln(this.name + ", " + version ); grunt.config.set('version', version); grunt.task.run(['jshint', 'concat', 'uglify', 'open', 'connect', 'watch']); } }); the problem watch task can see version tasks in watch don't bind version - here tasks: ['jshint', 'concat', 'ug

javascript - Getting the object obtained from asynchronous $http service in angularJS to be accessible globally in $scope -

i working using angular js. trying json object obtained using $http service accessible in $scope variable. inside asynchronous ajax ($http.get()) calls, if try print data obtained stored inside $scope variable , print it, works , shows me expected data. outside scope of asynchronous method, same $scope variable assigned data obtained loses hold of , prints undefined. code: var app = angular.module('chariot', ['ngroute', 'ngfileupload']); app.factory('gettestcasefactory', ['$http', '$routeparams', '$q', function($http, $routeparams, $q) { return { list: function(){ var deferred = $q.defer(); $http.get('/testcase/' + $routeparams.testcase) .success(function(data, status, headers, config) { deferred.resolve(data); }) .error(function(data, status, headers, config) { deferred.r

c++ - Can a local variable's memory be accessed outside its scope? -

i have following code. int * foo() { int = 5; return &a; } int main() { int* p = foo(); cout << *p; *p = 8; cout << *p; } and code running no runtime exceptions! the output 58 how can be? isn't memory of local variable inaccessible outside function? how can be? isn't memory of local variable inaccessible outside function? you rent hotel room. put book in top drawer of bedside table , go sleep. check out next morning, "forget" give key. steal key! a week later, return hotel, not check in, sneak old room stolen key, , in drawer. book still there. astonishing! how can be? aren't contents of hotel room drawer inaccessible if haven't rented room? well, scenario can happen in real world no problem. there no mysterious force causes book disappear when no longer authorized in room. nor there mysterious force prevents entering room stolen key. the hotel management not required remove book. di

Swift: How to convert a String to UInt8 array? -

how convert string uint8 array? var str = "test" var ar : [uint8] ar = str lots of different ways, depending on how want handle non-ascii characters. but simplest code use utf8 view: let string = "hello" let array: [uint8] = array(string.utf8) note, result in multi-byte characters being represented multiple entries in array, i.e.: let string = "é" print(array(string.utf8)) prints out [195, 169] there’s .nulterminatedutf8 , same thing, adds nul-character end if plan pass somewhere c string (though if you’re doing that, can use .withcstring or use implicit conversion bridged c functions.

mongodb - How can I provide multiple criteria for an attribute within an element of array in mongo query? -

i have collection following documents: { "_id": 1, "books": [ { "id":"sherlock holmes", "category":"novel" }, { "id":"10 tips cook", "category":"tips" } ] }, { "_id": 2, "books": [ { "id":"10 tips cook", "category":"tips" } ] }, { "_id": 3, "books": [ { "id":"sherlock holmes", "category":"novel" } ] } i want query document contains both books id "sherlock holmes" , "10 tips cook", "_id" 1. i've tried $in , $elemmatch results th

ios - How do I change the initial tab bar selection in swift? -

in trying find solution came across answer: [ https://stackoverflow.com/a/10441200/4856759 ] it seems accomplish want to, in objective c: uitabbarcontroller *tabbar = (uitabbarcontroller *)self.window.rootviewcontroller; tabbar.selectedindex = 0; how do in swift? first attempt returns error: cannot convert expression's type '$t4??' type 'uitabbarcontroller' var tabbar: uitabbarcontroller = self.window?.rootviewcontroller tabbar.selectedindex = 1 worked me! need add as! uitabbarcontroller : var tabbar: uitabbarcontroller = self.window?.rootviewcontroller as! uitabbarcontroller tabbar.selectedindex = 1

git flow - Git: Merge feature branch into two long-running branches or merge between long-running branches themselves? -

we have 2 long-running branches, 1.x , 2.x . 1.x deployed version release bugfixes, 2.x in works. when bug report comes in, need apply 1.x first 2.x. use flow uses feature branches bug fix typically developed there. when it's done, need both 1.x , 2.x. there 2 main options: merge feature branch both 1.x , 2.x merge feature branch in 1.x , then, eventually, merge 1.x 2.x is 1 preferred on other reasons or matter of personal preference? thanks. if bugfix-branch related bug, introduced in branch 1.x, should applied 1.x. applying 2.x may introduce hidden bug. if bugfix-branch related bug of 1.x's , 2.x's common ancestor, apply both. recommend run possible tests on 2.x after merge. (not checking fixed feature, others.) why apply 2.x immediately? there small chance of bug interference, when there's bug in 2.x doesn't reveal due previous bug. earlier find - better.

javascript - Hide form action url in post method -

have code below , want insert in new script <?php session_start(); $host = "localhost"; $username = "#"; $password = "#"; $dbname = "#"; $ip = getenv("remote_addr") ; $time = time(); $waktu = date("g:i:s",time()); //database connect mysql_connect($host,$username,$password) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); mysql_query("set names utf8"); mysql_query("create table if not exists `cookies` ( `ip` varchar(32) not null default '', `time` varchar(32) default null, `waktu` varchar(255) default null, primary key (`ip`) engine=myisam default charset=utf8; ) "); function get_html($url) { $ch = curl_init(); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_failo

Javascript/JQuery for animated scrolling from another page -

i've got animated scrolling here . works same page, when in index.html: <ul id="nav"> <li><a href="#section1">natural beauty</a></li> <li><a href="#section2">beginings</a></li> <li><a href="#section3">earth's purity</a></li> <li><a href="#section4">bottling goodness</a></li> <li><a href="#section5">drink health</a></li> <li><a href="#section6">minerals</a></li> <li><a href="contact.html">contact us</a></li> </ul> here's js i've used refference above: $(document).ready(function(){ $('a[href*=#]').each(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname &&

html - Bootstrap Input Group Horizontal Align Issue -

Image
i'm trying create input field button addon appended, i've copied code bootstrap documentation input field , button seem have opposite horizontal alignments. i've had @ applied styles in chrome developer tools cab't figure out what's going on. here code snippet: <div class="panel-heading">checkins on @viewbag.qrydate</div> <div class="panel-body"> <div class="form-group"> <div class="input-group"> <div class="input-group-addon">date:</div> <input type="date" class="form-control" id="exampleinputamount" placeholder="@viewbag.qrydate"> <span class="input-group-btn"> <button class="btn btn-default" type="button">go!</button> </span> </div> </div> </div> the image belo

mongodb - How to count incomming links? -

i have documents looking this: { "url" : "http://example.com", "links" : [ "http://example.com/foo", "http://example.com/bar" ] }, { "url" : "http://example.com/foo", "links" : [ "http://example.com/bar" ] }, { "url" : "http://example.com/lost", "links" : [ "http://example.com/bar" ] }, { "url" : "http://example.com/bar", "links" : [] } how aggregate url , count number of incoming links: { "url": http://example.com, "count" : 0 }, { "url": http://example.com/lost, "count" : 0 }, { "url": http://example.com/foo, "count" : 1 }, { "url": http://example.com/bar, "count" : 3 } do have idea how can it? this 1 tricky want count i

javascript - Printing into a pop-up, instead on main window -

i have function shows articles titles 'articles' database. function show() { database(); $sql = "select title `articles`"; $titlesql = mysql_query( $sql ) or die("could not select articles:"); $html = '<html><body><div class="container"><h2>basic list group</h2><ul class="list-group">'; while ($title = mysql_fetch_array($titlesql)) { $html .= '<li class="list-group-item">'.$title["title"].'</li>'; } $html .= '</ul></div></body></html>'; echo $html; // die("functie terminata cu succes! :)"); // die(json_encode(array("mesaj" => "entered data "))); } this function in javascript. function show() { var n = $('#show').val() $.post("functions.php", {show:n}).done(function(mesaj){ al

Not able Scan using redis template -

i trying use scan http://redis.io/commands/scan iterate on keys present in redis. redis template provided spring not have scan() method. there trick use above? thanks you can use rediscallback on redisoperations so. redistemplate.execute(new rediscallback<iterable<byte[]>>() { @override public iterable<byte[]> doinredis(redisconnection connection) throws dataaccessexception { list<byte[]> binarykeys = new arraylist<byte[]>(); cursor<byte[]> cursor = connection.scan(scanoptions.none); while (cursor.hasnext()) { binarykeys.add(cursor.next()); } try { cursor.close(); } catch (ioexception e) { // meaningful } return binarykeys; } });

How to send facebook message from linux console (command-line) -

old days many admins use sms-gates sending important informations systems e.g. "power down, ups working now!", "power up, ups off!" or "cpu temp high!". today in facebook era use messenger instead of sms, wonder if create command-line bash or php script such thing. the idea - cron checks every 10 minutes condition , if true, sends message messenger. the issues: i don't want use fb account sending - i'd message "system 1", "system 2", because have more 1 system admin. the bash part easy me, need tips facebook solutions: do have facebookappid (and have create appid each system or 1 appid) how "join/confirm/accept" "system 1" account facebook account is possible send messages more 1 fbaccount any other hints should for. i found notification app, think doesn't send message messenger, useless. the chat api removed v2.0 of graph api, there no way send messages api anymore. btw, mes

docker - 2015/05/15 07:30:34 exec: "go": executable file not found in $PATH -

i facing below issue tell me how fix this! command used: $ sudo docker run --rm -p -p 9090:9090 --name trial godock & $ docker run --rm -p -p 9090:9090 --name trial godock2015/05/18 03:35:25 exec: "go": executable file not found in $path # go version go version go1.2.1 linux/amd64 docker file : from ubuntu run apt-get -y update add server.go /src/server.go add . /src expose 9090 cmd ["go","run","/src/server.go"] server.go : package main import( "io" "net/http" "log" "fmt" ) func helloserver(w http.responsewriter, req * http.request) { io.writestring(w, "hello, world!\n") } func main() { fmt.println("starting server") http.handlefunc("/hello", helloserver) err: = http.listenandserve(":9090", nil) if err != nil { log.fatal("listenandserve: ", err) } } please me resolve issue.. install go in container you

c# - post data to aspx page and return json object -

i trying data values page without webmethod , , trying response json object. how can that? <script type="text/javascript"> function foo() { $.ajax({ type: "post", url: 'foo.aspx?calendaruc=update', data: "{ 'x': '5', 'y': '6'}", contenttype: "application/json; charset=utf-8", datatype: "json", beforesend: function () { }, success: function (data) { console.log(data); } }); } </script> <a href="#" onclick="foo()">click</a> protected void page_load(object sender, eventargs e) { if (request.params["calendaruc"] != null) { if (request.params["calendaruc"] == "update") {

vb.net - Unrecognised database format exception -

i have connect programs database. edit database in access , , after when running program, error notice unrecognised database format . then try make new database , connect vb.net failed again. don't know fault because didn't change in code. use provider microsoft.ace.oledb.12.0 , file extension in .accdb format. first possibility: database might have been corrupted. try compact , repair. second possibility: inadvertently database format changed, if case can "save as" lower version 2003 or 2010.

Android Studio Project Encoding Error -

every time when start new project, after gradle finishes shows warning me. warning:the project encoding (windows-1252) not match encoding specified in gradle build files (utf-8). can lead serious bugs. is know how overcome issue? when warning, click on open file encoding settings. change both ide encoding , project encoding utf-8 select box. can change default encoding @ bottom of settings menu.

oracle - Worklight 6.2 migration tool connection -

i working upgrade worklight 5.0.6.2 6.2 , doing database upgrade thing. i stuck when trying run migration tool following error shown "fwlse3401e failed connect source database" it's local dev oracle express 11g with service name: xe schema used: ccc the following command tried. java -classpath ojdbc6.jar -cp worklight-ant-deployer.jar com.ibm.worklight.config.dbmigration62.migrationtool \ -p /ccc \ -sourceurl jdbc:oracle:thin:@192.168.0.*:1521/xe \ -sourceschema ccc \ -sourcedriver oracle.jdbc.driver.oracledriver \ -sourceuser ccc \ -sourcepassword * \ -targeturl jdbc:oracle:thin:@192.168.0.*:1521/xe \ -targetschema ccc \ -targetdriver oracle.jdbc.driver.oracledriver \ -targetuser ccc \ -targetpassword * should use both -sourceschema , -sourceuser or misplaced/mis-imported jdbc driver? btw, after reading guide, https://www-01.ibm.com/support/knowledgecenter/sshscd_7.0.0/com.ibm.worklight.upgrade.doc/devenv/c_upgrade_to_srvr_ad

How to Identify Complexity of IBM ODM Rules Based Applications? -

i know, how complexity of rule based application can measured? is there standard way defined ibm ? or function point measure complexity of software based application complexity can based on parameters 1) parameters being passed / 2) number of rules present / 3) database ups / 4) network latency / 5)ruleset parsing time / 6) ruleset execution time / 7) application design / 8) execution unit configuration / 9) configure xom / 10) asynchronous ruleset parsing / 11) connection pool size / 12) res server configuration / 13) xu configuration / 14) reduce trace in server logs can please me understand standard way ibm recommend or decided application architect ? any , inputs appreciated... in advance. there no defined way of measuring 'complexity' of odm application. however, should make sure use correct topology needs (see deployment architecture odm documentation), , appropriate design decisions performance requirements (see odm documentation @ overview: af

reporting services - Column not Repeat on each page + SSRS -

Image
i make report using ssrs then want repeat left column on each page i set properties in tablix properties it's not work and tablix so how repeat whole left column on each page thank you. you should set checkmark in "repeat header rows on each page" instead of "repeat header columns on each page".

javascript - How to add IF ELSE condition for rules (for multiple forms) in Jquery validation -

i using jquery validation validate multiple forms same id. each form contains different fields , want add these fields validation rules jquery validate function. how can add these rules multiple forms (every form has same id)? example form1 <form id="new-form"> <input type="text" name="name" value=""/> <input type="text" name="email" value=""/> <input type="submit" name="submit" value="submit"/> </form> form 2 <form id="new-form"> <input type="text" name="mobile" value=""/> <input type="text" name="address" value=""/> <input type="submit" name="submit" value="submit"/> </form> javascript function $('#new-form').validate({ // want add rules here both forms }); i usin