Posts

c# - How to send a proper message to Console application using user32.dll's SendMessage -

i'm trying send text console when requires console.readline() input, different thread (windows form textbox). problem can't seem figure out how send text , have show wrote it. example: "test test 123" show in console as: test test &é" image: http://puu.sh/gijw8/e9f4d94bd5.png using system; using system.windows.forms; using system.io; using system.runtime.interopservices; using system.diagnostics; namespace consoleapplication1 { public partial class form1 : form { [dllimport("user32.dll", entrypoint = "postmessagea")] private static extern bool postmessage(intptr hwnd, uint msg, intptr wparam, int lparam); [dllimport("user32.dll")] static extern short vkkeyscan(char ch); [dllimport("user32.dll", entrypoint = "sendmessagea")] public static extern int sendmessage(intptr hwnd, int umsg, int wparam, string lparam); [dllimport("kernel32...

Use of All CAPS in Scala Code -

the common practice in java use caps static final variables: static final int my_constant = 24 i believe common practice in scala val use: val myconstant = 24 is there accepted place use caps, in java, in scala? according the official guidelines : no. in practice all_caps means "all caps, separated underscores," , scala doesn't want using underscores in names. generally speaking, scala uses “camelcase” naming conventions. is, each word (except possibly first) delimited capitalizing first letter. underscores ( _ ) heavily discouraged have special meaning within scala syntax.

Swift and watchkit: pushControllerWithName not being called at all -

i have used pushcontrolledwithname method in swift/watchkit move interface controller, this: self.pushcontrollerwithname("newinterfacecontroller", context: nil) in of projects, when put in function (like user presses button) doesn't called @ all. no errors, if code isn't there @ all. if create new test project , try it works. baffled what's going on here. example of happens: @ibaction func button1action() { println("test") self.pushcontrollerwithname("newinterfacecontroller", context: nil) } pressing button print "test" in console, doesn't try move new interface controller (with identifier "newinterfacecontroller") @ all. i think you've figured out comments, page-based interfaces technically modals , not navigation-stack interfaces. you can present modals anywhere, can push onto navigation stack non-modal.

using Regex and linux commands(grep or egrep?) to find specific strings -

note : not sure regex's correct since textbook @ school not explain/teach regex's of form of math form such dfa's/nfa i appreciate suggestions or hints question: (a) find occurrences of 3 letter words in text begin `a' , end 'e'; (b) find occurrences of words in text begin `m' , end 'r'; my approach: a) ^[a][a-za-z][e]$ (how distinguish between 3 letter words , words?) b) ^[m][a-za-z][r]$ also want use these regex's in linux following command work?: grep '^[a][a-za-z][e]$' 'usr/dir/.../text.txt' or should use egrep in way: find . -text "*.txt" -print0 | xargs -0 egrep '^[a][a-za-z][e]$' you can use word boundary \b match start , end of word: a) find occurrences of 3 letter words in text begin `a' , end 'e'; grep -o '\ba[a-za-z]e\b' the pattern matches word boundary, following a , single character , following e , word boundary. b) find occurrence...

jquery - Overlapping table td elements using E-shopper template -

Image
i using template little project , have been stuck on part while, elements of table overlapping when there many words inside td. link specific page: here also if resize browser notice overlapping if there not many words inside description td. for tried using max-width set width still not favorable result since there still overlapping present. is there anyway me around problem or solve it? also responsive template. the content of description this: tired of bones while eating? try our boneless chicken breast can swallow whole , no bones worry about. you need set width .cart_info table tr td . example: .cart_info table tr td{ width: 30%; } or if want target .cart_description .cart_info table tr .cart_description{ width: 30%; } i made width: 30% testing purposes. can specify whatever width want.

cron - perl search replace is appending not replacing -

i have perl script in cron runs every x minutes. suppose find string , replace string more data: s/remote_phonebook.data.1.name =/remote_phonebook.data.1.name = users/; i expect this: before: remote_phonebook.data.1.name = after: remote_phonebook.data.1.name = users the first time runs works fine. however, each additional time appends end of line 3 cron jobs later see: remote_phonebook.data.1.name = users users users how can make if "users" doesn't exist, add it, if exists, ignore? if each 1 of these new line try: $s =~ s/remote_phonebook\.data\.1\.name =( users|$)/remote_phonebook.data.1.name = users/; if not, please let me know on comments.

arrays - using python itertools to manage nested for loops -

i trying use itertools.product manage bookkeeping of nested loops, number of nested loops not known in advance. below specific example have chosen 2 nested loops; choice of 2 clarity, need solution works arbitrary number of loops. this question provides extension/generalization of question appearing here: efficient algorithm evaluating 1-d array of functions on same-length 1d numpy array now extending above technique using itertools trick learned here: iterating on unknown number of nested loops in python preamble: from itertools import product def trivial_functional(i, j): return lambda x : (i+j)*x idx1 = [1, 2, 3, 4] idx2 = [5, 6, 7] joint = [idx1, idx2] func_table = [] items in product(*joint): f = trivial_functional(*items) func_table.append(f) at end of above itertools loop, have 12-element, 1-d array of functions, func_table , each element having been built trivial_functional. question: suppose given pair of integers, (i_1, i_2), these integers inte...