Posts

Showing posts from February, 2010

node.js - Sails.js: Page specific .less files -

i have "page specific" .less file in project need reference in particular view. reason cannot add importer.less i having hard time making work. for example, adding <link rel="stylesheet" href="/styles/homepage.css"> directly homepage.ejs , browser returns 404 not found since homepage.less not being compiled , copied on .tmp directory. thanks lot looking this. create assets/styles/home.less file home specific styles. notice file can @import "importer.less" reuse default styles than add home.less less task in tasks/config/less.js follows: grunt.config.set('less', { dev: { files: [{ expand: true, cwd: 'assets/styles/', src: ['importer.less','home.less'], dest: '.tmp/public/styles/', ext: '.css' }] } });

java - Mechanical Turtle "graphics", out of bounds exception -

thank taking time me learn what's wrong code , troubleshoot it. i'm not looking me , wish understand wrong , if have suggestions code please feel free make them if explain me. can't submit code don't understand. i having issues out of bound exception. below brief synopsis of assignment. post driver, class (my code) , output file example (we required use driver without changes initial code, per assignment). also mute majority of code once solved prevent others using directly (copy / paste) in future assignments if instructor or decides exact project when creating turtle, place in middle of room, pen down, , facing right. more 1 turtle can placed in same room @ same time. initialize room blanks , keep track of each turtle, position , direction, state of pen @ times. the class (my code) class turtle { boolean penstatus; //pen status true = down, false = int xpos, ypos; //x position , y position of turtle (x = height,

Grails Spring jar dependency with Atmosphere plugin -

i running dependency issues with atmosphere plugin. using grails 2.3.6 getting following error on server start up 2014-04-20 01:21:44,262 [localhost-startstop-1] error context.grailscontextloader - error initializing application: org.springframework.beans.factory.annotation.injectionmetadata.needsrefresh(lorg/springframework/beans/factory/annotation/injectionmetadata;ljava/lang/class;)z message: org.springframework.beans.factory.annotation.injectionmetadata.needsref resh(lorg/springframework/beans/factory/annotation/injectionmetadata;ljava/lang/ class;)z to me seems dependency problem, unable pin point specific jar/s ran on dependency report couldn't make out real issue. any idea ??

How to upload images from asp.net application to image server? -

i have 2 servers.one web app , images storage .i have no idea how upload images web app image server. webservice or ftp or others? if have sql server instance running on [image server], can't use database running beneath ? you'll need public ip address in order access server. make sure can connect db other sql server management studio. but security reasons, recommend build web service/api & configure on image server, serves requests made webapp.

python - Cannot run Hello World Open -

i competing in hwo2014 , yet cannot run bot. here build file provided with, alongside run file: build: #!/bin/bash virtualenv env --no-site-packages --distribute source env/bin/activate run: #!/bin/bash source env/bin/activate python main.py "$@" however, when run ./build on mingw terminal, following error reported: ./build: line 3: virtualenv: command not found ./build: line 5: env/bin/activate: no such file or directory what error mean? how prevent it? you need install virtualenv on machine. run file bash script saying go newly created virtual environment before running python script. more info can found on the official virtualenv docs.

ios - Animation does not origin from where I want it to? Why? -

i'm doing countdown clock game. want numbers animated come middle of screen , fade away in middle. when run code come right bottom of screen instead of specified (160,284). problem be? } else if (startgameeveryint == 3) { uiimageview *object = [[uiimageview alloc] initwithframe:cgrectmake(160,284,280 ,280)]; [object setimage:[uiimage imagenamed:@"1.png"]]; [self.view addsubview:object]; [uiview animatewithduration:1 animations:^{ object.alpha = 0; object.frame = cgrectmake(160, 284, 50, 50); } completion:^(bool finished){ startgameeveryint = 0; [startgametimer invalidate]; startgametimer = nil; [self startit]; (uiview *view in self.view.subviews) { if (view.tag > 10) {

css - how to stop other divs from animating using javascript? -

i having problem in stopping other divs animating. making square blinking divs everytime add other divs don't need animate , animate well. this code : javascript var fadeintime = 500; var fadeouttime = 1000; $(document).ready(function(){ setinterval(anim, 50); }); function anim(){ var rand = math.floor((math.random()*$("body").children("div").length)); var el = $("body").children("div")[rand]; $(el).animate({opacity: "0.7"}, fadeintime); $(el).animate({opacity: "0.1"}, fadeouttime); } html <div class="squares1"></div><div class="squares2"></div><div class="squares3"></div><div class="squares5"></div><div class="squares3"></div><div class="squares4"></div>... many squares want css body { background-color:#222; line-height:0; overflow:hidden; padding:0; margin:

amalgamating bash code blocks to give choices -

i have 2 blocks of bash-code want amalgamate. first checks see if have "get-iplayer/get_iplayer" installed , if not prompts installed - if [[ -x "/usr/bin/get-iplayer" ]] player="/usr/bin/get-iplayer" elif [[ -x "/usr/bin/get_iplayer" ]] player="/usr/bin/get_iplayer" elif [[ -x "/usr/local/bin/get_iplayer" ]] player="/usr/local/bin/get_iplayer" else echo "$0: error: 'get-iplayer' or 'get_iplayer' not installed. please install it." >&2 exit 1 fi i want add in ability choose 1 use, have 3 of them installed want use 1 @ /usr/local/bin, - { read -n1 -p "$(tput setaf 5) get-iplayer = a, get_iplayer = b, new get_iplayer = c, quit = q? [a/b/c/q] " abcq echo; echo "$(date +%y-%m-%d\ %h:%m:%s) answer: $abcq" >> $log case "$abcq" in [a]* ) /usr/bin/get-iplayer & echo;;

Font changes (but shouldn't) when switching to other split subwindow in emacs -

in .emacs, i've set larger font kanji, want retain smaller font hiragana , katakana: (set-fontset-font "fontset-default" 'han "sazanami gothic:size=18") (set-fontset-font "fontset-default" '(#x3000 . #x30ff) "sans") that works when loading files etc. when use horizontally split window, , switch other subwindow, font of hiragana in subwindow i'm leaving changes large font. because unicode ranges overlap, , order of definitions not respected? how should correctly specify ranges, i.e. can exclude range 'han, or need hunt down definition of 'han , correct ranges manually? in general, fonts such buffer background , buffer foreground changed globally -- either on per frame basis or frames -- not on per buffer or per window basis. following 2 examples of how affect 1 buffer: (defun buffer-background-red () (interactive) (setq buffer-face-mode-face `(:background "red")) (buffer-face-mode 1))

c - main not recognizing my function -

#include <stdio.h> #include <stdlib.h> void reverse(char* lines[], int count) { (int = count-1; >= 0; i--) { printf("%s", lines[i]); } } . #include <stdio.h> #include <string.h> #include <stdlib.h> #include "sortutil.h" #include "reverse.h" int getarray(char *lines[]); void printarray(char *lines[], int max); int main(int argc, char* argv[]) { char* arr[100]; int numlines = getarray(arr); printf("there %d lines\n", numlines); printarray(arr, numlines); (int = 1; < argc; i++) { if (strcmp(argv[i], "-s") == 0) { sortutil(arr); printarray(arr, numlines); } if (strcmp(argv[i], "-r") == 0) { reverse(arr, numlines); printarray(arr, numlines); } } } int getarray(char *lines[]) {

Merge 2 Adapter , and show it in one listview android -

i'm looking way merge 2 adapters 1 listview , code show 2 adapter in 2 listview , there possibility merge ? not_choose.clear(); arraylist<dec_all> = this.notchoose(); (int = 0; < a.size(); i++) { int tidno = a.get(i).getid(); string name = a.get(i).getname(); dec_all cnt = new dec_all(); cnt.setid(tidno); cnt.setname(name); not_choose.add(cnt); } dbhandler.close(); gtpadapter = new not_chooseadapter(this, r.layout.not_choose_listrow, not_choose); i_choose.clear(); arraylist<dec_all> b = this.ichoose(); (int = 0; < b.size(); i++) { int tidno = b.get(i).getid(); string name = b.get(i).getname(); dec_all cnt = new dec_all(); cnt.setid(tidno); cnt.setname(name); i_choose.add(cnt); } dbhandler.close(); gtadapter = new i_chooseadapter(this, r.layout.i_choose_listrow, i_choose); lvdata_one.setadapter(gtadapter); //listview 1 lvdata_two.setadapter(gtpadapter); //list view 2 thanks advice

objective c - How to calculate number lines required for text -

i know going stupid daft simple question i'm going round in circles. i have several strings want displaying in uitableview. of these strings long. have asked how calculate cell height, , choose following answer: - (cgfloat)cellheightforrowatindexpath:(nsindexpath *)indexpath { nsstring *cellstring = <your model object>; nsdictionary *attributes = @{ nsfontattributename : [uifont systemfontofsize:16.0f] }; nsmutableattributedstring *attributedstring = [[nsmutableattributedstring alloc] initwithstring: cellstring attributes:attributes]; cgfloat width = self.tableview.frame.size.width - 32.0f; cgrect frame = [attributedstring boundingrectwithsize:cgsizemake(width, maxfloat) options:nsstringdrawinguseslinefragmentorigin context:nil]; // add padding height cgfloat height = frame.size.height + 16.0f; return ceil(height); } - (cgfloat)tablev

html - How to give space or next line feature in javascript? -

Image
here java script code: function for_approve(){ var approve = confirm(format_stock_id.length + "&nbsp;stock record(s) selected approval.<br /> want send approval"); } it gives me result as: 3 &nbsp;stock record(s) selected approval.<br />do want send approval what should space , new line. use \n symbol: function for_approve(){ var approve = confirm(format_stock_id.length + " stock record(s) selected approval.\n want send approval"); } you can check right here. open console in browser , write: alert("bob\nbob"); example command: result: p.s.: same space. don't have use escape-query &nbsp; . use (simple space).

ios - CMStepCounter not providing step count -

i'm trying explore coremotion , i'm trying use cmstepcounter class step counts. here how implemented view controller stepcounts @interface viewcontroller () @property (weak, nonatomic) iboutlet uilabel *stepscountinglabel; @property (nonatomic, strong) cmstepcounter *cmstepcounter; @property (nonatomic, strong) nsoperationqueue *operationqueue; @end @implementation viewcontroller - (nsoperationqueue *)operationqueue { if (_operationqueue == nil) { _operationqueue = [nsoperationqueue new]; } return _operationqueue; } - (void)viewdidload { [super viewdidload]; if ([cmstepcounter isstepcountingavailable]) { self.cmstepcounter = [[cmstepcounter alloc] init]; [self.cmstepcounter startstepcountingupdatestoqueue:self.operationqueue updateon:1 withhandler:^(nsinteger numberofsteps, nsdate *timestamp, nserror *error) { [[nsoperationqueue mainqueue] addoperationwithblock:^{ [se

javascript - highcharts get all of the minimum points of the chart -

i have 10 series in chart. 1) how can find minimum point of series? 2) how can set chart's starting point red line? here fiddle : xaxis: { gridlinewidth:'1', gridlinedashstyle:'shortdot', tickinterval:1 }, yaxis: { gridlinedashstyle:'shortdot', }, tooltip: { shared: true, crosshairs:[{ width:1, color: 'black' }] }, credits: { enabled: false }, plotoptions: { area: { fillopacity: 0.3, pointstart:1, } } 1) can use loop on each series / , point , return correct value.

ajax - $.post into a php class function -

Image
i want make live username check , want use php function. --> <?php require '../../core/init.php'; ?> <!doctype html> <html lang="de"> <head> <meta charset="utf-8"> <title>k&ouml;ppcms - registrieren</title> <link rel="stylesheet" href="../../../css/style.css"> <script type="text/javascript" src="../../../js/jquery.js"></script> <script type="text/javascript" src="../../../js/footer.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#username").keyup(function (e) { //removes spaces username $(this).val($(this).val().replace(/\s/g, '')); var username = $(this).val(); //get string typed user $.post('users.php', {'username':usern

java - Hot to write a custom validator with apache bval -

i using bean-validation apache bval implementation. (i not want use hibernate-validation or oval, because have dependencies.) first question: bval still maintained or orphaned? second question: possible implement custom validators using bval? e.g. need validator file field validates, file exists, isreadable , file. apache bval afaik compliant bean validation 1.0 means should able write portable custom constraints. however, bval not yet bean validation 1.1 compatible, meaning won't have executable constraints. i don't know how active development atm. last release in september 2012 quite while back. what concern hibernate validator or oval dependencies?

javascript - How to disable(complletely) and enable any mouse listener in jQuery? -

i have strange question: how disable mouse events(mousewheel, click, hover etc.) on button click , after timeout, example 1s, enable them again? first i've tried unbind/bind functions there strange bug scroll events on apple magic mouse. came this: $("* ... or selector").on("scroll click ...", function(){ return false; }); its'not pretty it's work. problem don't know how reenable events after 1s example? any ideas appreciated. you're using anonymous functions . if name function, can reinitialize event listener later: var mymethod = function () { // } $('my selector').on('my event', mymethod) as 1 second: timeout

Prevent Visual Studio from relinking when dependency change -

i have visual studio 2012 solution have several dll projects. maindll depends on smalldll. if make local change in smalldll - without changing exported api - small change in local function - maindll gets relinked. question 1: rational behind relinking maindll - smalldll not built maindll - picked @ runtime? if build smalldll, maindll works fine. if change smalldll's api, of headers change, of maindll's files have recompiled - relink justified, why relink local change? question 2: there way prevent such relinking? need dependency between maindll's project , smalldll's, when run maindll's project after making change smalldll, want smalldll rebuilt. thanks lot! in visualstudio 2008, check "build , run" options through "options" / "projects , solutions" / "build , run" / "on run, when projects out of date", , select "prompt build" or "never build". if choose not rebuild automaticall

cocoa touch - Stream from iOS to Server -

how go sending live audio stream server? can access raw pcm data being played iphone speaker , want allow others grab , stream url. sort of when access icecast stream url , starts grabbing stream. i clarify streaming ios device server, if type in url server start downloading ever stream on phone @ , if idevice wasn't streaming there nothing. see apple's documentation on output streams here note on ios must set nsoutputstream cfstream (then cast via toll-free bridging) so: cfreadstreamref readstream; cfwritestreamref writestream; cfstreamcreatepairwithsockettohost(null, (cfstringref)[website host], 80, &readstream, &writestream); nsinputstream *inputstream = (__bridge_transfer nsinputstream *)readstream; nsoutputstream *outputstream = (__bridge_transfer nsoutputstream *)writestream; other that, documentation gives necessary information–keep in mind pcm high bitrate, there might stream stuttering. i'm not sure framework you're using microph

Exposing Java Enums in the Rhino JavaScript engine -

i'm writing program incorporates rhino scripting engine. ale expose couple of program's enums, can't figure out how that, if it's possible. there way make java enum usable in scripts? do mean use java enum script, converted java rhino?. if case, like: given java class enum: package com.stackoverflow.example; public class order { private string field; private by; public enum { asc, desc } public order(string field, by) { this.field = field; this.by = by; } } and in script can do // importing class enum importclass(packages.com.stackoverflow.example.order); // instancing new order object using existing enum in order class var order = new order("db_field", order.by.desc); i hope helps.

java how to convert a string to net.sf.json.JSONObject -

i tweets , use org.json.simple api convert string object. jsonparser jsonparser = new jsonparser(); object json = jsonparser.parse(in); and insert obj couchdb using couchdb4j api session mydbsession = new session("localhost",5984) database mycouchdb = mydbsession.getdatabase("db-name"); document newdoc = new document(); document newdoc = new document(jsonobject json); mycouchdb.savedocument(newdoc); the error is: org.json.simple.jsonobject cannot cast net.sf.json.jsonobject how solve problem or can give solution insert json format string or object couchdb as error said, couchdb may use net.sf.json.jsonobject. i've found api in net.sf.json.jsonobject convert string json object: public static jsonobject fromobject( object object ) { return fromobject( object, new jsonconfig() ); } it's ok string cause else if( object instanceof string ){ return _fromstring( (string) object, jsonconfig );

ios - Core-Plot - get coordinates of parent view from x y values -

i have scatter plot , x,y values of point in plot. i'd add information on top of plot, can't seem parent view coordinates x y values. i've got following code question, values not correct : core plot: how present popover bar selected user i have cptgraphhostingview *hostview; located in uiview *statsview; nsdecimal plotpoint[2]; nsnumber *plotxvalue = [distancearray objectatindex:index]; plotpoint[cptcoordinatex] = plotxvalue.decimalvalue; nsnumber *plotyvalue = [altitudearray objectatindex:index]; plotpoint[cptcoordinatey] = plotyvalue.decimalvalue; cptxyplotspace *plotspace = (cptxyplotspace *)self.hostview.hostedgraph.defaultplotspace; // convert data coordinates plot area coordinates cgpoint datapoint = [plotspace plotareaviewpointforplotpoint:plotpoint numberofcoordinates:2]; // convert plot area coordinates graph (and hosting view) coordinates datapoint = [self.hostview.hostedgraph convertpoint:datapoint fromlayer:self.hostview.hostedgraph.plotareaframe

php - Sorting by a related table -

if this, booking::query()->with('vehicle') laravel generates 2 queries: select * `bookings` select * `vehicles` `vehicles`.`id` in (?, ?, ?, ?, ?, ?, ?, ?) can tell laravel left join instead can orderby on vehicles.name ? each booking has 1 vehicle, wouldn't generate records. i'm aware can db::table('booking')->leftjoin instead, doesn't populate models. there 2 things can do. first change query to: booking::leftjoin('vehicle', 'vehicle.booking_id', '=', 'booking.id')->get(); // or whatever fields the other sort collection after results. there example in documentation. check here : http://laravel.com/docs/eloquent#collections hope helps

string - Confusion in file functioning and append function using Python -

i have 2 questions exam. t2=("a","b","hello") alist=["barney",["wilma"]] print(alist[1].append(t2)) answer: none i thought [“wilma”,(“a”,”b”,”hello”)] and file has: james,8,9 sonia,7,6 clark,4,5 code: endofprogram=false try: infile=open("names.txt",”r”) except ioerror: print("error reading file") endofprogram=true if endofprogram==false: line in infile: line.strip('\n') alist=line.split(',') print(alist) answer ['james','8','9\n'] ['sonia','7','6\n'] ['clark','4','5\n'] why '\n' still there? lastly: def change(alist): alist=alist.pop() alist.append(5) return def main(): mylist=[1,2,[3]] change(mylist) print(mylist) main() answer: [1,2] why answer? shouldn't [1,2,5] ? list.append in-place operation, modifies li

ios - Remove unused resources from XCode project -

i working on ios application , in application have big changes in app design every day code of application going touch 200 mb. in code have big numbers of unused images available. want remove images xcode project can reduce project code size. i had used scripts thats given on stackoverflow.com found script removing used images thats not reliable. had used app named "slender". trial version cant use more. so please 1 suggest me effective way (any application) remove unused images xcode project. unused find unused resources in xcode project https://github.com/jeffhodnett/unused

how free text search works in postgresql -

i working on project in have implement free text using postgresql database, not able understand how can work using @@ instead of command. i have table employee - id - name - location - managername //my query select * employee name @@ 'xxx' i searching on name free text , gives result, can nay 1 tell me index or search catalogue, didn't made , configuration etc still working. any chance postgresql tables or created catalogue on runtime? can 1 tell me how works? what's happening if @ operators defined @@ you'll see there few variants different data types. they're overloads same operator. regress=> \do @@ list of operators schema | name | left arg type | right arg type | result type | description ------------+------+---------------+----------------+-------------+------------------------------ pg_catalog | @@ | text | text | boolean | text sea

sql - Updating NULL Field vs Most Recent Record -

i have table contains null field. needs populated table. while statement getting information other table simple concerned performance of update. the update done script scheduled run every 30 minutes. which better: update using field null statement update table1 set freefield=(select name table2 table1.keyfield=table2.field) freefield null; update using statement updates last x records update table1 set freefield=(select name table2 table1.keyfield=table2.field) rowid in ( select rowid ( select keyfield table1 order keyfield desc ) rownum < 300 ); table1.keyfield , table2.field indexed , have primary/fk relation. table1.freefield , table2.name not indexed , text fields. currently table 100k record grow massively. i'm asking going take longer search null fields in table or order , use recent number specified. the final plan implement trigger records updated @ creation cannot implemented until next release of

c++ - Why do I have to access template base class members through the this pointer? -

if classes below not templates have x in derived class. however, code below, have to use this->x . why? template <typename t> class base { protected: int x; }; template <typename t> class derived : public base<t> { public: int f() { return this->x; } }; int main() { derived<int> d; d.f(); return 0; } short answer: in order make x dependent name, lookup deferred until template parameter known. long answer: when compiler sees template, supposed perform checks immediately, without seeing template parameter. others deferred until parameter known. it's called two-phase compilation, , msvc doesn't it's required standard , implemented other major compilers. if like, compiler must compile template sees (to kind of internal parse tree representation), , defer compiling instantiation until later. the checks performed on template itself, rather on particular instantiations of it, require compiler able resolve

javascript - Mime type for archive -

i trying upload archive file taken through <input type=file> in html, calling servlet using javascript. in javascript trying mime type of it, giving type ""(means empty). how can identify whether archive? looks there isn't 1 mime type archives, each have own (if have 1 @ all). have this wikipedia article more info.

c++ - Boost property tree: Remove a nested node -

suppose have following tree: boost::property_tree::ptree tree; tree.add("1.2.3", "value-1"); tree.add("1.2.3.4", "nested-value"); tree.add("1.2.3", "value-2"); tree.add("1.2.33", "other-value"); which has following serialized info form: 1 { 2 { 3 value-1 { 4 nested-value } 3 value-2 33 other-value } } is there method remove nodes having provided (possibly nested) path? i.e.: remove(tree, "1.2.3"); boost_assert(!tree.get_optional<std::string>("1.2.3") && !tree.get_child_optional("1.2.3")); with result info form: 1 { 2 { 33 other-value } } looking @ ptree docs , source code i've found several methods remove immediate children of tree (nested children not accounted). also, there several methods subtree it's full path (even if nested). since th

Get image name from database in laravel -

i have database, columns image , alttag. want use them in laravel blade view. try this: {{ html::image('images/{{ $item->image }}', $alt="{{ $item->alttag }}") }} but syntax isn't correct. if echo image , alttag this: <h1>{{ $item->alttag }}</h1> then correct. wonder wrong in code. you used blade syntax in php string. watch compiled blade templates see did go wrong. in short. try this: {{ html::image('images/'. $item->image, $alt = $item->alttag) }} or equally short: {{ html::image("images/{$item->image}", $alt = $item->alttag) }}

Wordpress Validate New Nicename/Slug -

i have written custom "edit account" script allows wordpress user update wordpress account. working great, except can't seem find way update user's nicename, doubles user's url slug (via get_author_posts_url function). causing issues because when user changes name, slug still contains original name - not new one. i know sanitize_title function generate new nicename, don't know how verify unique , modify if not before entering db. wondering built-in functions wordpress has handle this. know can write own script this, rather use wordpress functions. couldn't find anywhere in wp documentation. thanks! here function have written in lue of built in function: function new_user_slug($string){ //generate new slug $slug=sanitize_title($string); //make sure slug unique $result=mysql_query("select * wp_users user_nicename='$slug'"); if(mysql_num_rows($result)==0){ return $slug; }else{ $counter=2; $ki

javascript - Collapse with only one item opened not working in AngularJS -

i'm attempting customize collapse in app. i've tried accordion plugin comes angularjs ui bootstrap, rather complex, need 2 links side side , collapsing elements opening in row under, i've decided include transition.js , collapse.js bootstrap. so far code looks this: <div class="logo" id="accordion"> <a data-parent="#accordion" data-toggle="collapse" data-target="#login"> log in </a> <a data-parent="#accordion" data-toggle="collapse" data-target="#signup"> sign </a> <div id="signup" class="collapse">dfkñfkldsklñfdsñlkfd ñlkdflkfdñlfsdñl ksfdlkfdslñsfdñl kfdkfkldl fdksñlfdklfdñksfd <div id="login" class="collapse">blablabla</div> </div> the collapse effect works perfectly, far haven't been able accomplish "only 1 item opened @ time

php - Program not displaying correct data -

Image
i program post highest scoring student in corresponding year, meaning in place "topper 2012: " should post student highest score in year only, along students scores rest of years(does not matter if did not highest score in other years, should based on specific year). in last row "overall topper: ", should display best student overall. note: post "topper 2011: " section, not based on highest score. not posting rest of years after 2011. code: <body> <form> <?php $username = "amar"; $password = "amar"; $hostname = "localhost"; $database = "study"; $set = array('2011' => 0, '2012' => 0, '2013' => 0, '2014' => 0, 'final' => 0, 'final_grade' => 0); $mysqli = new mysqli($hostname, $username, $password, $database) or die("unable connect mysql");

sql - Connection string not working in C# windows application -

for reasons, unable establish data connection using connection string. doing below code var connectionstring = configurationmanager.connectionstrings["connection"].connectionstring; sqlcommand cmd = new sqlcommand(); sqlconnection con = new sqlconnection(connectionstring); cmd.connection = connectionstring; cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = " dbo.selectall"; sqlparameter param = new sqlparameter("@tradedate","201401"); param.direction = parameterdirection.input; param.dbtype = dbtype.string; cmd.parameters.add(param); but reasons when initializing connection property command using cmd.connection = connectiostring , is throwing exception follows cannot implicitly convert type 'string' 'system.data.sqlclient.sqlconnection' you're confusing connection string needed connect database , actual sqlconnection. try (for specific code): cmd.connection = con; according msdn

r - How do I add an existing image when using pander's live report generation? -

i sadly using windows 7, problem... i want add existing image file pander report, using live report generation on windows platform, outputting docx: library(pander) setwd("t:/r/temp") #this contains subfolder & file /plots/temp.png myreport = pandoc$new(author="jerubaal",title="where's picture?", format="docx") myreport$add.paragraph("there should picture after this.") myreport$add(pandoc.image("/plots/temp.png")) myreport$add.paragraph("there should picture before this.") myreport$export() alas, there no image included when running in windows (not in md file). it doesn't work if try putting code straight in: myreport$add("![](/plots/temp.png)") if try this: myreport$add("![/plots/temp.png](/plots/temp.png)") i text path: /plots/temp.png any suggestions? fyi: time ago, trying out ggplot, got work in ubuntu: earlier question this report generated r (3.0.3) , pa

Meteor won't start, npm shrinkwrap fails -

so i'm trying run a simple boilerplate app , start meteor => started proxy. => meteor 0.8.0.1 available. update project 'meteor update'. => started mongodb. npm: updating npm dependencies -- async, xml2js... npm err! error: enoent, open '/users/whit/.meteor/tools/c2a0453c51/package.json' npm err! if need help, may report *entire* log, npm err! including npm , node versions, at: npm err! <http://github.com/isaacs/npm/issues> npm err! system darwin 13.1.0 npm err! command "/users/whit/.meteor/tools/c2a0453c51/bin/node" "/users/whit/.meteor/tools/c2a0453c51/bin/npm" "shrinkwrap" npm err! cwd /users/whit/programming/mrt2/meteor-bone/packages/npm/.npm/package-new-1767w7f npm err! node -v v0.10.25 npm err! npm -v 1.3.24 npm err! path /users/whit/.meteor/tools/c2a0453c51/package.json npm err! code enoent npm err! errno 34 npm err! npm err! additional logging details can found in: npm err! /users/whit/program

Android Activity not Responding -

i have 3 activities in app , when user press next button, next activity shown user, works fine except when reaches last activity i.e. when user presses next on 2nd last activity, error message shown app has stopped working , there no error in logcat, following .java file of final activity package com.example.first; import android.support.v7.app.actionbaractivity; import android.support.v7.app.actionbar; import android.support.v4.app.fragment; import android.content.intent; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.textview; import android.os.build; public class finalactivity extends actionbaractivity { textview name,address,phone,email,dob,matg,mati,interg,interi,graddeg,gradi,cgpa,skills; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentvi

emacs - Fine-tuning: `set-process-sentinel` | `set-process-filter` | `start-process` -

there few examples on internet involving 3 of functions @ issue in question -- i.e., set-process-sentinel ; set-process-filter ; , start-process . i've tried few different methods of fine-tuning the processes in effort force process number 1 ( push ) finish prior commencement of process number 2 ( push ). in of attempts, second process always runs , finishes before have finished entering password process number 1. process number 2 has password stored in osxkeychain . the first method tried magit, both synchronous , asynchronous processes. second method tried using function while . . . search list of remotes in buffer containing said list. third attempt listed below -- uses list of remotes created @ outset of function , mapcar s down list push git. any ideas on how better control process number 1 ( push ) finishes prior commencement of process number 2 ( push ) appreciated. it not end of world process number 2 starts , finishes early, matter of learning how take c

javascript - Using define() in require.js -

i'm started learning using require.js main.js require(['jquery', 'underscore', 'module1'], function($, _, module1) { module1.init(); $('#output').html('hello world!'); }); module1.js define('module1', [], function(app) { var init = function() { alert('hello world!') ; } return { init: init }; }); it's working i'm wondering can change define('myapp', [] function(app){}); in module1.js ?, , modify main.js to require(['jquery', 'underscore', 'myapp'], function($, _, myapp) { myapp.init(); $('#output').html('hello world!'); }); please help, can understand more using require.js. thanks. edited with below answer, i've modified coding to module1.js define('myapp', [], function(app) { var init = function() { alert('hello world!') ; } return { in

javascript - Precise decimal multiplication (js-assessment) -

i working on js-assessment numbers.js exercise. thought should multiply decimal numbers ten power number of digits (e.g. 0.22 -> 0.22*10^2 = 22) precise decimal multiplication in js. solution test. i checked solution proposed author of test , can't figure out how algorithm working. here code: function adjust(num) { var exponent, multiplier; if (num < 1) { exponent = math.floor( math.log(num) * -1 ); multiplier = math.pow(10, exponent); return { adjusted: num * multiplier, multiplier: multiplier }; } return { adjusted: num, multiplier: 1 }; } what proof math.floor( math.log(num) * -1 ) is enough exponent?