Posts

Showing posts from March, 2010

Generate QR Code in Crystal Report using VB.NET -

is there way generate qr code vb.net crystal reports ? i have tried tutorial : http://www.keepautomation.com/vbnet_barcode/qrcode.html but error : "a required privilege not held client." is there plugin or whatever generate qr code vb.net cystal reports ?

python - Can't build opencv 3.2.0 with opencv_contrib 3.2.0 -

i'm trying build opencv , opencv_contrib module i'm getting following while building cmake-gui : detected version of gnu gcc: 54 (504) found zlib: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required "1.2.3") found zlib: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") checking module 'gtk+-3.0' no package 'gtk+-3.0' found checking module 'gstreamer-base-1.0' no package 'gstreamer-base-1.0' found checking module 'gstreamer-video-1.0' no package 'gstreamer-video-1.0' found checking module 'gstreamer-app-1.0' no package 'gstreamer-app-1.0' found checking module 'gstreamer-riff-1.0' no package 'gstreamer-riff-1.0' found checking module 'gstreamer-pbutils-1.0' no package 'gstreamer-pbutils-1.0' found checking module 'gstreamer-base-0.10' no package 'gstreamer-base-0.10' found checkin

node.js - in node js ,how to set login permission on facebook developer API? -

my code is:- .. , give me error in "output" ,how can solve it?? code: var fb=require('fb'); fb.login(function(response) { // handle response if (response.status === 'connected') { console.log('logged in.'); } else { fb.login(); } }, {scope: 'publish_actions', return_scopes: true }); output: fb.login(function(response) { ^ typeerror: fb.login not function @ object.<anonymous> (c:\users\vvlocal\desktop\work\facebook\fblogin.js:3:4) var options = {} var fb = require('fb'), fb = new fb.facebook(options); fb.login(function(response) { // handle response if (response.status === 'connected') { console.log('logged in.'); } else { fb.login(); } }, {scope: 'publish_actions', return_scopes: true }); try didn't test ;)

vba - How to prevent an *unwanted* modification of a macro address -

environment: windows 7, excel 2010, dropbox in workbook.xlsm have assigned button address of macro. as long stay in same computer, macro executed when "press" button. the same button in same workbook, accessed on computer related via dropbox, not work anymore. when assigned address (on other computer), see modified excel the original assignment c:\dropbox\myxlstart\mepersonal.xlsb!macroname it changed c:\users\a-user\appdata ...... consequence macro not found. how can prevent change, destroys ease of use in setup?

python 2.7 - to get the integer value after : and subtract it from the next value -

i have text file , need integer each line 246012 , subtract next line's integer using python [739:246012] phythrad: dspmsgq received: msg type is[130] , sfnsf [14996] [sfn:937 sf:4] [739:246050] start of macthread:receved msg type[47] [739:247021] phythrad: dspmsgq received: msg type is[130] , sfnsf [14997] [sfn:937 sf:5] [739:247059] start of macthread:receved msg type[47] [739:248013] phythrad: dspmsgq received: msg type is[130] , sfnsf [14998] [sfn:937 sf:6] [739:248053] start of macthread:receved msg type[47] this should trick: with open('myfile.txt') a: = a.readlines() nums = [int(lines[lines.find(':')+1:lines.find(']')]) lines in a] result = [y - x x, y in zip(nums, nums[1:])] print result

html - Repeating bullets outside of container -

it's html / css issue having. have attached screenshot, bullets need continue outside of container browser edge, ready next slide. methods have tried, not work once browser responds goes out of proportion. any css tricks fantastic. adam enter image description here

c# - Static position within Flow layout panel -

i've been trying, hours, using different implementations background images , paint handlers, set fade on list of labels in flowlayoutpanel. the list horizontal ( wrap=false ), , automatically scrolls end (the last item continually scrolled view), why wish apply fade @ start (so can see there more items out of view). i believe if can fix label @ start, having hover on other labels in panel, can draw background over. i tried adding label on panel itself, not transparent on panel, white box... is possible?

c# - Clr20r3 system.io.filenotfoundexception on non-visual studio machine -

my project speechclient(bing speech api) works fine on computer. debug message doesn't show relates when run on non-vs machine, stopped working clr20r3 filenotfoundexception on reliability history. stopped working when code run: this.stopcommandwaiting.invoke(this, new eventargs()); this.startspeak.isenabled = false; this.createmicrophonerecoclient(); textbox.background =(visualbrush) this.resources["hint2"]; startspeakimage.source = new bitmapimage(new uri( @"assets\microspeak.jpg",urikind.relative)); try { this.micclient.startmicandrecognition(); } catch(exception em) { messagebox.show(em.message, "error while start mic client"); //app.current.shutdown(2); } thanks helping anyway!

GitHub changed to BitBucket when doing git push -

i have both github , bitbucket accounts, use github one. few days ago when got client bitbucket repo, i've decided try out , have installed sourcetree, pulled repo there , ok. problem occurred when went on project on github repo. made changes, , console did add and commit , , when wrote git push came out: warning: push.default unset; implicit value has changed in git 2.0 'matching' 'simple'. squelch message , maintain traditional behavior, use: git config --global push.default matching squelch message , adopt new behavior now, use: git config --global push.default simple when push.default set 'matching', git push local branches remote branches exist same name. since git 2.0, git defaults more conservative 'simple' behavior, pushes current branch corresponding remote branch 'git pull' uses update current branch. see 'git config' , search 'push.default' further information. (the 'simple' mode introduced

c# - ListView DataBindig using MVVM (WPF, ListView, Binding) -

i have model called listviewmodel 1 method: namespace layoutmvvm.viewmodels { public class listviewmodel { public void getdata() { testviewclassdatacontext tv = new testviewclassdatacontext(); list<test_view> tvq = (from tt in tv.test_views select tt).tolist(); } } } into usercontrol called listview want result model , bind list: listview.xaml: <usercontrol .....> <grid background="crimson"> <listview width="230" height="250" name="lvmylist"> <listview.view> <gridview> <gridviewcolumn header="firstname" width="90" displaymemberbinding="{binding firstname}" /> <gridviewcolumn header="lastname" width="90" displaymemberbinding="{binding lastname}" />

linux - I cannot clone git tree -

i have question git, tried clone tree without success. git clone https://github.com/cer/event-sourcing-examples/tree/d2077e21aa677a00095f90250470ff011c132ab8/java-spring i cloned project git clone https://github.com/cer/event-sourcing-examples and tried switch tree no effect would have suggestions ? best regards git cannot clone tree directly. need clone entire repository, , check out commit uses tree want. sake of reducing confusions, though, note there difference between terms "tree" , "commit", though: a tree git object representing directory, , contains links blobs (files) , other trees. tree not root directory of repository. a commit object contains link root tree of repository, , information such commit message, dates , other headers. you can check out commits. few git commands deal directly tree objects ( git cat-file , git ls-tree being among exceptions). however, object id in github url indeed id of commit, that's not

java - Save and load state of GUI component -

i new gui development, may easy do, however, appreciated. considering have gui 7-8 tabs, , each tab contains text boxes, check boxes , radio buttons, list-boxes , on. the idea after filling tabs, user can save data (state of components) in file. and later on loading corresponding file, user can retrieve data. how can able without manually save data? update: please consider, have following gui application collect student information: sample application tab # 1 as there several tabs, user may stop anytime ans save information in file, such as: saving information the idea user can load file later , continue his/her task. i know how can save state of components in application , load later on. thanks. you mixing 2 things here: ui , data. the data save file should represent "mental model" build whole application around. example: seem think of "person" collection of text fields , checkboxes ... , wrong : person distinct class, set of

python - How to convert "ABCD…" to "CDEF…" in a Pythonic way? -

for example, have lst = "abcxyz" , , expect output "cdezab" the best method i've come far is: "".join(chr((ord(x)-ord('a')+2)%26+ord('a')) x in lst) which awkward. using dictionary {'a': 'c', 'b': 'd', ……, 'x': 'z', 'y': 'a', 'z': 'b'} seems more pythonic, more awkward. any ideas? you can build dictionary: >>> import string >>> dict(zip(string.uppercase, string.uppercase[2:]+string.uppercase[:2])) {'a': 'c', 'c': 'e', 'b': 'd', 'e': 'g', 'd': 'f', 'g': 'i', 'f': 'h', 'i': 'k', 'h': 'j', 'k': 'm', 'j': 'l', 'm': 'o', 'l': 'n', 'o': 'q', 'n': 'p', 'q': 's', 'p'

batch file - ICACLS to change permission to a folder and its contents? -

i made piece of code change permission folder , contents (subfolders , files) command icacls my issue : clicking on properties of folder > security can manually modify access rights of folder. there script or method prevent ? @echo off title example of using icacls command hackoo 2017 mode con cols=70 lines=10 & color 0e set "folder=%userprofile%\desktop\testhackoo" if not exist "%folder%" md "%folder%" :main cls echo ================================== echo menu echo ================================== echo [1] control total echo [2] reading echo [3] writing echo ----------------------------------- echo( set /p "mychoice=please choose 1,2,3 : " if "%mychoice%" equ "1" ( icacls "%folder%" /grant:r "%username%:(oi)(ci)f">nul 2>&1 icacls "%folder%" /inheritance:r if "%errorlevel%" equ "0" ( cls &

javascript - How to position divs -

Image
i'm trying create custom animation player. three.js used render object , works perfectly. problem add control options on bottom(like play,pause etc). i'm not sure canvas rendered last part of page. there code: <body> <div id="playercontainer"> <div id="rendercontainer" style="width:400px;height:300px"></div> <div id="controlcontainer" style="width:400px;height:30px"> <input id="rangebar" type="range" min="0" max="100" value="0" step="1" style="width:400px;height:30px"/> </div> </div> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="https://threejs.org/build/three.js"></script> <script src="jquery.fullscreen-m

database - Ajax live filtering + DB results + checkboxes + best result -

could suggest me way implement idea. i have sliders used changing filter criteria (ajax live) of data in database. data returned in separate jumbotron div each row. part works fine. what want add checkboxes further filtering of results. want have best result filtering (lowest price) displayed in bestresult div on checkbox filtering not have affect. i imagine there should way of getting data getdata.php index.php , have results displayed in way described above. - or solution in overall? could draw example me please, thank you!

c - How does the const keyword affect a pointer that is pointing towards a const variable? -

if consider this: int *var1; const int *var2 = var1; why *var1 = x; compile , *var2 = x; does not? in case *var2 = x; fails compile error message ( approx ), error: assignment of read-only location *var2 *var2 = 10; ^ because have marked value of const qualified. to elaborate, can read statement like const int *var2; as, declare var2 pointer const int . value pointed var2 constant , cannot changed. in case want pointer const-qualified, need write like int * const var2; which declaring var2 const pointer int . so, later attempt assign var2 produce error, accessing *var2 work fine, value pointed pointer not const-qualified anymore.

javascript - How to make background transparent while bootstrap loader -

i want make bootstrap loading image while api returns result. how can make background transparent? here html markup , css: <div class="loader" ng-hide="data.length > 0"></div> <style> .loader { border: 16px solid #d4d4d4; border-radius: 50%; border-top: 16px solid #3498db; width: 120px; height: 120px; position: fixed; top:100px; bottom: 0; left: 0; right: 0; margin: auto; z-index: 99999999; -webkit-animation: spin 2s linear infinite; animation: spin 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style> add background-color: transparent .loader <div class="loader" ng-hide="data.length > 0"></div> <style> .loader { border: 16px solid #d4d4d4; border-radius: 50%; border-top: 16px solid #3498db; width: 120px; ba

directory - Adding comments to Windows DIR command output -

after displaying date information identically named file possible add additional comment on same line (for context)? here's i'm using doing: dir c:\folder1\file.txt | find "/" >> c:\logs\log.txt dir c:\folder2\file.txt | find "/" >> c:\logs\log.txt when attempt add comment using echo command echo command displayed. dir c:\folder1\file.txt | find "/" | echo "comment1" >> c:\logs\log.txt dir c:\folder2\file.txt | find "/" | echo "comment2" >> c:\logs\log.txt

How to draw a dot circle inside a square drawable in android? -

Image
i want small dot inside square button , have tried till answered azizbekian: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <size android:width="100dp" android:height="100dp"/> <solid android:color="#38b0ef"/> </shape> </item> <item android:bottom="45dp" android:left="45dp" android:right="45dp" android:top="45dp"> <shape android:shape="oval"> <stroke android:width="1dp" android:color="#0c5069"/> <size android:width="20dp" android:height="20dp"/> <solid android:color="#0c5069"/> </shape>

vb.net - .NET Counting vowels from a text file -

as newbie .net decided set myself little challenge of writing program count number of vowels input string. program below works fine, then, develop further thought, instead of entering string via console.readline, possible extract text text file? tried using fileopen/fileclose , streamreader approach resolve issue mind set text file should converted chararray. looking @ problem wrong angle? can customise existing code , adapt text files, or need adopt new approach? any appreciated, thanks module module1 sub main() dim counter1 integer = 0 console.writeline("enter word") dim myword string = console.readline() dim chararray() char = myword.tochararray() each letter in chararray select case letter case "a", "e", "i", "o", "u", "a", "e", "i", "o", "u" counter1 = counter1 + 1 end select next console.wri

html - transform,transform-origin not working inside @keyframes -

i want tilt image @ beginning , @ end. image keyframes,transform , transform-origin doesn't seem working. html: <div class="h_imag col-md-9"> <img class="h_ig"src="top_right_image.gif" alt=""> </div> css: .h_imag{ min-height: 6px; float: right; animation: t_bike 10s infinite; } @-moz-keyframes t_bike { 0% {top: 0px; left: 0px; -moz-transform: rotate(0 deg); -moz-transform-origin: -9px 15px;} 5% {top: 0px; left: 1%; -moz-transform: rotate(-10 deg); -moz-transform-origin: 20px 0px;} 10% {top: 0px; left: 4.6%; -moz-transform: rotate(-20 deg); -moz-transform-origin: 29px 0px;} 20% {top: 0px; left: 9.2%; -moz-transform: rotate(-25 deg); -moz-transform-origin: 31px 0px;} 25% {top: 0px; left: 13.8%; -moz-transform: rotate(-25 deg); -moz-transform-origin: 31px 0px;} 30% {top: 0px; left: 18.4%; -moz-transform: rotate(-30 deg); -moz-transform-origin: 31px 0px;} 35% {top: 0px; left:

javascript - Node.js imap connection handling -

i need write node.js application keep checking if there new email imap server. i trying write object handling imap connection. var imap = require('imap'), inspect = require('util').inspect; const fs = require('fs'); var mailparser = require("mailparser").mailparser; var promise = require("bluebird"); function imapconnection(config){ if (!(this instanceof imapconnection)) return new imapconnection(config); this._imap = new imap(config); this._config = config; } imapconnection.prototype.getimap = function(){ self = this; if(this._imap.state !== 'authenticated'){ return new promise(function(resolve,reject){ self._imap.connect(); self._imap.once('ready', function(){ resolve(self._imap); }); }); }else{ return new promise(function(resolve,reject){resolve(this._imap);}); } } but when call object after called

c++ - Nested unordered_map has no member named ‘emplace’ -

i trying fix pretty hard program me got gamedev book. think it's crashed because author used windows , use linux (g++). in short have couple of classes perform application state's logic, , have map of maps hold states callbacks: enum class statetype { intro = 1, mainmenu, game, paused, gameover, credits }; using bindings = std::unordered_map<std::string, binding*>; using callbackcontainer = std::unordered_map<std::string, std::function<void(eventdetails*)>>; using callbacks = std::unordered_map<statetype, callbackcontainer>; class eventmanager { public: ... template<class t> bool addcallback(statetype l_state, const std::string& l_name, void(t::*l_func)(eventdetails*), t* l_instance) { auto itr = m_callbacks.emplace(l_state, callbackcontainer()).first; auto temp = std::bind(l_func, l_instance, std::placeholders::_1); return itr->second.emplace(l_name, temp).second; } private: cal

scala - Monitoring mailbox-size metric of routee actors with kamon-akka 0.6.x -

i using version 0.5.2 of kamon-akka library, without problems, monitor akka actors. upgraded 0.6.3 , noticed statistics not sent. when looked @ source code of kamon, saw mailbox-size metric not sent routee actors running under router. instead, router metrics such routingtime being sent routee actors. however, i'm using them workers , need monitor mailbox sizes. here part of kamon source creates routee monitor routermetrics instead of actormetrics contains mailbox-size metric: package akka.kamon.instrumentation object actormonitor { ... def createrouteemonitor(cellinfo: cellinfo): actormonitor = { def routermetrics = kamon.metrics.entity(routermetrics, cellinfo.entity) if (cellinfo.istracked) new trackedroutee(cellinfo.entity, routermetrics) else actormonitors.contextpropagationonly } ... } i'm not sure if bug, how can solve problem? there configurations or workaround solutions fix it? thank in advance.

java - Using volatile keyword for creating one instance -

i have following code: public class entitymanagerfactoryproviderimpl implements entitymanagerfactoryprovider { private entitymanagerfactory entitymanagerfactory=null;//line xxx public entitymanagerfactory getfactory(){ if (entitymanagerfactory==null){ buildfactory(); } return entitymanagerfactory; } private synchronized void buildfactory(){ if (entitymanagerfactory!=null){ return; } entitymanagerfactory=... } } so need entitymanagerfactory instance created once - when getfactory() first called. must set variable entitymanagerfactory on line xxx volatile case? also, entitymanagerfactoryproviderimpl osgi singleton declarative service, there 1 instance of class. there theoretical possibilities multiple threads calling code in parallel; , due not using volatile, thread doesn't see updates thread b made.i have never encountered such behavior myself, surr: possible , when happens, strange bugs

html5 - Jquery, timeinterval and if statements -

im doing kind of jquery game , got stuck. need 2 things. i have playing board player. player moving of arrows on keyboard. problem player goes outside of playing board, don't want this. should make not able go outside of box. i have made kind of "food" spawns @ random x location every time refresh. want spawn @ random location every 1 second example, , there therefore can more 1 "food" on board. here have: $(document).ready(function() { $(document).keydown(function(e) { if (e.keycode ==39 && $("#spelare").css("left") < '880px') $("#spelare").animate({left: '+=20px'}, 0); else if (e.keycode ==37 && $("#spelare").css("left") > '0px') $("#spelare").animate({left: '-=20px'}, 0); }); $('.food').each(function() { var spelplanwidth = $('#spelplan').width();//screen width var

http - ASP.NET Core URL Rewriting -

i trying redirect website www non-www rules http https ( https://example.com ) in middleware. used make redirection change in web.config such as: <rewrite> <rules> <clear /> <rule name="redirect https" stopprocessing="true"> <match url=".*" /> <conditions> <add input="{https}" pattern="off" ignorecase="true" /> </conditions> <action type="redirect" url="https://{http_host}{request_uri}" redirecttype="permanent" appendquerystring="false" /> </rule> <rule name="redirects www.domain.com" patternsyntax="ecmascript" stopprocessing="true"> <match url=".*" /> <conditions logicalgrouping="matchany"> <add input="{http_host}" pattern="^example.com$" /&g

Calculating the substrings of a string in Python -

i have simple string "abc". have write python code creating possible unique substrings, except empty string, string. the answer should follows: b c ab ac bc abc i wrote : def getsubstrings(str): sub = [] length = len(str) in range(length): j in range(i,length): sub.append(str[i:j+1]) sub.sort() return sub str = "abc" print (getsubstrings(str)) but wrong way , since not giving expected results. can please me efficient solution. thanks in advance. the build-in itertools library ( https://docs.python.org/3.6/library/itertools.html ) has wonderful functions can use. want possible combinations of letters, different length of strings. so code sample below loops on size of string: (1,2,3), gets possible combinations particular size, , "chains", or appends them. functions itertools use iterators, means final answer isn't stored in memory, created when need values. larger strings use less ram.

javascript - Need help to show() hide() bottom Sequence Navigation depending on select input -

hello displaying different sequence navigation depending on select input. example of trying far: <ul class="steps" id="dbleopt"> <li class="active">create<span class="chevron"></span></li> <li>fields<span class="chevron"></span></li> </ul> <ul class="steps" id="singleopt"> <li class="active">create<span class="chevron"></span></li> <li>welcome<span class="chevron"></span></li> <li>overview<span class="chevron"></span></li> </ul> and javascript not working: $(function () { $('#singleopt').hide(); $('#dbleopt').show();

python - Opposite of __init__ in thread class -

i understand __init__() called automatically when create class newthread = mythread(property) , run() triggered newthread.start() . looking called automatically before thread terminates, don't have explicitly call self.cleanup() before each return statement. class mythread(thread): def __init__(self, property): thread.__init__(self) self.property = property def cleanup(self): # clean here def run(self): # stuff self.cleanup() # current work around return one way making thread subclass context manager . make __exit__() special method want triggered. the following shows i'm proposing. note: renamed property argument passing constructor because property name of python built-in. from threading import thread import time test_thread_exception = false # change desired class mythread(thread): def __init__(self, attribute): thread.__init__(self) self.attribute = attribute

R language/reporteRs loop to write multiple docx -

i'm trying (as hard can) create script generate formatted word documents plain text files using r language , reporters. to extract text 1 txt i'm using code found on thread dealing readlines() function in r : filename <- "c:/myfolder/text_to_be_processed.txt" con <- file(filename,open="r") line <- readlines(con) close(con) then add extracted text docx : doc <- docx(template="temp.docx") next, adding title (first line of txt file) doc <- addparagraph( doc, value = line[1], bookmark = "titre", stylename = "titre") then body of txt file doc <- addparagraph( doc, value = line[2:length(line)], value = line[2:55], stylename = "contenu") finally create docx writedoc(doc, file = "output-file.docx") i want able create loop can generate multiple docx multiple txt files. appreciate you can lapply myfiles <- c("c:/myfolder/text_to_be_processed.txt", &qu

Nginx and sysctl configuration - Performance setting -

nginx acting reverse proxy adserver, receiving 20k requests per minute. response happens within 100ms adserver nginx running on virtual machine configuration 128gb ram 4 vcpu 100gb hdd considering above, setting of nginx , sysctl.conf please keep in mind kernel tuning complex , requires lot of evaluation until correct results. if spots mistake please let me know can adjust own configuration :-) also, memory quite high amount of requests if server running nginx, check how using during peak hours , adjust accordingly. an important thing check amount of file descriptors, in situation set 65.000 cope 20.000+ requests per second. reason in normal situation require 4.000 file descriptors have 4.000 simultanious open connections (20.000 * 2 * 0.1). in case of issue end take 1 second or more load advertisement. in case amount of simultanious open connections higher: 20.000 * 2 * 1.5 = 60.000. so setting 65k in opinion save value. you can check amount of file descrip

TokenMismatchException in VerifyCsrfToken.php line 68: Laravel 5.4 -

when sending post request when send query post, error occurs tokenmismatchexception in verifycsrftoken.php line 68 try add inside of form {{ csrf_field() }} <form> {{ csrf_field() }} <input > ... </form> this insert hidden field csrf token you

php - You cannot serialize or unserialize PDO instances CakePHP -

my cakephp giving problem , not know how solve it, tried update vendor error continues. error.log error: [pdoexception] cannot serialize or unserialize pdo instances request url: / stack trace: #0 [internal function]: pdo->__sleep() #1 vendor/cakephp/cakephp/src/cache/engine/fileengine.php(148): serialize(object(cake\orm\query)) #2 vendor/cakephp/cakephp/src/cache/cache.php(239): cake\cache\engine\fileengine->write('cake_views_post...', object(cake\orm\query)) #3 src/controller/postscontroller.php(494): cake\cache\cache::write('viewsposts', object(cake\orm\query)) #4 src/controller/postscontroller.php(57): app\controller\postscontroller->getpostssidebar() #5 vendor/cakephp/cakephp/src/controller/controller.php(262): app\controller\postscontroller->initialize() #6 [internal function]: cake\controller\controller->__construct(object(cake\network\request), object(cake\network\response), 'posts') #7

c# - Limit of startupeventargs.args array? -

i have 14 arguments being passed through command line. first 1 seems cut off reason , isn't reaching startupeventargs.args. what size of startupeventargs e string array? protected override void onstartup(startupeventargs e) { parsearguments(e.args); } private static void parsearguments(string[] args) { //args[args.length + 1] = "-sn"; log.write("parsing {0} arguments...", args.length); // parse command line arguments (int = 1; < args.length; i++) { //test log.write(args[i]); switch (args[i - 1]) { case "-sn": // parse show name showname = args[i]; break; //... edit: called app written in c++: sprintf(szcommandline, "-sn %n -sd %s -w %d -h %d -t %d -l %d -th %d", szwebshow, szbasedir, iwidth, iheight, itop, ileft, threadid); if(createprocess(playweb_exe,szcommandline, null, null, false, detache

arrays - Groovy, insert node after current node -

i'll try best explain situation. i have following db columns: oid - task - start - end - realstart - realend my requirement have output following: oid1 - task1 - start1 - end1 oid2 - task2 - start2 - end2 where task1 task , task2 task + "real" , start1 start , start2 realstart , end1 end , end2 realend but the first row should created (those start/end fields never empty) second row should created if realstart , realend exist may not true. inputs 6 arrays (one each column), outputs must 4 arrays, this: #input oid,task,start,end,realstart,realend #output oid,task,start,end i thinking using oid.each don't know how add nodes after current one. order important in requirement. for explanation please ask, thanks! after comment , understanding don't want (or cannot) change input/output data format, here's solution you've asked using classes group data , make easier manage: import groovy.transform.canonical @canonical class

Java Entity - storing dates -

how can store dates in format 14-04-2017 in entities? but have parse string. simpledateformat dateformat = new simpledateformat("yyyy-mm-dd"); try { today = dateformat.parse("2017-04-14"); } catch (parseexception e) { //catch exception } and get: fri apr 14 00:00:00 cest 2017 tl;dr localdate.parse( "2017-04-14" ) using java.time you using wrong classes. avoid troublesome old legacy classes such date , calendar , , simpledateformat . supplanted java.time classes. localdate the localdate class represents date-only value without time-of-day , without time zone. iso 8601 your input happens comply iso 8601 standard. java.time classes use standard formats default when parsing/generating strings. no need specify formatting pattern. localdate ld = localdate.parse( "2017-04-14" ); to generate string in same format, call tostring . string output = ld.tostring() ; do not conflate strings date-time objec

java - Writing line, reading line, then closing a socket -

i need connect java tcp/ip socket, in order execute few things: 1) read data socket (the optional 'hello' message), discard it; 2) write single line of data, string, socket; 3) read response socket, single line, , store string; 4) close socket; i wrote code: public string writelinetosocket(string s) throws ioexception { socket socket = null; outputstreamwriter osw = null; bufferedreader = null; string response = null; try { socket = new socket(serveraddress, serverport); = new bufferedreader(new inputstreamreader(socket.getinputstream())); osw = new outputstreamwriter(socket.getoutputstream(), "utf-8"); osw.write(s, 0, s.length()); osw.flush(); response = is.readline(); system.out.println(response); } catch (ioexception e) { e.printstacktrace(); } { if (socket!=null) socket.close();

python - Django URL Case issue -

i'm using following regex build urls follows: ...templates/file url(r'^(?p<slug>[\w-]+)/$', views.template_type, name="template"), url(r'^(?p<template>[\w-]+)/(?p<slug>[\w-]+)/$', views.template_file, name="file"), the first line in here works fine pulling slug field template model. it's second line have problem. in second line the slug pulled file model field template pulled foreign key field in file model of template model although working fine. foreign key pulls title rather slug template model making url case insensitive. eg website.com/template - works fine goes website.com/template/file works, if user deleted file url try go website.com/template 404 error. i hope makes sense. i've tried making urls case insensitive (?i) has not worked. thanks

c++ - GDB set variable from the return of whatis -

gdb whatis returns type of variable. wonder how use result variable. (gdb) whatis myintvalue int (gdb) set $typeint = whatis myintvalue // it's impossible want (gdb) p *($typeint)0xabcd // address having int value i want use above casting generic memory address template class type (which has very long name). and casting type variant hard put every single name while debugging. there's no way assign type convenience variable. however, can saving value in convenience variable , using typeof : (gdb) set $x = 23ll (gdb) ptype $x type = long long (gdb) ptype (typeof($x))'z' type = long long

Laravel Project link is not accessible on localhost -

i new laravel when download laravel , run command php artisan serve gives me project link http://127.0.0.1:8000/ . first time can access link long want when restart machine , access project same link says this site can’t reached tried many times installing new projects same issue. please help you have run command "php artisan serve" every time when wanna start developing.

java - How to configure SafeNamingStrategy for Spring Data JPA with Spring Boot -

in primary entity have 2 instances of embeddable type this: @embeddable public class variabledate { protected instant value; protected customenum type; } @entity public class myentity { protected variabledate begin; protected variabledate end; } this yields following exception: caused by: org.hibernate.mappingexception: repeated column in mapping entity: de.company.myentity column: value (should mapped insert="false" update="false") according this response need specify naming strategy: org.hibernate.cfg.defaultcomponentsafenamingstrategy i tried specifying naming strategy in application.properties according spring boot documentation : spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.cfg.defaultcomponentsafenamingstrategy spring.jpa.hibernate.naming.physical-strategy=org.hibernate.cfg.defaultcomponentsafenamingstrategy i tested combinations (both @ same time, each individually , none), unfortunately receive

python - Not able to move second paddle in pong clone written with pygame -

so have small problem. i beginner , making first game, chose pong clone. however, can not move second paddle keys , z , life of me can´t find out why. i extremely grateful if me. heads up, laud mean paddle, pall means ball , aken means screen. not native speaker.

python 2.7 - cannot get response from Bokeh RadioButtonGroup -

Image
i trying understand how use interactivity in radiobuttongroup using bokeh , customjs python function. have tweaked the example provided @ bokeh site plotting y=x^f. instead of using slider power f, toggle between 2 powers, f=0.5 , f=0.2. have followed manual , inserted radiobuttongroup in code using jupyter notebook. buttons showing , responsive, unable callback response out of toggling buttons. any appreciated. from math import pi bokeh.io import output_file, show bokeh.layouts import column bokeh.models import columndatasource, customjs, slider, textinput, radiobuttongroup bokeh.plotting import figure, output_notebook output_notebook() x = [x*0.005 x in range(0, 200)] y = x source = columndatasource(data=dict(x=x, y=y)) plot = figure(plot_width=400, plot_height=400) plot.line('x', 'y', source=source, line_width=3, line_alpha=0.6) def callback(source=source, input1=input1, window=none): data = source.data m= input1.active

swift3 - How to migrate array.withUnsafeMutableBufferPointer from swift 2 to swift 3? -

i want use code this link in swif 2 public protocol sglimagetype { typealias element var width:int {get} var height:int {get} var channels:int {get} var rowsize:int {get} func withunsafemutablebufferpointer( @noescape body: (unsafemutablebufferpointer<element>) throws -> void ) rethrows } a class implemented above protocol: final public class sglimagergba8 : sglimagetype { ... public func withunsafemutablebufferpointer(@noescape body: (unsafemutablebufferpointer<uint8>) throws -> void) rethrows { try array.withunsafemutablebufferpointer(){ // unsafe reinterpret cast. careful here. let st = unsafemutablepointer<uint8>($0.baseaddress) try body(unsafemutablebufferpointer<uint8>(start: st, count: $0.count*channels)) } } in swift 3, line let st = unsafemutablepointer<uint8>($0.baseaddress) throws error: 'init' unavailable: use 'withmemoryrebound(to:capacity

numpy - How do I show a plot of Random.gammavariate distribution? -

i little confused @ different distribution functions out there (i.e. numpy, scipy, matploglib.mlab, , random) i trying sampling of gamma distribution numbers use program , plot out distribution being used well. so far doing: import random import matplotlib.pyplot plt import matplotlib.mlab mlab import scipy.special sps import numpy np k = 2.0 theta = 2.0 random.gammavariate(k, theta) # gives me results of gamma distribution # unfortunately, doesn't work # plt.plot(random.gammavariate(k, theta)) # plt.show() # works somehow if don't specify # bins , y - copied https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.gamma.html # , seems work s = np.random.gamma(k, theta, 1000) plt.plot(bins, y, linewidth=2, color='r') any explaining me appreciated. you trying plot curve (or scatter) of 1 dimensional data. can show distribution plotting histogram: plt.hist(np.random.gamma(k, theta,100 )) note 1000 give 1000 points. if want extract inf