Posts

Showing posts from March, 2010

String no print c++ -

i'm new in programming, have big code, when try print data never prints string variable, can help? use "goto" practicall reassons. #include <iostream> #include <string> #include <cstdlib> using namespace std; class producto { public: int id; string nombre; string descripcion; int precio; void registrar(); void ver(); }; void producto::registrar() { cout << "codigo:" << endl; cin >> id; cin.ignore(); cout << "nombre del producto:" << endl; getline(cin, nombre); cout << "descripcion del producto:" << endl; getline(cin, descripcion); cout << "precio:" << endl; cin >> precio; } void producto::ver() { cout << "id del producto:"; cout << id <<

php - Receiving 404 Error -

i have simple code: <?php if(isset($_post['test'])) { echo $_post['test']; } ?> <form action="testing.php" method="post"> <table> <tr><td>fill out:</td><td><input type="text" name="test" /></td></tr> <tr><td colspan="2" align="center"><input type="submit" /></td></tr> </table> </form> whenever put " http://www.google.com " , click "submit", error: image: i.stack.imgur.com/mcrrb.png if put "google.com" , click "submit", echo's result fine: image: i.stack.imgur.com/5wakc.png now, happens on 1 of hosting providers. if put script on hosting provider, works fine. i'm wondering if there can possibly fix problem. have tried changing file's permissions 777, still gets same error. could setting in "php.ini&

VS 2013 C# and Git: .csproj files don't merge upon pulling -

me , friend working on project written in c# using vs 2013 express git ( not vs git plugin, mind you), , we're running problem. our workflow setup this: have central repository, , each have our own fork of repository work on separately. when our individual work done push central repository. when want sync central repository, pull. the problem when pull, csproj files randomly update. update , files have been added since last pull show in vs, , other times csproj file unaffected. it's strange because csproj gets updated everywhere else, including central repository, doesn't update when pull. in our .gitattributes file have .csproj set merge=union . the command perform when pulling git pull upstream upstream remote pointing our central repository. any ideas? i'll put in answer, based on edward thomson's comment , contains link merge conflicts in csproj files (haacked.com/archive/2014/04/16/csproj-merge-conflicts) . please note know nothing

<script> tags changes and locks font size - html, css, javascript -

when put script in html file, font changes default , no styling can applied: <!doctype html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="test.css" type="text/css" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <ul class="topnav"> <li><a href="#home">home</a></li> <li><a href="#news">news</a></li> <li><a href="#contact">contact</a></li> <li><a href="#about">about</a></li> </ul> <script> function myfunction() { } </script> </body> </html> css file looks this: ul.topnav li { font-size: 20; } if take out script font size changes 20. why happen? you don't set 'px'. ch

angular - Can I use a service which is used by the imported component? -

i've started developing via angular2 , liked it. today faced such problem: have reusable component of alerts uses it's own service business logic in it. can use same service put data tests in component importing reusable component in it? okay? reusable component see data in service imported service in such way? thank answers. luck! it depends want : if want service same(singleton) need inject service in root component or in bootstrap, should fine. if want service alerts component , different data component, inject service in both, should fine. https://angular.io/docs/ts/latest/guide/hierarchical-dependency-injection.html

javascript - How to write a nightwatch custom command using jquery -

i have following custom command written in javascript nightwatch.js. how can translate using jquery? exports.command = function (classid, indexifnotzero) { this.browser.execute(function (classid, indexifnotzero) { if (classid.charat(0) == '.') { classid = classid.substring(1); } var items = document.getelementsbyclassname(classid); if (items.length) { var item = indexifnotzero ? items[indexifnotzero] : items[0]; if (item) { item.click(); return true; } } return false; //alert(rxp); }, [classid, indexifnotzero], function (result) { console.info(result); }); }; there few things see causing issues. first, have variable shadowing may cause issues. global export command has 2 variables ( classid , indexifnotzero ) , internal execute command has same parameter names. second, custom commands, this variable

copymethod() with Java string -

i have requirement use copymethod() of unsafe class use string, came across link http://mishadoff.com/blog/java-magic-part-4-sun-dot-misc-dot-unsafe/ , found following example- string password = new string("l00k@myhor$e"); string fake = new string(password.replaceall(".", "?")); system.out.println(password); // l00k@myhor$e system.out.println(fake); // ???????????? getunsafe().copymemory( fake, 0l, null, toaddress(password), sizeof(password)); system.out.println(password); // ???????????? system.out.println(fake); // ???????????? static long toaddress(object obj) { object[] array = new object[] {obj}; long baseoffset = getunsafe().arraybaseoffset(object[].class); return normalize(getunsafe().getint(array, baseoffset)); } private static long normalize(int value) { if(value >= 0) return value; return (~0l >>> 32) & value; } i tried example got illegalargumentexception. can please in getting example wor

java - JMX - Pivotal Cloud Foundry -

i having java app planning migrate pivotal cloud foundry. application uses jmx change of properties @ runtime. possible retain same architecture when migrate app pcf or should explore different approach? for pcf app, cloud environment should provide dependencies needed app. can inject these dependencies runtime in various ways, instance, provide environment settings. if need credentials @ runtime, can @ spring cloud services, , config server. if looking other services, can use service registry , discovery (based on netflix eureka component) within spring cloud services. it depends on use case. can elaborate more on "change properties @ runtime"?

Find URL for google play app before releasing it -

i want have rate button app open google play store page of app when clicked. problem not know url of app on google play store since have not released yet. how can find url? i know answer bit late url be: https://play.google.com/store/apps/details?id=your_package_name you can find package name in androidmainfest.xml of project.

javascript - Multi-stop Gradient in THREE.js for Lines -

this shows example of how create two-color gradient along three.js line: color gradient three.js line how implement multi-stop color gradient along line? looks attributes interpolate across 2 values (i tried passing in three, worked first 2 values). this do-it-yourself color gradient approach: create line geometry , add vertices: var linegeometry = new three.geometry(); linegeometry.vertices.push( new three.vector3( -10, 0, 0 ), new three.vector3( -10, 10, 0 ) ); use helper functions convenience: var steps = 0.2; var phase = 1.5; var coloredline = getcoloredbufferline( steps, phase, linegeometry ); scene.add( coloredline ); jsfiddle: http://jsfiddle.net/l0rdzbej/276/ explaination: getcoloredbufferline creates new buffer geometry geometry, convenience. iterates vertices, assigning each vertex color. color calculated using helper: color.set ( makecolorgradient( i, frequency, phase ) ); . where frequency defines how many color changes want l

ruby on rails - Hash/Array to Active Record -

i have been searching everywhere can't seem find problem anywhere. in rails 5.0.0.beta3 need sort @record = user.records association , it's record. sort goes this. @record = @record.sort_by { |rec| if user.fav_record.find(rec.id) user.fav_record(rec.id).created_at else rec.created_at end this example of do. sorts fine. the problem: returns array , not active record class. i've tried return active record class. i've pushed sorted elements id array , tried extract them in order, i've tried mapping. every result turns previous active record array or hash. need go active record. know how convert array or hash of active record active record class? there isn't easy way convert activerecord array. if want optimize performance of app, should try avoid converting arrays activerecord queries. try , keep object query long possible. that being said, working arrays easier queries, , can feel hassle convert lot of array operations activerecord

Does C# 6.0 work for .NET 4.0? -

i created sample project, c#6.0 goodies - null propagation , properties initialization example, set target version .net 4.0 , it... works. public class cat { public int taillength { get; set; } = 4; public cat friend { get; set; } public string mew() { return "mew!"; } } class program { static void main(string[] args) { var cat = new cat {friend = new cat()}; console.writeline(cat?.friend.mew()); console.writeline(cat?.friend?.friend?.mew() ?? "null"); console.writeline(cat?.friend?.friend?.taillength ?? 0); } } wikipedia says .net framework c# 6.0 4.6. this question (and visual studio 2015 ctp test) says clr version 4.0.30319.0. this msdn page says .net 4, 4.5, 4.5.2 uses clr 4. there isn't information .net 4.6. does mean can use c# 6.0 features software targets .net 4.0? there limitations or drawbacks? yes (mostly). c# 6.0 requires new roslyn compiler, new compiler can compil

Prolog Type Error -

i'm working on prolog algorithm perform "swap" on list. example: input: [1,2,3,4] -> output: [3,4,1,2] input: [1,2,3,4,5] -> output: [4,5,3,1,2] the first half , second half of list swap places, if there odd number center element retains it's position. have come algorithm, getting error: ?- swap([1,2,3,4],l). error: length/2: type error: `integer' expected, found `round(4/2)' my code follows: swap(l, s) :- length(l, length), reverse(l, l2), mixing(l, length, a), trim(l2, length/2 , b), append(a,b,s). trim(l,n,s) :- length(p,n), append(p,s,l). mixing(l, length, a) :- ( mod(length, 2) == 0 -> trim(l, round(length/2), a) ; trim(l, round(length/2), a) ). the problem in 'mixing' when call trim (l, round(length/2), a) type not integer? understand length/2 not integer (most float) , thought round equivalent integer(expr) rounds , transforms data type integer. tried replacing round tru

sql - Filtering Datagridview using a column in dataview using VB.Net 2010 -

i writing windows form application using visual studio 2010. since i'm new visual basic, i'm trying filter datagridview column using multi values filteted gridview column. in fact i'm trying represent many_to_many relation have 2 main tables (student , subject), , third conjunction table(stu_subj). is there easy way represent many_to_many relation in windows form? or maybe sql query: select * table [column_name] in ('a','b','c') but a, b ,c. here values of filtered column in gridview! tried many solutions no hope! can me doing such task?

android - java.net.ConnectException: Connection refused: connect Error while Installing APK -

i got error in android while running. java.net.connectexception: connection refused: connect error while installing apk. please 1 me happen , how fix. the error show in log is. connection attempts: 1 09:43:16 'c:\users\android\sdk\platform-tools\adb.exe,start-server' failed -- run manually if necessary the error show in run console java.net.connectexception: connection refused: connect error while installing apk kill adb.exe process,and restart androidstudio

header files - What difference does it make when I include <limits> or <limits.h> in my c++ code -

can please explain this? #include <iostream> #include <limits.h> or #include <iostream> #include <limits> <limits> c++ standard library header providing similar insights c header <limits.h> (which available in c++ <climits> ), written in way that's more useful , safe in c++ programs: say have template <typename numeric> ... , , code inside wants know minimum , maximum value of numeric type parameter user instantiated template with: can use std::numeric_limits<numeric>::min() , ...::max() ; if wanted access same values <climits> , it'd hard know of schar_min , shrt_min , int_min , long_min etc. use , you'd have switch between them - lots of code trivial <climits> has lots of macros, , macros don't respect namespaces or scopes way "normal" c++ identifiers - substitutions made pretty indescriminately - make program more error prone <limits> gives

jquery - Javascript runs on page reload -

i'm using javascript edit url sort list generated none editable plugin in wordpress: <script type="text/javascript"> var sortregex = /\[sort_by\]=\w*/; function pricehighz() { location.href = location.href.replace('[sort_order]=asc', '[sort_order]=desc').replace(sortregex, '[sort_by]=price'); } function pricelowz() { location.href = location.href.replace('[sort_order]=desc', '[sort_order]=asc').replace(sortregex, '[sort_by]=price'); } function datehighz() { location.href = location.href.replace('[sort_order]=asc', '[sort_order]=desc').replace(sortregex, '[sort_by]=date'); } document.addeventlistener('domcontentloaded', function () { document.getelementbyid('pricehighz').addeventlistener('click', pricehighz); document.getelementbyid('pricelowz').addeventlistener('click', pricelowz); document.getelementbyid('datehighz').addeventlist

Using RegEx for validating First and Last names in Java -

i trying validate string contains first & last name of person. acceptable formats of names follows. bruce schneier schneier, bruce schneier, bruce wayne o’malley, john f. john o’malley-smith cher i came following program validate string variable. validatename function should return true if name format matches of mentioned formats able. else should return false . import java.util.regex.*; public class telephone { public static boolean validatename (string txt){ string regx = "^[\\\\p{l} .'-]+$"; pattern pattern = pattern.compile(regx, pattern.case_insensitive); matcher matcher = pattern.matcher(txt); return matcher.find(); } public static void main(string args[]) { string name = "ron o’’henry"; system.out.println(validatename(name)); } } but reason, returning false value. doing wrong here? use this: ^[\p{l}\s.’\-,]+$ demo: https://regex101.co

python - is it possible to avoid table name conflict when using two data model in Flask-sqlalchemy -

i have flask app using flask-sqlalchemy access mysql. want refactor data model in same app, created new version model file few of tables should have same name old table. oldmodel.py class tablea(db.model): __tablename__ = 'tablea' ... newmodel.py class tablea(db.model): __tablename__ = 'tablea' ... write function, idea query data old metadata write new database new metadata after column data manipulation, report same table name conflict in flask-sqlalchemy. error message sqlalchemy.exc.invalidrequesterror: table 'tablea' defined metadata instance. specify 'extend_existing=true' redefine options , columns on existing table object. i don't want use flask-migrate on old database, create new database. tried __bind_key__ , seems working in new table not working in exist table had data. is possible avoid use 2 version of datamodel in same app? or other approach? finally, found way that, changed model pure sqlalchem

how to create a google form response with app script -

as way of initializing form record, want fill , submit google form apps script. key bit of documentation form.createresponse() this creates new response form. answer question item, create itemresponse item, attach form response calling formresponse.withitemresponse(response). save assembled response, call formresponse.submit(). do need new formresponse() or how make happen? create new form var test_form = formapp.create('test1'); test_form.addtextitem(); get first question text item var questions = test_form.getitems(); var qt = questions[0].astextitem(); set response var qr = qt.createresponse('cats'); create , submit response object var formresponse = test_form.createresponse(); formresponse.withitemresponse( qr ); formresponse.submit();

javascript - Data From Ajax Response Can't Be Loaded In HighChart -

Image
i have data ajax response in array, here is: "attd": [ { "y": 1, "name": "attendance", "sliced": true, "selected": true }, { "y": 1, "name": "spj in town", "sliced": true, "selected": true } ] i want pass result highchart, here's code: success: function(rs) { var attdchart = $(".attdchart"); attdchart.unbind(); var jsondata = json.parse(rs); if (jsondata.success) { var data = jsondata.attd; var data_array = []; $.each(data, function(key, value){ data_array.push(value); }); $('#containerpiechart').highcharts({ chart: { plotbackgroundcolor: null, plotborderwidth: null, plotshadow: false, type: 'pie', height: 200, marginright: 60 }, title: { text

rails and ruby update on ubuntu ERROR: Failed to build gem native extension -

i'm upgrading ror app on ubuntu 14.04 server (aws ec2) ruby 2.1.4 2.2.4 , rails 4.2.4 4.2.6 , running following commands after ssh ing server: git pull origin master rvm install 2.2.4 bundle install gem install rails 4.2.6 ./restart_server.sh # script precompile assets , restart server when accessing end point, receive following response of web application can not started error: failed build gem native extension. /home/ubuntu/.rvm/rubies/ruby-2.2.4/bin/ruby extconf.rb checking rb_trap_immediate in ruby.h,rubysig.h... no checking rb_thread_blocking_region()... no checking inotify_init() in sys/inotify.h... yes checking writev() in sys/uio.h... yes checking rb_wait_for_single_fd()... yes checking rb_enable_interrupt()... no checking rb_time_new()... yes checking sys/event.h... no checking epoll_create() in sys/epoll.h... yes creating makefile make "destdir=" clean make "destdir=" compiling binder.cpp compiling page.cpp compiling cmain.cpp compiling

using Regex to match something from left -

Image
train london boston - match train boston london train cardif london bus london paris - match how can match if london appear before other cities regex? can string matching loop in javascript think regex better. get lines includes london to var str = `train london boston - match train boston london train cardif london bus london paris - match`, city = 'london'; console.log( str.match(new regexp('^.*\\b' + city + '\\sto\\b.*$', 'gmi')) ) regex explanation here

java - TextView goes behind another textview during animation -

i want use property animation moves view left right,like objectanimator animator = objectanimator.offloat(textview1, "translationx", 400); but when animation starts, animation covered view on right of target view enter image description here i want textview1 on top of textview2 when animation start.how can it? try using textview1.bringtofront(); before starting animation.

laravel use field in Eloquent model from another table -

i have model named "user". want "password" field eloquent table, , when user calls user::all() method, selected fields different tables come in result. how can that? results not displayed in with() . my problem solved using $appends in eloquent model . my code : class user extends eloquent { protected $table = 'user'; protected $attributes = ['password']; protected $appends = ['password']; public function getpasswordattribute() { return $this->getpasswordmethod(); } }

java - Instantiate new OAuth 2.0 Credentials using stored tokens from another way -

i'm working google calendar api java on server side. have token & refresh token client side , store database. so how can instantiate new oauth 2.0 credentials using these stored tokens calling google calendar java api? thank in advance. it's stated in detecting expired access token once token detected no longer valid (ie. expired or revoked), must remove access token storage. likewise, stated in oauth 2.0 authorization framework under refreshing access token that: the authorization server may issue new refresh token, in case client must discard old refresh token , replace new refresh token. authorization server may revoke old refresh token after issuing new refresh token client. if new refresh token issued, refresh token scope must identical of refresh token included client in request.

java - For loop troubling for printing multiple values -

so question is: write program reads sequence of input values , displays bar chart of values using asterisks. may assume values positive. first figure out maximum value. value’s bar should drawn 40 asterisks. shorter bars should use proportionally fewer asterisks. eg. *********************** ********* **************************************** **** ******************* this code below: int count = 0; //finds largest value int largestvalue = numbersarray[0]; (int = 1; < numbersarray.length; i++) { if (numbersarray[i] > largestvalue) { largestvalue = numbersarray[i]; count++; } } //prints number of asterisks final int max = 40; string asterisks = "****************************************"; (int = 0; < count + 2; i++) { system.out.print(numbersarray[i]); if (numbersarray[i] == largestvalue) { system.out.print(asterisks); } //if (numbersarray[i] != large

pagination - How to remove footer view in Android? -

i have 3 buttons , i'm displaying pagination button wise. if click on button 1 calling pagination 1 , if click on button 2 start pagination 2nd , if click on button 3rd start pagination 3rd working . have add progress bar @ end of listview setonscrolllistener per pagination. but problem whenever go end of list view progress bar added every time.i'm tried remove footer view @ last page getting exception of invalid index out of bound exception index 0 . can me how work pagination progress bar. 1st button click = pegination(); same 2nd button click =loginuser_postloacalpages(); , same 3rd button click = r_post_pagination(); here 1st pagination public void pegination() { final int activitycount = sharedpreferences.getint("activitylistcount", 0); log.e("","activitycount in pegination method ="+activitycount); footer = ((layoutinflater) getsystemservice(context.layout_inflater_service)).inflate(r

What's Instagram's /media/ used for? -

Image
i have been trying figure out used for. what's difference between using: http://www.instagram.com/test and http://www.instagram.com/test/media why /media exist? purpose? the diference between http://www.instagram.com/test , http://www.instagram.com/test/media web response http://www.instagram.com/test url give visual information , because can see pictures. http://www.instagram.com/test/media url give information developer ( json data ) this. this information first image can check.

c++ - How to avoid changing every child constructor when parent constructor changes -

say have following (c++) class parent { parent(foo f){}; } class child : public parent { child(foo f, bar b) : parent(f) {}; } ... // , whole bunch of other children, calling parent constructor suppose need add new parameter parent constructor parent(foo f, baz z){}; then have change every single child class following child(foo f, baz z, bar b) : parent(f, z) {}; is there anyway can avoid having change every single child class? guess might related this, how avoid repetitive constructor in children suggests must change every child class. if so, there languages / design patterns make such change less painful? if new argument parent constructor mandatory there no choice, have update child classes constructors. but if new argument not mandatory, add new parent constructor overloaded constructor, or use default value new argument.

jsp - Java servlet can't handle get and post requests simultaneously -

so thought servlet made handle requests through , post @ same time (concurrently) when webpage communicating server. might since same page making both requests there 1 thread handling both requests. what's happening have post request getting called through jquery ajax request , on success of request calls callback javascript method has jquery ajax request. understanding might possibly wrong on constitutes successful request. suggestions or explanations on how can work or why won't work appreciated. i tested case using glassfish4, servlet-api 3 , observed following: first created servlet serves both , post. servlet had 5 second thread sleep delay @webservlet("/hello") public class helloservlet extends httpservlet { private static final long serialversionuid = 1l; private static logger logger = logger.getlogger(helloservlet.class); public helloservlet() { super(); logger.debug("helloservlet created"); } @override prote

Spark Streaming from Kafka Source Go Back to a Checkpoint or Rewinding -

when streaming spark dstreams consumer kafka source, 1 can checkpoint spark context when app crashes (or affected kill -9 ), app can recover context checkpoint. if app 'accidentally deployed bad logic', 1 might want rewind last topic+partition+offset replay events kafka topic's partitions' offset positions working fine before 'bad logic'. how streaming apps rewound last 'good spot' (topic+partition+offset) when checkpointing in effect? note: in (heart) logs, jay kreps writes using parallel consumer (group) process starts @ diverging kafka offset locations until caught original , killing original. (what 2nd spark streaming process respect starting partition/offset locations?) sidebar: question may related mid-stream changing configuration check-pointed spark stream similar mechanism may need deployed. you not going able rewind stream in running sparkstreamingcontext . it's important keep these points in mind (straight docs):

android - Reduce Spacing between Tiles -

Image
i'm using awesome library twoway-view , got desired layout. however, wanted reduce space between each tiles. right can see there plenty of white space between each tile. anyone can guide? use android:layout_margin attribute xml of item in list. here demo . read more docs on layout margins , padding alignment related issues.

php - Resize photo with every extensions -

i got resize photo script frm website , work fine problem is: can use upload jpg photo if try upload other extensions such : png,gif error here code: <? if(trim($_files["fileupload"]["tmp_name"]) != "") { $images = $_files["fileupload"]["tmp_name"]; $new_images = "thumbnails_".$_files["fileupload"]["name"]; copy($_files["fileupload"]["tmp_name"],"myresize/".$_files["fileupload"]["name"]); $width=100; //*** fix width & heigh (autu caculate) ***// $size=getimagesize($images); $height=100; $images_orig = imagecreatefromjpeg($images); $photox = imagesx($images_orig); $photoy = imagesy($images_orig); $images_fin = imagecreatetruecolor($width, $height); imagecopyresampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photox, $photoy); imagejpeg($images_fin,"myresize/".$new_images

teamcity - Limit the number of simultanious builds for a sub project -

i have sub project in ensure build configurations in sub project never run @ same time. all build configurations based on same template , have tried setting "limit number of concurrent build to" 1 has no effect. assume since binds concrete build configuration , not template. i assumed set agent requirement limit name build agent in snapshot dependence apparently agent requirements not evaluate variables. i have build configuration called has snapshot dependencies on build configurations in sub project. under snapshot dependencies settings tried setting "run on same build agent" result in build queue run on "no agents". assume because started 1 build configuration manually. invoked confused teamcity. the thing works hardcoding agent name requirement i'm not fan of solution. how can limit simultanious builds across sub project without hardcoding agent name. i think need shared resources . official documentation: the shared resou

installation - How can I auto install apk on android without market NOT system app -

Image
i apk in server. and try file apkfile = new file("/sdcard/download/openapk.apk"); uri apkuri = uri.fromfile(apkfile); intent webintent = new intent(intent.action_view); webintent.setdataandtype(uri.fromfile(apkfile), "application/vnd.android.package-archive"); webintent.setflags(intent.flag_activity_new_task); startactivity(webintent); this code. after showing under picture. code when click install button. start install. want auto install .and apk execution perhaps possible auto install after apk execution. ? nope, not possible , pretty because if possible, mean app install on device without asking user... android more insecure.

r - Replace value from other dataframe -

i have data frame (x) factor variable has values seperated comma. have data frame (y) description same values. want replace values in data frame (x) description data frame (y). highly appreciated. say example, 2 data frame looks below data frame (x) s.no x 1 2,5,45 2 35,5 3 45 data fram (y) s.no x description 1 2 2 5 b 3 45 c 4 35 d i need output below s.no x 1 a,b,c 2 d,b c c we can split 'x' column in 'x' dataset ',', loop on list , match value 'x' column in 'y' numeric index, corresponding 'description' value 'y' , paste together. x$x <- sapply(strsplit(x$x, ","), function(z) tostring(y$description[match(as.numeric(z), y$x)])) x # s.no x #1 1 a, b, c #2 2 d, b #3 3 c note: if 'x' column in 'x' factor class, use strsplit(as.characte

php - File system is not writable -

i installed drupal 7 in web host successfully. after installing module, got error errors , and status report gave me error message: file system not writable directory /applications/mamp/tmp/php not exist. may need set correct directory @ file system settings page or change current directory's permissions writable. i check permissions (sites/default/files) , has 755 permissions , change 777 nothing happened return back. i have following setting (home » administration » configuration » media): public file system path sites/default/files temporary directory /applications/mamp/tmp/php and here error getting: warning: file_put_contents(temporary://filedyfbdg) [function.file-put-contents]: failed open stream: "drupaltemporarystreamwrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc). file not created. warning: file_put_contents(temporary://fileetfmpl) [function.file-put-contents]: failed o

java - How to make inactive parts or views (Eclipse RCP 4) "closable with X-Button" -

Image
i'm newbie in eclipse rcp please me problem. i'm following tutorial: https://sites.google.com/site/tyroprogramming/java/rcp/text-editor/multiple-tabs , works, want know, how can make all, inactive parts closable, have "x"-button. example (x-button active part): it's not problem tabs (setunselectedclosevisible), how make views , parts? thanks in advance. use swt-unselected-close-visible in css mpartstack set unselected close value: .mpartstack { swt-unselected-close-visible: true; }

git - How to push updates from local repository to BitBucket? -

Image
so made local repository, , committed changes bitbucket repo. after that, made changes in local repository. i tried push files bitbucket, using git push origin master command. said files date. don't see changes on bitbucket page. any on please? check see if have uncommitted changes. looks forgot add files staging area. execute git status , check see if have un tracked/modified files

Lucene 4.0: TermStats is not public in TermStats; cannot be accessed from outside package -

i have 2 questions regarding lucene 4.0: 1) change sorting in lucene, created own tfidf class , called termstats constructor ts[t] = new termstats( contents[t].field,contents[t].termtext, contents[t].docfreq, tfidf); but message termstats(string,bytesref,int,long) not public in termstats; cannot accessed outside package does know, whether not have way change it? 2) lucene, indeed, calculate tf*idf or term frequency (tf)? asking because have read term frequency contructor accepts docfreq related idf. any appreciated. thank in advance. 1 - generally, rely on lucene pass termstatistics objects computeweight method of custom similarity implementation, rather constructing them yourself. if need acquire them directly, accomplish calling indexsearcher.termstatistics (you'll need pass in appropriate termcontext call, created using static method termcontext.build ). 2 - yes, lucene's defaultsimilarity implementation of it's tfidfsimilarity

javascript - remove() on img with ng-src, border remains? -

i have ng-repeated images. <img ng-src="{{::data.image}}" /> css: .thumbnailimage { width: auto; max-width: 20px; height: auto; max-height: 20px; border: 1px solid lightslategrey; position: relative; display: block; margin-left: auto; margin-right: auto; background-color: white; /* in case of png */ } some of {{data.image}} null. want remove those. <img ng-src="{{::data.image}}" onerror="this.remove()" /> however when 1px border have on images still remains? before had ng-if statement (ng-src != null), found out expensive in angular watchers. https://jsfiddle.net/8ykrkc3c/ your onerror handler incorrect. note, it's no longer angular attribute , hence can't use angular.element.prototype.remove method. instead need go old native dom methods, in case removechild : <img class="asd" ng-src="{{::data.image}}" onerror="this.parentnode.removechild(this)" /&

How can I do more than one action with an ng-click in AngularJS -

in code there is: <button class="btn float-right" data-ng-click="test()"> reset </button> is possible me fire more 1 function when click of button. if how should code that? update. call test() function in current scope , othertest() function in parent scope / controller. i call test() function in current scope , othertest() function in parent scope / controller. just define orthertest in parent scope. example: function parentcontroller($scope){ $scope.othertest = function(){ } } there 2 ways achieve want: try: function currentcontroller($scope){ $scope.test = function(){ } } data-ng-click="test();othertest()" or: function currentcontroller($scope){ $scope.test = function(){ $scope.othertest(); //your test code function } } data-ng-click="test()" as scope inherited, current scope inherit othertest parent scope

php - How can I get the last row from a table mysqli? -

i have table , trying recent row using code: include "db_conx.php"; $sql="select column table order desc limit 1"; if ($result=mysqli_query($db_conx,$sql)) { while ($row=mysqli_fetch_row($result)) { printf($row[0]); } mysqli_free_result($result); } it returns blank result though. order desc limit 1 order what desc? have provide column name want order by. auto increment column, primary key or timestamp etc as stands query has invalid syntax , not return other error.

.net - Injection of ViewModels without a Service Locator -

i think service locator anti-pattern, find common see "viewmodellocator" each view takes datasource in xaml-based applications. how avoided? you can use mvvm framework uses conventions, caliburn.micro. in caliburn, register viewmodel di container when app starts. when have testview automatically bound testviewmodel (convention name, framework looks viewmodel in di container, gets/creates instance , binds it.).

purescript - How to define the type signature on this Affjax call -

i having simple program using affjax , launchaff . import network.http.affjax affjax import control.monad.aff (launchaff) test1 = launchaff $ affjax.get "/api" this gives me following error 58 test1 = launchaff $ affjax.get "/api" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no type class instance found network.http.affjax.response.respondable _0 instance head contains unknown type variables. consider adding type annotation. in value declaration test1 _0 unknown type i understand respondable needs be defined here dont how exactly. any appreciated. thx you'll need annotate test1 function let compiler know expect ajax call. test1 = launchaff affjax.get "/api" :: affjax _ foreign you can choose 1 of these instances return type, or if expect own datatype returned, write respondable instance it. edit: edited source code. provided codesnippet isn't useful though, since you're not doing ajax response.

Parameterized WHERE clause in SQL Server Stored Procedure -

i have stored procedure details of invoices some occasions list of invoices sending invoiceid in other occasions need list of invoices per search fields supplied user. send fields stored procedure , use parameters below. included 2 columns there more. select * invoices (@invoicenumber null or i.invoicenumber = @invoicenumber) , (@pono null or i.pono = @pono) is there way send condition clause 1 parameter? yes, possible dynamic sql, highly discourage that. select * tbl @condition : if considering write procedure create procedure search_sp @condition varchar(8000) select * tbl @condition just forget it. if doing this, have not completed transition use stored procedure , still assembling sql code in client. it open application sql injection attacks.

python - Tkinter bind function -

i have python code print text written prompt: from tkinter import * class commandlist(object): show = false def __init__(self): self.show = false def show(self): print "showed" def hide(self): self.show = false def is_showed(self): return self.show master = tk() tab = commandlist() e = entry(master, width=1000) e.pack() def enter(event): master.quit() def escape(event): exit() def tabulator(tab): print type(tab) tab.show() e.bind('<control_l>j', enter) e.bind('<return>', enter) e.bind('<escape>', escape) e.bind('<tab>', lambda event, tab=tab: tabulator(tab)) e.focus_set() master.mainloop() print e.get() it works fine, when press tab key, error: <class '__main__.commandlist'> exception in tkinter callback traceback (most recent call last): file "/usr/lib/python2.7/lib-tk/tkinter.py", line 1535, in __ca

Firefox Add-on SDK extension with Websocket doesn't work for Facebook/Twitter -

i'm developing firefox extension based on addon sdk. inside content script, need create websocket connection localhost server using wss. in addon script (index.js), use "sdk/tabs" inject content script. var tabs = require("sdk/tabs"); tabs.on("ready", function(tab){ var worker = tab.attach({ contentscriptfile: ["./websocket.js"] }); }); data/websocket.js looks like: websocket = new websocket("wss://localhost:8443/websocketserver/"); websocket.onopen = function(evt){ console.log("connection open"); websocket.send("connection established!"); }; websocket.onmessage = function(evt){ console.log("message received: "+evt.data); }; i open firefox , open page https://localhost:8443/ , accept certificate. certificate won't problem here. i can open normal http page ,

ruby on rails - Faking a Database record for Active Record methods -

i'm using find_by on association: "sub" has many 1 relation "main" @main.subs.find_by(x: 123) in cases want access , retrieve database "sub" record related "main", using regular select: select subs.* subs subs.main_id = 333 , subs.x = 123 but there's scenario, in want ignore database , access stub i've created of "subs" under "main": stub_sub = sub.new(id: 22, x: 123, main_id: 333) @main.subs << stub_sub @main isn't saved in database either , created sub: @main = main.new(id: 333) when find_by line while debugging, , try , access @main.subs, looks active record relation i'd db query, if find_by/all try access db , see there's nothing there , return empty relation. is there way prevent find_by (or active record method) accessing database , work on stub relation i've created it? i think there few misunderstandings in question there. firstly, find_by method not r

r - Create a function from a vector to another -

i have 2 vectors: x <- c(-2.0,-1.75,-1.50,-1.25,-1.00,-0.75,-0.50,-0.25,0.00,0.25,0.50,0.75,1.00,1.25,1.50,1.75,2.00,2.25,2.50,2.75) y <- c(37.0000,24.1602,15.06250,8.91016,5.00000,2.72266,1.56250,1.09766,1.00000,1.03516,1.06250,1.03516,1.00000,1.09766,1.56250,2.72266,5.00000,8.91016,15.06250,24.16016) i trying create function given number vector x, returns corresponding y value(same index). example, func(-2.0) should return 37.0000 . currently have super ugly function don't think supposed do: func1 <- function(x) { if (x==-2.0) {return (37.0000)} else if (x==-1.75){return (24.1602)} else if (x==-1.50){return (15.06250)} else if (x==-1.25){return (8.91016)} else if (x==-1.00){return (5.00000)} else if (x==-0.75){return (2.72266)} else if (x==-0.50){return (1.56250)} else if (x==-0.25){return (1.09766)} else if (x==0.00){return (1.00000)} else if (x==0.25){return (1.03516)} else if (x==0.50){return (1.06250)} else if (x==0.75){return (1.

How to prevent Jmeter from adding the default content type if left blank? -

i have perform functional testing few api's, if content type left blank application should mention "content-type invalid". in jmeter if sent "content type = "(blank) in header manager ,jmeter adding content type application/x-www-form-urlencoded. please me how prevent jmeter adding default content type, if left blank? i believe should provide correct content-type header can like: application/json rest text/xml; charset="utf-8" soap see testing soap/rest web services using jmeter article little bit more detailed information on domain

Remove invalid data based on particular pattern SQL Server -

i have sample data shown below ------------------------------------------------ | id | column 1 | column 2 | ------------------------------------------------ | 1 | 0229-10010 |valid | ------------------------------------------------ | 2 | 20483 |invalid | ------------------------------------------------ | 3 | 319574r06-stat |valid | ------------------------------------------------ | 4 | ,,,,,,,,,,,,,,1,,,,,,, |invalid | ------------------------------------------------ | 5 | "pbom-sse, chamber" |valid | ------------------------------------------------ | 6 | ""pbom-sse, chamber |invalid | ------------------------------------------------ | 7 | "pbom-sse chamber", |invalid | ------------------------------------------------ | 8 | #drm-1102.z |invalid | ------------------------------------------------ | 9 | drm#