Posts

winapi - Pasting image from clipboard to MS Word has wrong aspect ratio -

this question kind of follow this one . i'm using code in first answer region of desktop, , copying clipboard. might seem didn't research, did. problem first contact ctypes, winapi , jazz. ms paint, paint.net , libreoffice can read image perfectly, ms word changes aspect ratio; sets width , height 15cm. my question is: kind of data word expecting? code example great. this current code (same other answer): import ctypes ctypes import wintypes pil import imagegrab io import bytesio msvcrt = ctypes.cdll.msvcrt windll = ctypes.windll kernel32 = windll.kernel32 user32 = windll.user32 gdi32 = windll.gdi32 img = imagegrab.grab() output = bytesio() img.convert("rgb").save(output, "bmp") data = output.getvalue()[14:] output.close() cf_dib = 8 gmem_moveable = 0x0002 global_mem = kernel32.globalalloc(gmem_moveable, len(data)) global_data = kernel32.globallock(global_mem) msvcrt.memcpy(ctypes.c_char_p(global_data), data, len(data)) kernel32.globalunloc...

c# - How to set the binding of an itemscontrol to a different ViewModel? -

i've been trying bind list itemscontrol , continually come binding issues i've come help. my code far is: ... <ssm:recentfilesviewmodel x:key="recentfilesvm" /> ... <itemscontrol itemssource="{binding source={staticresource recentfilesvm}, path=files} margin="0 4 0 0"> <itemscontrol.template> <datatemplate> <telerik:radribbonbutton width="285"> <textblock margin="0 0 0 2" text="{binding path}" /> </telerik:radribbonbutton> </datatemplate> </itemscontrol.template> </itemscontrol> i can list appear if set datacontext entire window means of other bindings don't work. object requires viewmodel want set unique itemscontrol. can please me working? it's driving me insane. edit: i have way because there no direct view model other objects. we're trying keep decoupled possible there no...

scala - How to convert an anonymous function to a method value? -

with code val foo = list('a', 'b', 'c') astring.forall(foo.contains(_)) intellij highlights foo.contains(_) , suggests "anonymous function convertible method value". have researched eta expansion, unable see how improve particular piece of code. ideas? i believe it's saying have val foo = list('a', 'b', 'c') astring.forall(foo.contains) note we're not explicitly converting foo.contains method here anonymous function.

java - Try and Catch for simple calculator input -

this program written in java serves calculator. can tell me how implement try/catch block if user tries input result text can handle incorrect workflow? here code: package simplecal; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class simplecal extends jframe { jtextfield jftinput1, jftinput2, jftresult; jbutton jbtminus, jbtadd,jbtdivid, jbttimes; final int jtext_size = 5; simplecal(){ setlayout(new flowlayout()); jftinput1 = new jtextfield(jtext_size); jftinput2 = new jtextfield(jtext_size); jftresult = new jtextfield(jtext_size); add(new jlabel("input 1: ")); add(jftinput1); add(new jlabel("input 2: ")); add(jftinput2); add(new jlabel("result ")); add(jftresult); jpanel p1 = new jpanel(); jbtminus = new jbutton("subtract"); jbtadd = new jbutton("add"); jbttimes = new jbutton("multiple"); jbtdivid = new jbut...

asp.net - Left join using a different or not equal in Entity Framework -

i have build query users did not received , alert new posts. my relevant table structure follows: posts: postid int users: userid int, email varchar postalertusers: postalertuserid int, postid int, userid int all related fields have fk constraints between tables. i've built query in sql couldn't find way work in entity framework: select u.email users u inner join posts p on p.userid != u.userid left join postalertusers pu on u.userid = pu.userid , p.postid = pu.postid pu.postalertuserid null i've wrote following ef query, didn't got same results: from u in context.users join pu in context.postalertusers on u.userid equals pu.userid postalerts pa in postalerts.defaultifempty() join p in context.posts on pa.postid equals p.postid pa.userid != u.userid select u.email; how can same results using linq entities. using dot syntax (i don't know correct term dbset.where(x => ...) syntax) better. edit: i want users didn't have record on posta...

python imaging library - IOError: cannot identify image file -

can tell why pil can't open png file? https://b75094855c6274df1cf8559f089f485661ae1156.googledrive.com/host/0b56ak7w-hmqax005c3g5etlbake/8.png i ioerror: cannot identify image file, , looking @ code, seems tries pil.pngimageplugin.pngimagefile , corresponding "accept" function, , returns false i'm using version 1.1.6 i don't know problem pil 1.1.6 tested latest pillow 2.4.0 , worked: >>> pil import image >>> im = image.open("8.png") >>> im.show() pil in unmaintained , pillow actively maintained , developed fork. use pillow, first uninstall pil, install pillow. further installation instructions here: http://pillow.readthedocs.org/en/latest/installation.html

javascript - how create a flag with EaselJS -

i find simple canvas flag, have question of how can make easeljs ? because in easeljs documentation don't says about, make canvas "without dom interaction" , , change pixel positions, in easeljs documentation can't find how make it, , have questions: 1 can merge easeljs code normal canvas code? explanation, if draw animated north korean flag star textures, can make static draw easeljs , , animate naked canvas code? 2 possible make other library?, such limejs or other libraries 3 must use webgl library ?, such three.js?