Posts

Showing posts from May, 2012

c++ - How to create a vector of CvSVM -

i want create std::vector of opencv cvsvm objects. when compile code: typedef vector<cvsvm> svm_vec; svm_vec svm_data = svm_vec(); an error occurs: in file included 2dpca.cpp:5:0: /usr/include/c++/4.8/bits/stl_construct.h: in instantiation of ‘void std::_construct(_t1*, const _t2&) [with _t1 = cvsvm; _t2 = cvsvm]’: /usr/include/c++/4.8/bits/stl_uninitialized.h:75:53: required ‘static _forwarditerator std::__uninitialized_copy<_trivialvaluetypes>::__uninit_copy(_inputiterator, _inputiterator, _forwarditerator) [with _inputiterator = __gnu_cxx::__normal_iterator<const cvsvm*, std::vector<cvsvm> >; _forwarditerator = cvsvm*; bool _trivialvaluetypes = false]’ /usr/include/c++/4.8/bits/stl_uninitialized.h:117:41: required ‘_forwarditerator std::uninitialized_copy(_inputiterator, _inputiterator, _forwarditerator) [with _inputiterator = __gnu_cxx::__normal_iterator<const cvsvm*, std::vector<cvsvm> >; _forwarditerator = cvsvm*]’ /usr/

security - How to protect passwords given inside PHP so people browsing the code will not see it -

i making php script people have purchase. <?php session_start(); $dbhost = "localhost"; $dbname = "planeub9_airmanagemembership"; $dbuser = "planeub9_malcolm"; $dbpass = "mypassword"; mysql_connect($dbhost, $dbuser, $dbpass) or die("mysql error: " . mysql_error()); mysql_select_db($dbname) or die("mysql error: " . mysql_error()); ?> is there way db password can hidden plain view? i start assuming release tarball or zipfile of software project, rather granting access whole git repository. this, can use git archive create release of project. before this, need ensure configuration file not committed version control. if already, copy (for example copy "/config/base.php" "/config/base.php.example") , reset settings dummy values prior committing it. remove real config file version control whilst leaving physical file on disk. to prevent file coming in g

javascript - JQuery - Dynamically Adding a New DIV Element -

i have been researching clean way add div page , add line of text dynamically. of stuff come across deals existing divs in page , not creating new one. i not super familiar jquery getting there , tried code reason not getting desired result, can please tell me doing wrong? var theresponse = prompt('which group?'); //alert(theresponse); var groupdiv = $('#groupdiv'); $('body').append(groupdiv); $('#groupdiv').css({"marginleft":"10px", "margintop":"10px"}); $('#groupdiv').append("group: "+theresponse); $('#groupdiv').show(); switch (theresponse) { case "1": //alert("case 1"); break; case "2": //alert("case 2"); break; case "3": //alert("case 3"); break; default: //alert("default"); // } i hoping not dumb rookie mistake appreciated. running using gre

performance - Memory bandwidth achievable on a single core -

on modern multi-core platforms parallel performance of memory bandwidth bounded applications not scale number of cores. usually, speedup observed number of cores, after performance saturates. synthetic example well-known stream benchmark , used report achievable memory bandwidth, i.e., memory bandwidth @ saturation point. consider following results of stream benchmark (triad) on single xeon e5-2680 peak memory bandwidth of 42.7gb/s (ddr3-1333): 1 core 16 gb/s 2 cores 30 gb/s 3+ cores 36 gb/s stream scales 1 2 cores, above 3 cores performance constant. my question is: determines memory bandwidth can achieved single cpu core ? since question broad, narrow down above mentioned architecture: how can predict stream 1 thread give me 16 gb/s specs of e5-2680, or looking @ hardware counters etc? for single core major factor cpu frequency , cpu micro architecture, speed of single core make requests bus , how cpu can predict memory location you're going access. cpu de

javascript - Monkeypatch the JavasScript date object -

i know crazy hack curious anyhow. have environment has wrong system time , cannot set correct time. it's specialized hardware cannot change system time. have service gives correct current time. our issue bunch of ssl , token signing libraries break because getting wrong datetime javascript date object ( since have wrong system time). what's way monkeypatch date object's constructor can feed correct time initialize subsequent calls date(), date.tostring(), etc... in dependent libraries return our new method returns correct non-system time? will work? var olddate = date; date = function(){ return new olddate(specialcalltogetcorrecttime()); } date.prototype = olddate.prototype; will work? no, since not respect arguments given new date function or whether called constructor vs not. forgot fix date.now() . still need right: date = (function (olddate, oldnow) { function date(year, month, date, hours, minutes, seconds, ms) { var re

python - add ban reason module error dict object has no attribute append and load and save methods fail to save and load correctly -

can me adding information key in dict , updating information accordingly? also can give me better method of saving , loading doing currently? my current method dict key: def add_banreason(roomname, username, reason): roomname = roomname.lower() username = username.lower() if not roomname in banr.banr_database: banr.banr_database[roomname] = {username:reason} else: banr.banr_database[roomname].append({username:reason}) i error here saying dict object has no attribute append i lookin result such no error: {roomname: {username:reason, username:reason, username:reason}, roomname: {username:reason, username:reason, username:reason}} my current method of saving , loading: ### load database def load(): banr_database = {} open("banr.db","r") t: data = t.read() if data != "": l in data.split("\n"): a,b = l.split("):(",1) c = [w.split(")-(") w

Default seeds in Stata -

i gather the stata manual on rng seed value seed 123456789 every time stata launched. questions are was way or default seed different in older versions (i'm particularly concerned version 8) is default sortseed 123456789? to answer own questions: going @ least version 8 default seed 123456789 nick cox points out in comments above doesn't mean versions of stata produce same sequence of random numbers based on seed because random number generator has changed on time. the default sortseed seems 1001 : . query sortseed . di r(sortseed) 1001

Call PHP from Ruby and get response -

i've got open source charity website built in ruby on rails , we're trying integrate payment validation system , 1 exists in php - trying find if there way these 2 play nice together? can call php script ruby , have ruby read echo'd response etc? yes can done using system calls such def your_method(path,file) system("cd #{path} && #{file} ") end btw, know there io class input/output , 1 of fundamental method command is def popen(cmd) open3.popen3(cmd) {|stdin, stdout, stderr, wait_thr| exit_status = wait_thr.value if (exit_status !=0) raise commanderror, "something went wrong" // supposing customize class //command < standarderror ; end end } end on antoher side, if both codes runs on different codes, of course possible "apize" rails app, in order fetch , pull data

size - Over-riding FORTRAN error "array bound is not scalar integer" -

i'd know if loop can created, inside can call subroutine in there arrays defined size varies function of loop variable. tried following, got error "array bound not scalar integer". how solve issue? . . . iloop: i=5,24,0.5 jloop: j=5,20 call check(i,j,divlen,machexit,final) if (final.eq.1) exit iloop enddo jloop enddo iloop . . end program !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine check(i,j,divlen,machexit,final) integer, parameter :: ivlpts=10 real :: i,divlen,machexit integer :: final,j integer :: exppts,intstrtpts,contourstrtpts,totalpts,p1,p2,p3,p4,p5,p6,p7 exppts=((j*ivlpts)+((j-1)*(ivlpts-1))) p2=(exppts-ivlpts) p3=(ivlpts-1) p6=(exppts-p2) call check2(ivlpts,i,j,divlen,machexit,final,exppts,p2,p3,p6) end subroutine check !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine check2(ivlpts,i,j,divlen,machexit,final,exppts,p2,p3,p6) real, parameter :: gamma=1.

html - extract class name from tag beautifulsoup python -

i have following html code: <td class="image"> <a href="/target/tt0111161/" title="target text 1"> <img alt="target img" height="74" src="img src url" title="image title" width="54"/> </a> </td> <td class="title"> <span class="wlb_wrapper" data-caller-name="search" data-size="small" data-tconst="tt0111161"> </span> <a href="/target/tt0111161/"> other text </a> <span class="year_type"> (2013) </span> i trying use beautiful soup parse elements tab-delimited file. got great , have: for td in soup.select('td.title'): span = td.select('span.wlb_wrapper') if span: print span[0].get('data-tconst') # `tt0082971` now want "target text 1" .

sql - "+" at end of column data? -

i inserting string data database find full word not show up. show first 9 characters of word , "+" sign. portabili+ new enrol+ instead of "portability" , "new enrollment". initially, datatype column had been varchar2(10 bytes) thought might problem. i have since changed 100 bytes using alter table statement , have inserted new data see if show full word still doesn't show. any ideas why? ways/reasons why data can auto-truncated? solution: figured out. answer change size, however, had clear cache on application server , truncate several cache tables in db relating application. larger column size reflected in db , full word shows. it sounds data truncated on insertion. growing column can't bring data truncated.

regex - Find line with close curly bracket "}" but not with semicolon ";" or comma "," -

i trying find regex meet requirement. want match lines close curly bracket should not contain semicolon or comma. there maybe space or tab before bracket. there maybe space or other characters between bracket , semicolon/comma. an example match: [sapce/tab] } } /\* abcde \*/ } else { // abcde ignore: }; } abc; }, this have manages far: ^\s*(?=}).*(?!;)\s\*$ but matches }; , } , among others not want. have tried ^\s*}[^;,][0-9a-za-z_/*\{]\s*$ ignores } abc; , } else { this seems work me: ^[^,;]*\}[^,;]*$

ios - Show drop down menu when typing -

i have uitextfield , create bit drop down menu in ios contact app. when user starts typing, menu drop down. doesn't need limit data shows based on names great if (ex: if user types "m" shows strings beginning m , on). if user selects one, type sent uitextfield displayed. if there open source picker this, great. if not, there way present that contains items array. not have complex, wouldn't have limit data shown when user types or anything. response based on this link. show how url values in dropdown autocomplete. you need have nsmutablearray possible autocomplete values. in example, we’ll use nsmutablearray of pasturls, , every time user browses url we’ll add array. you need create uitable show values autocompletetableview = [[uitableview alloc] initwithframe: cgrectmake(0, 80, 320, 120) style:uitableviewstyleplain]; autocompletetableview.delegate = self; autocompletetableview.datasource = self; autocompletetableview.scrollenabled = yes; au

Datastax DSE Solr Error -

i have cql3 table composite keys (id int, category text, property text). when publish solr schema error: solr indexes not supported on columnfamilies non-string comparators has faced same issue, or know how resolve this? thanks. dse solr not support composite keys. unsupported features dse search not support: cassandra super columns cassandra counter columns cassandra timeseries type rows cassandra composite columns , solr fields must strings. dse solr source

c++ - Error with const string member : no appropriate default constructor available -

i getting no appropriate default constructor available error following simple piece of code: class { public: const string cs ; }; void main() { a; return; } if remove const string code compiles fine. can not understand why default constructor not getting created compiler? , deal const string member variable? working on vs2008. as mentioned in comments, const variables cannot left unitialized in c++. there 2 ways can initialize variable. in both cases, content of string can never modified (as const means). one: in class declaration. method useful if want string have same value across of objects. inflexible , if find using should declare variable static . class { const string cs = "value of cs"; }; alternatively, assign in constructor, using special syntax const member initialization. more flexible , idiomatic. class { const string cs; public: a() : cs("value of cs") { } }; note

Scrapy output multiple item elements with xpath to single csv? -

i attempting scrape items page containing various html elements , series of nested tables. i have code working scraping table x class="classa" , outputting table elements series of items, such company address, phone number, website address, etc. i add items list outputting, other items scraped aren't located within same table, , aren't located in table @ all, eg < h1 > tag in part of page. how possible add other items output, using xpath filter , have them appear in same array / output structure ? noticed if scrape table items table (even when table has exact same class name , id) csv output other items outputted on different lines in csv, not keeping csv structure intact :( im sure there must way items remain unified in csv output, if scraped different areas on page ? simple fix... ----- html example page being scraped ----- <html> <head></head> <body> < // huge amount of other html , tables not scraped > <h2&g

How to use 'Dropbox API' for streaming video in android? -

i want make application can streaming video dropbox server. so use coreapi , refered documents, tutorial can't find example streaming video. find download picture, upload picture... so have no idea how start project! t.t understand how authentication, doesn't know how access uploaded video, , download or streaming play. should make mediaplayer class? surfaceview? is there example this? i desire want solution. just create media link. see core http docs: https://www.dropbox.com/developers/core/docs#media . here's android call: https://www.dropbox.com/static/developers/dropbox-android-sdk-1.6-docs/com/dropbox/client2/dropboxapi.html#media(java.lang.string , boolean). that give temporary url file, should able pass whatever video player element use.

php - call posts groups in a page template and display post post content -

Image
i trying make posts, put them in groups , call groups page template display contents posts. sounds pretty straight forward cant seem figure out. there whole bunch of examples out there dont seem it. attached workflow diagram i not php developer syntax bit tricky me , can through that. guess has first time. it great able create sort of ui in admin panel assign post groups pages through check boxes rather hard coding values in template pretty awesome too. if far fetched @ point lets skip part. love frame work it i adding screen grab of dashboad when creating new page. not seeing visual composer when creating new page there screen option visual content composer , in there option post type. in can select type of post , category want show.

jQuery each loop is not working -

i put code based off reading other stackoverflow questions , tested in fiddle , works jsfiddle tried implement in clearfix function in project (at bottom) , cant work. tried putting in numerous places didnt change anything. placed console logs along code see gets , never fires function. want insert clearfix div every 3 divs have class col-md-3. i'm sure lack of knowledge have wrong. starting learn , piece code together. here code - (function () { 'use strict'; window.insta = { apiurl: 'https://api.instagram.com/v1/users/self/feed?access_token=[token goes here]&callback=?', grams: {}, init: function () { $.ajax({ type: 'get', url: insta.apiurl, datatype: 'json', success: insta.success }); }, rendergrams: function (grams) { $.each(grams, function(index, gram) { insta.gram

javascript - D3 Layout : Tree-like Structure, but link length varies -

i having interesting layout problem. i have football match data, particularly number of successful passes been made between players , captain of team. don't care passes made between players not captain of team. so root node captain, each leaf present each player , links going have ones between root node , every leaf node. no links between leaves. i root node sit @ center of diagram, , based on number of successful passes been made between captain , player, decide link length between root node , leaf. more passes been made, longer link be. i tempted use d3 force layout don't want player nodes overlap 1 on another. have few problems approach. main problem have , reason why here force layout doesn't seem allow me have different link lengths between nodes. other layout or custom layout, afraid whether there way avoid overlapping nodes. i ready math calculations, know, great if can start d3 layout. any suggestion d3 layout me start with? any appreciated. thank

css - HTML table width discrepancy -

the last row of this chart have created using collapsed html tables shorter few pixels despite having same width. why ? there better way create chart without using multiple tables ? <table cellpadding="0" style="padding-right:0px;padding-left:0px;width:800px;border-top:solid 1px;border-right:solid 1px;border-left:solid 1px;border-collapse:collapse;table-layout:fixed"><tr> <td style="text-align:center;width:100px;height:25px;border-right:solid 1px;">user</td> <td style="text-align:center;width:600px;height:25px;border-right:solid 1px;">300 gb</td> <td style="text-align:center;width:100px;height:25px;border-right:solid 1px;">usage (gb)</td> </tr> </table> <table cellpadding="0" style="padding-right:0px;padding-left:0px;width:800px;border-top:solid 1px;border-right:solid 1px;border-left:solid 1px;border-collapse:collapse;table-layout:fixed"><tr&

Using java replaceAll method to replace word in sentences with one regex -

i trying replace "is" "is not" in string there exception should not replace "is" reside in other word. example "this ant" --> "this not ant" [correct] "this ant" --> "this not not ant" [incorrect] so far, did is string result = str.replaceall("([^a-za-z0-9])is([^a-za-z0-9])","$1is not$2"); result = result.replaceall("^is([^a-za-z0-9])","is not$1"); result = result.replaceall("([^a-za-z0-9])is$","$1is not"); result = result.replaceall("^is$","is not"); but think possible 1 regex can't figure out. possible? use word boundary ( \b ): result = str.replaceall("\\bis\\b", "is not"); note: \ should escaped. otherwise matches backspace (u+0008). see demo .

domain driven design - Is this how to structure classes for DDD? -

assume have relationship every customer has address (which in case, entity), below: customer{ id, name, myaddress (instance of address) } should allowing structure exposes following option: mycustomer.myaddress.street = "pine street"; customerrepository.save(mycustomer); should cascade save, both customer class , address class? or, better perform following: mycustomer.myaddress.street = "pine street"; addressrepository.save(mycustomer.myaddress); unfortunately, address value object, cannot make interchangable ddd requires id tag present; example, if did following: customer1.setaddress(customer2.getaddress()); both customer1 , customer2 have same binding same record, dangerous. none of samples ddd. each 1 simple crud. don't "set fields". meaningful operations. customer.moveto(new address(...)) customer.fixaddresstypo(new address(...)) repositories aggregates, not entities. identify aggregates. http://dddcommunity

node.js - nodejs + amqp silently dies -

i have basic script take amqp messages , forward them socket.io works hours, days, silently stops forwarding amqp messages while continuing emit heartbeats. logs show when gets broken state, isn't trying emit socket.io messages amqp messages arrive, think problem amqp connection/subscription rather socket.io i tested manually shutting down , restarting rabbitmq server while script running, , appeared have no issues reconnecting , continuing function should. var port = 8888, http = require("http"), amqp = require("amqp"), socketio = require("socket.io"), express = require("express"), rabbitmq = amqp.createconnection({ host: 'server', reconnect: true }), app = express(), server = http.createserver(app), io = socketio.listen(server); rabbitmq.on("ready", function () { console.log("ready"); var queue = rabbitmq.queue("ft-s

ruby on rails - undefined method `movie_reviews' for nil:NilClass -

i made simple test app reviewing movies. error throughout application. i've set inheritance in models (using api movie data) , other standard things, don't know why i'm getting error. example, visiting url - ...movies/%23<tmdb::movie:0x00000002d30728>/movie_reviews/new i error app/controllers/movie_reviews_controller.rb:17:in `new' def new @movie_review = @movie.movie_reviews.new end here's source code on gh: https://github.com/xantax/sample_movies you never set instance variable @movie in new action of controller. every instance variable returns nil if hadn't been set before. @movie nil , expected you'll error. another thing should pay attention url. url path should have numeric movie id instead of %23<tmdb::movie:0x00000002d30728> . may prevent finding movie you'd in controller easily. if had been 23 example simply: @movie = movie.find(params[:id]) because /movies/23/more_reviews/new puts 23 params[:id] hope

java - How should the DAO design strategy be for update operation ? -

i myself surprised question never occurred me before time bothered since creating own application. i have taskdetail class has 30 fields. while updating there small part of taskdetail may updated "enddate" of task. can use 2 strategies update field. approach 1 : update entire object 30 fields , let rest fields overwritten in database same value expect changed field updated new value. or approach 2 : update field has been changed. in case treat employee dto , populate "enddate" field new value since field needs changed. both approaches seem have pros , cons approach 1 : (pros) - cleaner approach. (cons) - unnecessarily over-writing 29 additional field sake of 1 field. approach 2 : (pros) - updating fields modified (cons) - makes dao dirty looking because need 30 null checks identify of field have updated. this problem making me little uncomfortable. which of approach accepted 1 or there third approach? not in favor of us

html - How to spacing between images without any space with their container -

i'm trying create div images inside it, , there space between them. example, want space between them 2px, can use margin:1px; become 2px when one's left-margin meet other's right-margin, same top , bottom. there space between image , div's border, div become this: +------------------------------------------+ | | | +---------------+ +---------------+ | | | | | | | | | | | | | | | | | | | | | img1 | | img2 | | | | | | | | | | | | | | | | | | | | | +---------------+ +---------------+ | | div | | | | +---------------+ +---------------+ | | | | | | | | | | |

python - Regex statement to check for 3 capital letters? -

i need regex statement check 3 capital letters in row. for example should match: abc, aabc, abcabc but should not match: aabbbc, abcde at moment statement: '[^a-z]*[a-z]{3}[^a-z]*' but matches abcde, doing wrong? thanks in advance. regex (?<![a-z])[a-z]{3}(?![a-z]) explanation i specified negative lookbehind , negative lookahead before , after middle regex 3 capitals in row, respectively. this better option compared using negated character class because match when there no characters left or right of string. online demonstration demo as python code, haven't figured out how print out actual matches, syntax: using re.match : >>> import re >>> p = re.compile(r'(?<![a-z])[a-z]{3}(?![a-z])') >>> s = '''abc ... aabc ... abcabcabcabcdabcabcdedededa ... abcde''' >>> result = p.match(s) >>> result.group() 'abc' using re.search : >>>

java - pass integer array from one class to another -

i having 2 classes. trying plot graph database values not able send value 1 class another, array being used. please go through code , me out. following class values of array present(right using static values) import java.util.arraylist; import java.util.hashmap; import java.util.list; import java.util.map; import org.achartengine.chartdemo.demo.chart.idemochart; import org.achartengine.chartdemo.demo.chart.temperaturechart; import android.app.listactivity; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.listview; import android.widget.simpleadapter; public class chartdemo extends listactivity { double = 10; double pass[] = { 7, 0, 4, 8, 3, 5, 7, 6, 8, 19, 11, 4 }; intent intent; private idemochart[] mcharts = new idemochart[] { new temperaturechart() }; private string[] mmenutext; private string[] mmenusummary; /** called when activity first created. */ @overrid

Adding spinner to ActionBar in Fragment(Not Navigation Listener) -

i want display spinner in action bar(not in activity,in fragment).for did below things step-1 (spinnermenu.xml) `<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menusort" android:showasaction="ifroom" android:actionlayout="@layout/spinner"/> </menu>` step-2 (spinner.xml) <spinner xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="70dp" android:layout_height="wrap_content" /> step-3 (code) public class extends fragment{ arraylist<string> spinnerlist; arrayadapter<string> spinneradapter; @override public void oncreate(bundle savedinstancestate) { sethasoptionsmenu(true); super.oncreate(savedinstancestate); } @override public void oncreateoptionsmenu(menu menu, menuinflater inflater) {

xml - Using String Variables inside StreamingMarkupBuilder().bind{} in Groovy -

for below code : def writer = new stringwriter() writer = new streamingmarkupbuilder().bind { project(){mytag('help me')} } println(writer.tostring()) output be: <project><mytag>help me</mytag></project> now if have "mytag('help me')" in above code string var , want use shown below def teststring = "mytag('help me')" def writer = new stringwriter() writer = new streamingmarkupbuilder().bind { project(){out<<teststring} } println(writer.tostring()) output getting is: mytag('help me')<project></project> expecting: <project><mytag>help me</mytag></project> am new groovy,anybody me proper implementation or find mistake above case ? please let me know if had use other class other streamingmarkupbuilder , xmlmarkupbuilder ? note in actual scenario me text variable contains lot more of child nodes nested . you this; wrap node string { -> } , eva

How can I make my own android SDK for ads? -

i know question insufficient. totally confused create new android sdk ads. how can create own sdk ads madserve,mopub,admob etc. want track user install, clicks, etc server.when developer integrate , can access ads 2 or 3 line codes.i want load own ads page. how can make such android sdk, please suggest tutorials or sample codes, new android . thanks! go mopub , @ sdk. admob made sdk open... no small task @ all. whether these depends more on server , ad serving architecture. there many, many layers of complexity publicly available sdks should @ least see how companies have approached it. (e.g. ad formats, sizes, interstitials, types, polling, filling rules, requests, location requirements, caching policies, serving verification, app identifiers, maturity rules, targeting requirements, etc.) a similar question might "how can build app twitter? seems easy enough if had tutorial..."

Error in Context in Android? -

i wrote simple 1 line context of application in android. there nothing else except new project 1 activity. i wrote code in oncreate method. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); context context = getcontext(); } it asks me replace getcontext getbasecontext. why can't use getcontext present? please make understanding clear on android context- getcontext() or view.getcontext(): returns context view running in, through can access current theme, resources, etc. getapplicationcontext() or activity.getapplicationcontext(): application context associated applicaition , same throughout life cycle. context.getbasecontext(): should not used use context instead of associated activity , possible destroyed when activity destroyed. and please have on this blog-post avoid android context related memory leak problem. (you may come across many need ch

visual studio 2010 - How to enable MSMQ programatically in C#? -

i have server request queue , client responsive queue. want install msmq pragmatically on client on server machine i.e. not manually going server manager/add window's features. please in regard. you can start dism.exe /online /enable-feature /featurename:msmq-server /all as process using: system.diagnostics.process.start() if need aditionally msmq features, can find list doing: dism.exe /online /get-features | find "msmq" which gives like: feature name : msmq-container feature name : msmq-server feature name : msmq-triggers feature name : msmq-adintegration feature name : msmq-http feature name : msmq-multicast feature name : msmq-dcomproxy feature name : wcf-msmq-activation45

Javascript code editor for edit html of page by user to create template and custom the page -

Image
i need editor html tags, want make next developer edit pages online, so, editor highlighter tags feature , intellisense needed. this: http://www.cdolivet.com/editarea/editarea/exemples/exemple_full.html but format , intellisense features. i found editor, great , powerful. http://ace.c9.io/

javascript - increase descrease font size with line height using jquery -

i want jquery code increase or descrease font. tried codes not running well. here link of demo (am first time using fiddle please can set needed) i have different sizes font here, @ time of increasing font size makes font of same size.so how fix that? my code: <div id='contents'><div><strong>lorem ipsum</strong> dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy <div><font face="comic sans ms" size="5" color="#c2c2c2">text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has survived not </font></div><font face="comic sans ms" size="5" color="#c2c2c2"> 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum </font>passages, , more desktop publishing software <font size

asp.net mvc - Why my session in the view control is null -

hello i'm trying make simple online magazine , part when user clicks addtocart button my model cart holds 2 properties - product , quantity public class cart { public productlanguages product { get; set; } public int quantity { get; set; } } so in basketviewmodel in addproducttocart method, add product details database in property of type list. save list in session. , if, example, user clicks 'continue shop' button , returns index page - next time when presses 'addtocart' new product see make check lstcarts = (list<cart>)httpcontext.current.session["cart"]; if (lstcarts==null) { lstcarts = new list<cart>(); } first, try list session can saved products. session null lose purchased products. curious thing i'm sure saved list of products in line httpcontext.current.session["cart"] = lstcarts; here viewmodel public class basketviewmodel { p

php - Different Output of TCPDF in Firefox and Chrome -

i have question you. i've created tcpdf using php, when printed out output using chrome browser , works great, when printed out using firefox of words came out @ top of page. there possible way fix this? thank you. i've solved problem. it's browser issue m.eskandari correct. i've re-installed firefox , works great thank people responded query.

gtk2hs - Gtk widget for text -

sorry stupid question, i'm newbie in gtk. want build gui interface gtk2hs, contain lot of text (non editable) different formatting options each piece of text. there gtk widget, designed purpose? kind of widgets appropriate this? you should use gtktextview widget has been set non-editable. if text not overly long (a couple of short paragraphs) can use gtklabel , if length or number of paragraphs big measuring text start become performance issue.

datetime - JavaScript clock based on TimeAPI -

i want create javascript clock based on timeapi.org . reason want make sure client-side has exact same time server. in svclock(json) saves year/month/day/hour/...etc in vars when i'm trying put vars in sethours in clock fucnction clock's format becomes this: 1391670641381:1391670761381:1391670727381 instead of 15:27:06 . is there easier way this? <html> <head> <script> var svtime,svyear,svmonth,svdate,svday,svhour,svmin,svsec,newtime; function svclock(json) { svtime=new date(json.datestring); svyear=string(svtime).substr(11,4); svmonth=string(svtime).substr(4,3); svdate=string(svtime).substr(8,2); svday=string(svtime).substr(0,3); svhour=string(svtime).substr(16,2); svmin=string(svtime).substr(19,2); svsec=string(svtime).substr(22,2); newtime=svhour+':'+svmin+':'+svsec; //newtime=svyear+'/'+svmonth+'/'+svdate+'('+svday+')'+' '+svhour+':'+sv

iphone - iOS how to create scale view -

how create view changed scale when button pushed. when push "x" of small view, view changed big view animation. when push "x" of big view, view changed small view animation. and, anytime can click "b" viewed on each view. how create view? small view |bbbbb| |bbxbb| big view |bbbbb| |bbbbb| |bbbbb| |bbbbb| |bbxbb| - (ibaction)buttontapped:(id)sender { [uiview animatewithduration:0.5 animations:^{ uiview *view = (uiview *)sender; view.frame = cgrectequaltorect(view.frame, small_rect) ? big_rect : small_rect; }]; }

.htaccess - WordPress on add-on domain -

i have installed wordpress on add-on on bluehost. addon domain linked sub-folder of main domain ftp, called addondomain-folder . when go addondomain.com, wp site displays ok. problem wp-admin panel. panel displays incorrectly, has broken links images , stylesheets , can not access area redirected to: addondomain.com/addondomain-folder/wp-admin/... instead of addondomain.com/wp-admin/ i have checked wp-options table in database , both siteurl , home set addondomain.com any solutions stop wp-admin thinking in subfolder? ok, problem hidden .htaccess file messed up.

Xpath / Find all attributes which start with specific pattern -

i want find elements there attributes start x . for example, <a xt="1"> text1 </a> <a xu="2"> text2 </a> <a text1="3"> text3 </a> the xpath find first 2 elements, because contains attributes name xt , xu , respectively. text1 attribute doesn't start x , , not it. i try start-with() function, understood find values, , not attributes. i use: //*[@*[starts-with(local-name(),'x')]] similar other answer, uses local-name() instead. check attribute name , not namespace prefix. for example, if use local-name() following matched because prefix starts x ... <a xns:text1="3" xmlns:xns="xns"> text3 </a> if use local-name() , not match because local name of xns:text1 text1 .

listView items disappears on scroll for android 2.3 -

Image
on load of fragment. after scrolling smoothly data appears. again disappera android list view on scroll content gets invisible 2.3. working fine 4.0 , above. problem when scroll listview data gets disappear , images shown only. if scroll smoothly , tap 1 or 2 sec. on list data shown on scroll data gets disappear. below adapter code - public class restaurantlistadapter extends baseadapter { private arraylist<restaurantlist> restaurantlist; private layoutinflater inflater; private imageloader imageloader; private context context; private viewholder viewholder = null; displayimageoptions options; public restaurantlistadapter(activity activity, arraylist<restaurantlist> restaurantlist) { this.context = activity; this.restaurantlist = restaurantlist; this.inflater = layoutinflater.from(this.context); imageloader = imageloader.getinstance(); options = new displayimageoptions.builder().

plot - Axes like wblplot when plotting X and Y in Matlab -

i want plot series of x , y coordinates axes produced wblplot. how can achieve that? can't use wblplot. http://www.mathworks.se/help/stats/wblplot.html use semilogx scale x axis logarithmically or usual plot change property set(gca, 'xscale', 'log'); change ticks , grid line spacing set(gca, 'ytick', vectorofyvalues); set(gca, 'ygrid', vectorofyvalues); more on axes properties in documentation .

how to pass a list of SQL Server tables into List Box in Excel and use it -

Image
i have made report file in excel analysts check data every morning. how looks now: where button's script following: sub button6_click() dim qt querytable sqlstring1 = "select * dbo.reportunits order productid, countrycodeid" activesheet.querytables.add(connection:=getconnectionstr2, destination:=range("a3"), sql:=sqlstring1) end end sub private function getconnectionstr2() 'driver={sql server}; getconnectionstr2 = "odbc;driver={sql server};" & _ "database=em_countryconsumer;" & _ "server=555.555.55.15;" & _ "uid=user;" & _ "pwd=password;" end function what have additional list box list of report tables in sql server database. in example dbo.reportunits table, there more report tables , creating automatically every day. to give analysts chance choose table name. , show data pre

symfony - No Scopes Specified - Google_Auth_Exception -

i applying this tutorial symfony 2.4, i've finished setup in config.yml , everything, managed visit admin/google/analytics page, problem when tried authenticate parameters i've created in config.yml file, searching scope, here parameters. happy_r_google_analytics: host: www.example.com profile_id: myprofileid tracker_id: ua-tracker-id token_file_path: %kernel.root_dir%/var/storage happy_r_google_api: application_name: project default service account oauth2_client_id: oauthclientid oauth2_client_secret: oauthclientsecret oauth2_redirect_uri: http://www.example.com/app_local.php/admin/google/analytics/oauth2callback developer_key: developperkey site_name: http://www.example.com i think there's no problem here, i've got no idea can set scope google api client can set https://www.googleapis.com/auth/analytics.readonly you need define scope. if use google auth, check authorization scopes it. you must like: $

symfony - How to use a global config value in a private config file with symfony2 -

i defined values in define.yml in app/config folder. , can access in php code. want use validate.yml file check weather users give out many data, use configed valus in config file(such %maxinputlength%) rather write 1 more time in validate.yml? for example: defind variable in define.yml: maxlength: 10 can use in controller. but if want use in validate.yml in own bundle, such : mybandle/config/validation.yml use file that: mybundle\entity\userdesc: properties: content: - notblank: ~ - maxlength: 10 so seems same value defined @ 2 place.in fact 10 in second file value defined in first file . don't know how value first file.is there way make that? afaik want set value variable in 1 config file , reuse in other .yml config file. so cant define vars in e.g variables.yml file parameters: test_variable: "blabla" then in second .yml config file can import file defined variables: imports: - {

javascript - Add removeClass function in my Jquery -

i've been stuck problem more week -_-. need add removeclass function in jquery validation below. in bid , rfq validation add removeclass. i have dropdown , 2 textbox (rfq , bid), when select bidding in dropdown bid textbox hide. problem when tried submit validation requirements comes out bcoz textbox bid doesn't have value. tried add removeclass function in textbox depends on dropdown value. this working fiddle http://jsfiddle.net/mhck7/4/ part of validation jquery if (bid == "") { $("span.val_bid").html("this field required.").addclass('validate'); validation_holder = 1; } else { if (!bid_regex.test(bid)) { // if invalid phone $("span.val_bid").html("integer allowed!").addclass('validate'); validation_holder = 1; } else { $("span.val_bid").html(""); } } if (rfq == "") { $("span.val_rfq").html("this field