Posts

Showing posts from May, 2010

mysql - SQL injection on fixed value? -

i'm aware if you're inserting variable, use mysqli_real_escape_string. but, if i'm inserting fixed value not variable, need use function? for example, syntax below. insert name variable, , value '1' status column. safe avoid sql injection column status? since not variable. "insert customer(name, status) values ('".mysqli_real_escape_string($conn, $name) ."', '1')"; when using mysqli, safest use prepared statements: $stmt=$mysqli->prepare("insert customer(name, status) values (?, '1')"; $stmt->bind_param("s", $name); (see http://php.net/manual/en/mysqli.quickstart.prepared-statements.php more detailed , working code). in can leave static values is, nobody can replace those. can alter table: alter table customer alter column status default '1'; then not have set longer.

javascript - Access a var defined inside a closure from outside (i.e. the scope where the closure was defined) -

for background, playing through untrusted , javascript-based programming game core mechanic editing code modify game world progress forward. have solved levels "intended" way modifying variables given in local scope using documented in-game api. however, wondering if there "unintended" ways modify game state/game definition fishing around. a lot of game has code follows (evaluated in window scope): function foo() { var bar = 1234; } i understand can access foo scope referring window.foo . there way can access bar inside foo though not explicitly exposed? to clarify, above code evaluated me (in window scope, believe, can @ least reference foo ). can not change evaluated. (i suppose redefine foo if wanted, , bypass lot of restrictions, that's tangential current direction of questioning.) rather, goal is, given has been evaluated, modify in place (such setting new value bar ). thanks in advance! the short answer no . it's not

How to delete an entire row if it is all 0's in R -

if have data frame so 4 6 6 0 4 5 0 0 6 5 0 4 4 4 but lot bigger, command can write delete row 0's, such row 4 in example. in end this 4 6 6 0 4 5 6 5 0 4 4 4 thanks! something this? df[apply(df[, sapply(df, is.numeric)], 1, function(x) !all(x==0)), ] or df[rowsums(abs(df[, sapply(df, is.numeric)])) != 0, ] example: > df <- data.frame(x=c(1, 2, 0), y=c(0, 1, 0), z=letters[1:3]) > df x y z 1 1 0 2 2 1 b 3 0 0 c > df[rowsums(abs(df[, sapply(df, is.numeric)])) != 0, ] x y z 1 1 0 2 2 1 b

c# - Getting all the items from the listbox winform -

good day! having troubles on getting items, selected or not, listbox. whenever click send button, items ones selected (this current results of code below: http://imgur.com/ja94bjm ). want items textbox not selected ones , not repeating. private void cmd_send_click_1(object sender, eventargs e) { (int = 0; < listbox1.items.count; i++) { try { string pno = textbox4.text.tostring(); string path = textbox5.text.tostring(); string name = textbox6.text.tostring(); string user = textbox7.text.tostring(); output.text += "\n sent data : " + pno + " " + user + " " + name + " " + path; } catch (exception ex) { wait.abort(); output.text += "error..... " + ex.stacktrace; } networkstream ns = tcpclnt.getstream(); string data = ""; data = "

ajax - json data not set in parent window after clicking a link from child window in java -

i using struts1 in java , database oracle 10g.i want set value in parent window in ajax when clicking link child window.here,json data retrieved not set in field.any solution???please me............ here jsp code------------------- function doclick(v1,v2){ var f = document.importletterofcreditbookingform; var v3=window.opener.document.importletterofcreditbookingform.lclimittypecode.value; var v4=window.opener.document.importletterofcreditbookingform.lcaccounttypecode.value; var v5=window.opener.document.importletterofcreditbookingform.lcbookingnumber.value; window.opener.document.importletterofcreditbookingform.customercode.value = v1; window.opener.document.importletterofcreditbookingform.customername.value = v2; /*f.action="/mybank/enterlcdetailslistofimportletterofcreditbooking.do"; f.submit();*/ $(document).on('click', function (){ $.ajax({ type:'get', url:'/mybank/enterlc

c# - Using Guid as an optional parameter gives 'parameter requires a value of type 'System.Nullable' -

i had linking model viewmodel in controller - seems work. here code: public actionresult techsearchknowledgebase([optional]guid? createdbyid, [optional]guid? categoryid, [optional]guid? typeid) { var model = db.knowledgebases.asqueryable(); if (createdbyid != guid.empty) { model = model.where(k => k.createdbyid == createdbyid); viewbag.createdby = db.users.where(c => c.userid == createdbyid).first().fullname; } if (categoryid != guid.empty) { model = model.where(k => k.categoryid == categoryid); viewbag.category = db.categories.where(c => c.categoryid == categoryid).first().categoryname; } if (typeid != guid.empty) { model = model.where(k => k.typeid == typeid); viewbag.category = db.roles.where(c => c.roleid == typeid).first().roledescription;

angularjs - How to set the `ng-include` path by dynamically? -

i have content 8 blocks in page. when user clicks on each, opening pop-up , showing same content there. have 8 popup contents separately. when each of block clicked making view true . according current view, change pop-up (include) content changed. not working. here pop-up : html: <div class='ng-modal' ng-if="modal.isopen"> <div class='ng-modal-overlay' ng-click='modal.hide()'></div> <div class='ng-modal-dialog' ng-style='dialogstyle'> <div class='ng-modal-dialog-content'> <ng-include ng-if="modal.board1" src="'../views/projectsummary/modals/{{currentview}}.html'"></ng-include> {{currentview}} //it works! </div> </div> </div> in controller setting : $scope.currentview = "board1"; so, html let load : '../views/projectsummary/modals/board1.html' click here

metadata - ActiveRecord::Reflections Adding personal meta data to Reflection -

hi have following model class tale < activerecord::base #todo model should created automatically based on structure attr_accessor :sex, :family, :me after_initialize @sex = nil @family = [] @me = [] end before_create self.joined = false true end has_many :tale_culture_joins has_many :tale_purpose_joins has_many :tale_book_joins has_many :tale_keyword_joins has_many :tale_character_joins has_many :tale_moral_joins has_many :tale_event_joins #todo grouping models unique single identifier can searched tag. these associations searching #todo need fix on query uniq results returned ... can added @runtime has_many :cultures, through: :tale_culture_joins, dependent: :destroy has_many :purposes, through: :tale_purpose_joins, dependent: :destroy has_many :books, through: :tale_book_joins, dependent: :destroy has_many :keywords, through: :tale_keyword_joins, dependent: :destroy has_many :characters, through: :tale_character_joins, dependent: :destroy has_many :morals, th

c# - Unable to determine the provider name for provider factory of type "System.Data.Sqlite.SqliteFactory" -

i want use sqlite entity framework in web api project, can't work well, here development enviroment. 1.visual studio 2013, .net framework 4.5 sqlite package version 1.0.97, installed below packages system.data.sqlite, system.data.sqlite.ef6, system.data.sqlite.linq entityframework 6.1.3 here exception got unable determine provider name provider factory of type 'system.data.sqlite.sqlitefactory'. make sure ado.net provider installed or registered in application config here webconfig <configuration> <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> </configsections> <entityfra

javascript - which would be the best way to implement movement? -

okay, slider should move in response user pressing mouse button down on thumb knob itself. thumb knob should move along track in response user moving mouse , should stop moving when user releases mouse. this code far not positive if should use document.onkeydown or use different function implement moving of grey slider inside limited box given? <style> div.parent-item { width: 400px; height:50px; margin: 25px; border-style: solid; border-width: 1px; } #knob { width: 50px; height:50px; background-color: grey; margin-left: 25%; } } </style> </head> <body> <h1>in chrome</h1> <form action="horizontal_form.asp"> <input type="radio" name="angle" value="horizontal" checked>horizontal <form action="vertical_form"> <input type=&

php - Codeception in Yii2, every test in a row consume more memory -

i trying test class using codeception in yii2 advanced template. , uses memory, when run tests. when run tests separately fast , don't use memory, take 10 mb, ok me. when run them all, every test in row uses more , more memory, , example 6 tests use 645mb together. i suppose don't clean memory somehow. how clean memory after each test? it happened after codeception update, 2.1. found problem. used codeception/specify blocks, deep cloned everything. i disabled cloning default, setting following in _bootstrap.php \codeception\specify\config::setdeepclone(false); more info can found in docs: https://github.com/codeception/specify#global-configuration

javascript - How to build a tree select box ui in jsp with js, bootstrap -

Image
first, trying build ui below. i have data below format ... {'id' : '0001', 'name' : 'products', 'parents' : '*'} i have tried <optgroup> not looks :< currently, not have idea how start this. to this, got several questions. what should call type of ui? (terminology) is there libraries implements spec? a sample code might great :d (it best if uses bootstrap, still great without bootstrap) thanks :d the term calling type of ui combotree i have applied jquery-easy-ui http://www.jeasyui.com/ caution : library build unwanted ui automatically, if need customize set !important css attributes.

apache - IE 11 shows "Page can't be displayed" on long running backend servlet processing -

i have servlet takes more 6 minutes complete operation. application hosted on weblogic 12c accessed via bigip f5 load balancer , apache server. apache uses wl_proxy communicate weblogic. whenever servlet called ie shows "this page can't displayed". turned on wl_proxy log on apache server , found following: exception type [read_timeout] (no read after 300 seconds) raised @ line 212 of ../nsapi/reader.cpp so added wliotimeout directive in wl_proxy.conf fixed 1 part of problem. still shows same error after 5 minutes, , time saw following error in wl_proxy log: fri jul 31 12:49:05 2015 <396114383469453> created new connection preferred server 'xxx.x.xxx.xxx/5096' '/getuseractivitiesreport.do?action=generatereport', local port:36249 fri jul 31 12:55:02 2015 <396114383469453> url::parseheaders: completestatusline set [http/1.1 200 ok] fri jul 31 12:55:02 2015 <396114383469453> url::parseheaders: statusline set [200 ok] fri jul 31 12:5

java - Need help to understand spring config files -

i studying existing spring mvc 3 project, while looking spring , context config files confused, please clear or suggest me if wrong. upadte root-context.xml file <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- root context: defines shared resources visible other web components --> <bean id="messagesource" class="org.springframework.context.support.reloadableresourcebundlemessagesource"> <property name="basenames"> <list> <value>classpath:messages</value> </list> </property> <property name="defaultencoding" value="utf-8" /> </bean> <bean id=&quo

bash - Replacing string in linux using sed/awk based -

i want replace this #!/usr/bin/env bash with this #!/bin/bash i have tried 2 approaches approach 1 original_str="#!/usr/bin/env bash" replace_str="#!/bin/bash" sed s~${original_str}~${replace_str}~ filename approach 2 line=`grep -n "/usr/bin" filename` awk nr==${line} {sub("#!/usr/bin/env bash"," #!/bin/bash")} but both of them not working. you cannot use ! inside double quotes in bash otherwise history expansion take place. you can do: original_str='/usr/bin/env bash' replace_str='/bin/bash' sed "s~$original_str~$replace_str~" file #!/bin/bash

hive - Why migrate from teradata to hadoop -

help me understand advantages of hadoop on teradata. why should migrate teradat hadoop. in applications have reports retrieving data teradata, reports slow because of millions of row data. will migrating hadoop resolve it? possible duplicate of hadoop vs teradata difference . the main advantage of hadoop system scalability commodity hardware . as pointed out @dnoeth in comments. teradata scales out similar hadoop. can scale out using expensive servers. hadoop systems can scale out using commodity hardware (more commonly available less expensive hardware). in pioneer days used oxen heavy pulling, , when 1 ox couldn’t budge log, didn’t try grow larger ox. shouldn’t trying bigger computers, more systems of computers. —grace hopper hadoop advantages fault tolerance provided part of system. graceful degradation, , data availability taken care of. individual nodes in cluster can vary in capacities. flexibility add/remove nodes cluster without shutting

java - Local variables and formal parameters with same name in c++? -

in java, class variables , formal parameters can have same name , class variable referenced "this" keyword. there similar in c++? example in java public class { private int x; public void setx(int x) { this.x = x; } } what looking this->

User created custom URL with Rails 4 -

on our website, i'd users able create own vanity/custom url marketing purposes (i.e. www.website.com/cakeparty2015 goes www.website.com/cake/party-supplies/2015-inventory ). this not custom user created page - it's existing page route to. new information custom url. i don't know if possible, know of way using rails have user can log in , create own vanity url, links, , have automatically re-route? to little clearer - i'd user fill out form containing: vanity url - actual url - and when submit form, newly created vanity url links actual url. i'd without having put every single custom url in route file. perhaps looking @ wrong. i'm trying figure out way url shortening possibly? you want use https://github.com/norman/friendly_id . you have slug field in model , can let users change it.

windows - unhide usb files batch commands -

i on windows 8.1. usb hidden file/folders. unhide them use attrib command . want run commands inserting usb. pl help. echo off echo please have patience!!! wait or minimise window!!! rem c:\script\unhide.bat @echo off /f "usebackq tokens=1,2,3,4 " %%i in (`wmic logicaldisk caption^,description^,drivetype 2^>nul`) ( if %%l equ 2 ( echo %%i usb drive. ) ) pause here got drive letter h. unable use drive letter , use following commands in usb. how can run below commands in usb. mean change drive, run attrib command in usb, delete unwanted files usb , see usb's contents. cd\ attrib -s -h -r /s /d del *.lnk del thumbs.db del desktop.ini del autorun.inf echo folders has been recovered!!! check folders , files dir pause exit @echo off setlocal enableextensions echo please have patience!!! wait or minimise window!!! rem c:\script\unhide.bat /f "skip=1 tokens=1-3" %%i in (' wmic logicaldisk "drivetype=2"

jquery - Finding which table row has the selected class so that it can be deleted -

i have this: $("tbody").on("click", "tr", function(e) { $(this) .toggleclass("selected") .siblings(".selected") .removeclass("selected"); }); which allows me select specific row , assign "selected" class. user has option click delete button on bottom of table delete row he's selected. thinking of, when user clicks delete button, iterate through of table rows , delete 1 selected tag, i'm not sure how this. there better way or can explain how done? since didn't provide html, i'm creating own table. css background color see table row 'selected' class <style> .selected{ background-color:#dddddd; } </style> generic table , button <table> <tbody> <tr> <td>sunday</td> <td>01</td> </tr> <tr> <td>monday</td> <td>02</td> </tr> <tr> <td>tuesday<

ios - Swift error: Could not find an overload for '==' that accepts the supplied arguments? -

this question has answer here: check network status in swift, not find overload '~=' accepts supplied arguments 2 answers actually iam checking internet connection in code , weird error "could not find overload '==' accepts supplied arguments" here code snippet, override func viewdidload() { super.viewdidload() checkknetworkstatus() let requesturl = nsurl(string: "http://example") let request = nsurlrequest(url: requesturl!) webview.loadrequest(request) } func checkknetworkstatus(){ let networkchecking : reachability = reachability.reachabilityforinternetconnection() networkchecking.startnotifier() var status : networkstatus = networkchecking.currentreachabilitystatus() if (status == notreachable) ***//error*** { // sta

osx - How can a terminal be embedded in a PyQt window in OS X? -

i've written pyqt gui features embedded terminal ( xterm ). use ubuntu , works fine on i've found colleagues run os x having difficulties: terminal showing separate window. how should terminal embedded in os x? need gui same on both linux , os x. import sys pyqt4.qtcore import * pyqt4.qtgui import * class embedded_terminal(qwidget): def __init__(self): qwidget.__init__(self) self.resize(800, 600) self.process = qprocess(self) self.terminal = qwidget(self) layout = qvboxlayout(self) layout.addwidget(self.terminal) self.process.start('xterm', ['-into', str(self.terminal.winid())]) if __name__ == "__main__": app = qapplication(sys.argv) main = embedded_terminal() main.show() sys.exit(app.exec_())

How do I call a COM object in C# that I registered using RegistrationServices -

i'm experimenting com objects , created simple com service acts calculator add, subtract, multiply, divide (details not important). i wrote code register dynamically c# application assembly asm = assembly.loadfile("c:\\...comcalc.dll"); registrationservices regasm = new registrationservices(); bool bresult = regasm.registerassembly(asm, assemblyregistrationflags.setcodebase); after registering i've been able use service ie browser in javascript. var num1 = 2 var num2 = 2 var objtest = new activexobject("comcalc.comcalc") alert(num1 + " - " + num2 + " = " + objtest.subtract(num1,num2)) i'd able test c# application can have register, unregister, , test method com object. i've struggled find documentation how this. ideas? bonus: access guid defined in com object opposed comcalc. regasm.registerassembly(asm, assemblyregistrationflags.setcodebase) by writing own custom registration method, missing out on

html - CSS div with dynamic height to responsive background image -

i trying create class dynamic image background on bootstrap3 without success. instead use height equal 180px trying use 100% make responsive. whats wrong? .audio-cover { background: url("http://media.merchantcircle.com/22662073/180px-smiley_svg_full.png"); background-size: contain; background-repeat: no-repeat; height: 100%; //instead use 180px } <div class="col-xs-4 col-sm-4 col-md-4 audio-cover"></div> set background-size cover , specify min-height . check out fiddle

Legend that changes value of number in R -

let's have variable mm = 5 change , have number change automatically update in legend of graph. says "no change" , "change in m" m = 3 , m = 5. can done? m <- 3 <- .5 b <- 1 c <- .5 g <- seq(.02,.2,by=.02) n <- 7 r <- .25 alpha <- 2 dt <- 1 x <- .1 #changed parameters mm <- 5 a.2 = function(m = m,a,b,c,g,n,r,alpha,dt,x) { 1 - exp(-dt*(1/(alpha*dt)*log(1+(alpha*b*dt*m*a^2*c*x*exp(-g*n))/(a*c*x+g)))) } all.data.g <- expand.grid(m = m,g = g,x = x) all.data.g$a.4 <- a.2(m,a,b,c,all.data.g$g,n,r,alpha,dt,x) all.data.g$a.5 <- a.2(mm,a,b,c,all.data.g$g,n,r,alpha,dt,x) plot(all.data.g$g, all.data.g$a.4, xlab = 'g', ylab = 'attack rate', ylim = c(0,1), type = 'l') lines(all.data.g$g, all.data.g$a.5, lty=2) legend('topright', c("no change","change in m"),lty=c(1,2))

uml - How to Create a Sequence Diagram in Visual Studio 2015 Enterprise from existing code? -

Image
i'm new ultimate/enterprise line of visual studio products, , 1 thing looking forward easy creation of sequence diagrams based on source code. i've found says it's easy locating method, , right click => generate sequence diagram, shown below: ...but option doesn't seem available in 2015 enterprise. did change? as jessehouwing mentioned in comment, generating sequence diagrams code (and many other uml generation options) has been removed in vs2015. current release, these diagrams can generated existing code: to visualize architecture of system or existing code , create following diagrams: layer diagrams code maps class diagrams source: https://msdn.microsoft.com/en-us/library/dd409436.aspx

ios - How to repeat action as long I touch and when I stop touching the action stop in SpriteKit Swift -

as said in title want make action run , repeat long press button , stop , run action when stop touching. don't know method if me code example want sprite rotate long press , after stop touching move up. let action = skaction.rotatebyangle(cgfloat(m_pi), duration:1.0) sprite.runaction(skaction.repeatactionforever(action)) let action2 = skaction.movetoy(900, duration: 1.0) sprite.runaction(action2) to describe want: when touch screen object created , rotate , keep rotating till release finger screen , stop touching want go up in sprite kit scene, these methods allow detect when touch begins , ends: override func touchesbegan(touches: set<nsobject>, withevent event: uievent) { // start action repeats indefinitely. } override func touchesended(touches: set<nsobject>, withevent event: uievent) { // remove action after touches end. } when touches end, call self.removeallactions() stop actions in scene, or sprit

Meteor With windows Not working -

i new meteor .i using windows platform build application mobile unable make run on android says unsupported not working. please guide me step wise deploy app onto android smartphone windows mobile builds android , ios not supported on windows ( support android seems planned (see point no. 5), ios still requires xcode run). so, while can develop , test in browser on windows, need @ least linux install run/build app android devices, and/or mac (or os x vm) run/build ios devices.

php - Upload failed via ftp.exe -

i using xampp on windows , want upload file via ftp.exe. created .vbs script creating ftp.dat file , run ftp.exe. set fs = createobject("scripting.filesystemobject") set filein = fs.opentextfile("c:\xampp\htdocs\ftp.dat", 2, true) filein.writeline "open" filein.writeline "ip" filein.writeline "user" filein.writeline "password" filein.writeline "put c:\path\to\file\file.txt" filein.writeline "quit" filein.close set wshshell = wscript.createobject("wscript.shell") wshshell.run "cmd /c ftp.exe -s:c:\xampp\htdocs\ftp.dat > log" i printed output log file giving me error: ftp> connected xxx.xxx.xxx.xxx. open xxx.xxx.xxx.xxx 220 hostname ftp server ready. user (xxx.xxx.xxx.xxx:(none)): 331 password required user. 230 user user logged in. ftp> put c:\path\to\file\file.txt 200 port command successful. 553 file.txt: permission denied. ftp> quit 221 goodbye. uploaded 0 byt

c# - Get file from RESW resource -

i have encountered problem retrieving file resw file. my project structure: levels level1.xml level2.xml level3.xml resources levelresources.resw and files "levels" directory added "levelresources.resw". my try retrieve content of files: var resourcesloader = new resourceloader("levelresources"); var item = resourcesloader.getstring("level1"); but value of "item" is" ..\levels\level1.xml;system.string, system.runtime, version=4.0.10.0, culture=neutral, publickeytoken=b03g5f6f12d40a6a;windows-1250 why? not expected (content of file). how retrieve content than? the resourceloader class provides simplified access app resources such app ui strings. when dragging file resource file, data stored file reference rather content, that’s why result “level1.xml;system.string...”. recommend way, suggest putting file name key , file content value in *resw file can use resourceloader content easil

php - Zend 1 - Render another controller from a controller -

i'm trying change our current layout requesting controller contents ajax instead of reloading page each time user clicks on item of menu. long story short: need load controller controller. let's have controller named ajaxcontroller.php receive controller , action need render post , needs return requested controller html response without layout. right have following code on controller: class ajaxhelpercontroller extends default_model_views_basic { protected $_redirector = null; public function init() { $this->_redirector = $this->_helper->gethelper('redirector'); } public function indexaction() { $valor = $this->_request->getparam('valor'); $this->disablelayout(); $this->_helper->viewrenderer->setnorender(); $this->_redirector->gotourl('http://desarrollo.techmaker.net/eloy/svn/eplanv30/public/demo_eplan_profes

classification - R package "tree": how to control the maximum tree depth? -

the r package "tree" restricts maximum tree depth 31. if function tree applied large dataset, limit reached: > library("tree") > library("elemstatlearn") > data <- list(image=as.matrix(zip.train[,-1]), digit=as.factor(zip.train[,1])) > t <- tree(digit~image, data, split="gini") error in tree(digit ~ image, data, split = "gini") : maximum depth reached calls: source -> withvisible -> eval -> eval -> tree -> .c is there way tell tree stop growing tree when maximum tree depth reached, rather aborting error? (in other words: there equivalent maxdepth parameter of rpart.control ?)

javascript - Date Formats in MVC -

my view models , controllers seem save date time in different format. instance, in view in html text box, if had entered in 07/12/2015, have saved value if "december 7, 2015". using boostrap javascript datetime picker. (a side note: if entered in "dateformat" datetime picker, picker not work, , that's why commented out line) is there way such can change saved format of html text box? my view model: (part) <div class="form-group"> @html.label("actual completion date", htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.actual_completion_date, new { htmlattributes = new { @value = model.actual_completion_date, @class = "form-control" } }) </div> @html.validationmessagefor(model => model.actual_completion_date, "", new { @class = "text-danger" }) <

c++ - StretchBlt only works when nHeightDest is negative -

i'm trying use stretchblt in order copy pixels memory hdc window hdc. memory hdc gets image invisible window renders stream using opengl. here's code: bitmapinfoheader createbitmapheader(int width, int height) { bitmapinfoheader header; header.bisize = sizeof(bitmapinfoheader); header.biwidth = width; header.biheight = height; header.biplanes = 1; header.bibitcount = 32; header.bicompression = bi_rgb; header.bisizeimage = 0; header.bixpelspermeter = 0; header.biypelspermeter = 0; header.biclrused = 0; header.biclrimportant = 0; return header; } ... hdc memoryhdc = createcompatibledc(windowhdc); bitmapinfo bitmapinfo; bitmapinfo.bmiheader = createbitmapheader(targetdimensions.width, targetdimensions.height); hbitmap bitmap = createdibitmap(windowhdc, &bitmapinfo.bmiheader, cbm_init, offscreenbuffer, &bitmapinfo, dib_rgb_colors); selectobject(memoryhdc, bitmap); deleteobject(bitmap); setstretchbltmode(windo

node.js - Merge an array of objects using key value in lodash? -

i'm using node.js , lodash. i have data this: [ { to: [ 'foo@bar.com', 'foo1@bar.com' ], submittedsubs: [ [object] ] }, { to: [ 'foo@bar.com', 'foo2@bar.com' ], submittedsubs: [ [object], [object], [object] ] } ] i'd turn data it's "sorted" to [ { to: 'foo@bar.com', submittedsubs: [ [object],[object], [object], [object] ] }, { to: 'foo1@bar.com', submittedsubs: [ [object] ] }, { to: 'foo2@bar.com', submittedsubs: [ [object], [object], [object] ] } ] how can this? i've tried this: spam[0].to.push('foo@bar.com'); spam[0].to.push('foo1@bar.com'); spam[1].to.push('foo@bar.com'); spam[1].to.push('foo2@bar.com'); console.log('data is',spam); var byuser=[]; _.each(spam, function(data){ _.each(data.to,function(addr){ byuser.push({to:addr,submittedsubs:data.submit

android - Google Signin:Error signing in the specified account. Please choose a different account -

this question asked did not find satisfactory answer. i followed each , every step of https://developers.google.com/+/mobile/android/samples/quickstart-android#credentials-screenshot instead of package name using mine. there 2 cases 1 direct testing , 1 after signin apk keystore. when testing app in case signin google account working fine after generate signed apk giving me error signing in specified account. please choose different account . if same why not working signed apk ? i found mistake , sha1 key, debug sha1 , keystore sha1 different , in google console gave debug sha1 working debug apk not signed apk. so did extracted sha1 keystore , put in google console working signed apk(it not work debug now). how can extract sha1 keystore. c:\program files\java\jdk1.7.0_71\bin>keytool -list -v -keystore c:\you_key_here.key

javascript - Phonegap Barcodescanner won't start after function fired -

i've tried create simple app barcodescanner plugin seems won't fire after try make call. phonegap build recognises plugin , app starts without problems, button won't fire scanning event. maybe barcodescanner might not start. aint quite @ point should have gotten error before starting app. i've tried test app on both android , windows no result. i've tried use older build of phonegap no result. using 3.7 @ moment. i've tried alternative approaches try , create /phonegap create projectname adding plugins platform etc. still same result. my html , js document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { function scan() { cordova.plugins.barcodescanner.scan( function (result) { alert("we got barcode\n" + "result: " + result.text + "\n" + "format: " + result.format + "\n" + &qu

javascript - Getting the next key -

i have array this: var bookch = {'tomsawyer':[twain,50], 'parelandra':[lewis,150], 'roguecode':[russinovich,23], 'wrinkle':[lengle,12]}; if match on roguecode, want print next key console (e.g., if match roguecode, print wrinkle). here's have match, have no idea how print next key in array instead of current one. if numbered keys easy, aren't... var currentbook = "roguecode"; (var bookkey in bookch) { if (bookkey == currentbook) { console.log("next book: " + ???); } } declare array this var bookch = [ { 'id': 'tomsawyer', 'meta': [twain, 50] }, { 'id': 'parelandra', 'meta': [lewis, 150] }, { 'id': 'roguecode', 'meta': [russinovich, 23] }, { 'id': 'wrinkle', 'meta': [lengle, 12] } ] now when iterate on it for(var i=0; i<bookch.length-1; i++) { // bookc

c# - Getting error:"Input string was not in a correct format" while installing PagedList.MVC -

Image
i not able understand why error occurring while installing pagedlist.mvc in nugetpackage. "input string not in correct format" has came across issue? please me install it.

Easy prolog queries -

Image
i new prolog , although i’ve read books can tell programming brain can’t think prolog way. problem solve pretty simple (i believe). describe via example. let’s have graph contains 4 “types” of nodes , 3 edges connect nodes. types can a, b, c or d , can see image below (see figure 1), can connected b , c (a_to_b , a_to_c edges respectively), while c can connected d (c_to_d edge). there’s additional rule not shown on picture: can connected @ 1 c. i express these simple rules in prolog solve problem shown in second picture. there 3 nodes type missing (labeled x?, y? , z?). applying above rules in mind can find x? , z? of b type (as can connect no more 1 cs) , y? of type d c can connect d. could please provide me on that? not writing pick solution. learn prolog suggestion on book explains prolog people have never worked on such concepts before me welcome. edit: example fails i came following 2 examples: for example 1, rules are can_connect(a,b,_). can_connect(a,c,

java - Get year of datetime where date is not fully specified with JDBC -

i have java program connected mysql database jdbc in introduce datetimes. many times year introduced assigning 00 days , months not specified, instance 1700-00-00 year 1700. when try date resultset using resultset.getdate().tostring() proper date specified dates in case of partial dates get: previous_year-11-30, 1699-11-30 year 1700. when try resultset.getdate().gettime() equivalent result: -8520339600000 . resultset.gettimestamp() gives same results. conversely, when datetime mysql proper value 1700-00-00 . i have tried different years obtaining same results. appreciated. here how fetch data (this 1 method, many other similar , give same results): public naixement(int fill) throws dbexception{ super(); try { string str = "select * naixement id_fill=?"; preparedstatement pst = con.preparestatement(str); pst.setint(1, fill); resultset rs = pst.executequery(); if (rs.next()){

sql - AFTER DELETE trigger does not always fire -

i have tables a, b, c. has nullable fk b called bid , b has fk c cascade delete. when c deleted, need bid on set null. when delete on c cascades b, expect following trigger execute: create trigger after_delete_b on b delete begin declare @bid int select @bid = id deleted update set bid = null bid = @bid end however seems execute , not others. cannot figure out why. your trigger not handling multiple row deletes, captures 1 id deleted rows , update related value in table a, since there 1 variable, you need use set based approach handle multiple deletes. for need modify trigger definition this..... create trigger after_delete_b on b delete begin set nocount on; update set a.bid = null inner join deleted d on a.bid = d.id end

How to set up Hadoop in Docker Swarm? -

i able start hadoop cluster in docker, distributing hadoop nodes different physical nodes, using swarm . i have found sequenceiq image lets me run hadoop in docker container, doesn't allow me use multiple nodes. have looked @ cloudbreak project, seems need openstack installation, seems bit overkill, because seems me swarm alone should enough need. also found this stackoverflow question+answer relies on weave, needs sudo-rights, our admin won't give everyone. is there solution starting hadoop cluster comes down starting few containers via swarm? i cannot give definitive answer, if looking set without administratrator privileges , answers to question fail fear might out of luck. consider asking admin why not want give out sudo access, chances either can take away doubts, or else turns out want undesirable.

vbscript - Regex to insert space after every 4 characters? -

using vbscript 5.5 regex, how can replace string there's space after every 4 characters? i tried following doesn't work: dim rex new regexp rex.ignorecase = true rex.global = true rex.pattern = ".{4}" dim newstring string newstring = trim$(rex.replace(trim$(inputstring), "$0 ")) you need group () , better ref ($1): >> set r = new regexp >> r.global = true >> r.pattern = "(.{4})" >> wscript.echo r.replace("1234567890123", "$1 ") >> 1234 5678 9012 3 >>

Python: handle sys.exit() in doctests -

i trying use python doctests test error message being printed in function. below code import sys def get_values(vals=[]): """ should split key:val , give values >>> get_values(["abc"]) error: not values """ values = [] val in vals: try: kv = val.split(':') k = kv[0] v = kv[1] values.append(v) except exception: print_msg("error: not values") return values def print_msg(msg): print msg sys.exit(1) def main(): import doctest try: doctest.testmod() except doctest.doctestfailure, failure: print 'doctestfailure:' sys.exit(1) print "doctests complete" if __name__ == "__main__": main() when run doctest, getting below: ********************************************************************** file "abc.py", line 7, in __main_

How do I deploy CodeIgniter on Laravel Forge? -

i want deploy codeigniter on laravel forge platform, because love simplicity , auto-deploy nature of platform. how do it? this how did it, , problems had doing it. problem 1 because forge runs on nginx, not apache, apache php directives ignored. (i think). so, main problem had short_open_tag directive in default configuration set 'off', meaning php fpm configuration problem 2 in nginx configuration file specific site (not server) replace try_files $uri $uri/ /index.php?$query_string; with try_files $uri $uri/ /index.php;

Strip all non letters and numbers from a string in Powershell? -

i have variable has string recieves strange characters hearts. besides point, wanted know anyhow: how leave string letters , numbers, discarding rest or replacing nothing (not adding space or anything) my first thought using regular expression wanted know if powershell had more native automatically. let have variable this: $temp = '^gdf35#&fhd^^h%(@$!%sdgjhsvkushdv' you can use -replace method replace non-word characters this: $temp -replace "\w" the result be: gdf35fhdhsdgjhsvkushdv

peoplesoft - schedule backup through PS_QUERY PeopleTools 8.49 and through cron/bath job -

i have 2 question ist 1 how take backup of tables , schedule through pt 8.49 ps_query , 2nd how schedule backup client side through cron jobs.my backup script datamover using taking manual backup are:- set no trace; set log d:\backup_prod\backup_6tables_28 july2015 cu.log; set output d:\backup_prod\backup_6tables_28 july2015cu.dat; "adm appl tbls" export adm_appl_prog emplid 'uf15%'; export adm_appl_plan emplid 'uf15%' ; export adm_appl_sbplan emplid 'uf15%' ; export adm_app_car_seq emplid 'uf15%' ; export adm_appl_data emplid like'uf15%' ; export ps_sad_std_app_nld emplid 'uf15%' ; you can execute dms scripts via command line. create script executes via schedule whichever operating system on. example: psdmtx -ct dbtype [-cs server] -cd database_name -co user_id -cp user_password[-ci connect_id -cw connect_password] [-i process_instance] -fp dms_filepath

ruby - generated Set_model path in rails controller -

i'm used scaffold_controller generate controller model have. in view, have following link to link_to, 'like', like_path(param: 'param') in controller generated, have private method set_like called , can figure out why. want link go likes#new path, it's going set_like method first. feel new rails thing , i'm not sure why. ideas? looks want use "new_like_path" rather "like_path". you benefit reading closely: http://guides.rubyonrails.org/routing.html when use "like_path" linking existing record, id should pass "like_path" route generator. like: like_path(2) # link id==2

php - Edit WordPress blog post page - Avada WordPress Theme -

i customize blog post page in avada wordpress theme. have searched folders inside avada theme, can't find out edit blog post .php file. please 1 me out of problem. time. the code blog post typically found in theme/single.php . can read more file , overall theme hierarchy on wordpress codex .

html - javascript scrolling youtube player, modifying divs -

this first post on here, i've found site extremely helpful in past, go-to when google search. i run how-to youtube channel. i've finished building webpages , ready go online, need have descriptions along each video appear clicked. i'm using this responsive player , i've been trying modify html , divs there description appears right of each video, thumbnails below it. tried using getelementsbyids instead of getelementbyid, broke (unless didn't right), deleted , tried using getelementbyid tag. experimented separate video demo working. this did. did mimic divs "vid-container" div , renamed "vid-desc-container", placed directly below "vid-container" div in html code. made new divs similar properties except placement. result? worked, second video div directly below first. if can placement on right (2/3 size of video, above scrolling thumbnails) can put description in instead. apologize if html isn't legible, tried wouldn't pa