Posts

Is there a Data Type in Python which cannot be typecast in string -

lets ' a ' of type (which want know!) doing thing like: b = str(a) this should favorably raise typeerror there no builtin python class raises typeerror str , define custom class: class foo(object): def __str__(self): raise typeerror('can not stringified') foo = foo() b = str(foo) raises typeerror .

c# - How to simulate pressing Fn+F6? -

method sendkeys.send not allow press fn key, exists on laptop's keyboards. how can simulate pressing key c#? you can't, , don't need to. fn key exists key far keyboard circuit concerned. when key code sent operating system, looks if function keys regular keys on regular keyboard. operating system doesn't know fn key exists, taken care of special keyboard circuit in laptop. to make function key press on laptop, send regular key code function key on regular keyboard. if there other key combinations fn key used, either have own key codes, or not possible send because handled laptop, not operating system.

c++ - About Qt MessageBox::warning() overloading -

qmessagebox::warning(this,tr("error"), tr("file existed")); i use qtcreator msvs2012,win7. "this" points class public inherited qwizard class, compiler output is error c2665: “qmessagebox::warning”: 4 个重载中没有一个可以转换所有参数类型 d:\qt\qt5.1.0\5.1.0\msvc2012_64\include\qtwidgets\qmessagebox.h(197): 可能是“qmessagebox::standardbutton qmessagebox::warning(qwidget *,const qstring &,const qstring &,qmessagebox::standardbuttons,qmessagebox::standardbutton)” 尝试匹配参数列表“(const newwizard *const , qstring, qstring)”时 it means none of 4 overloads convert argument types. can give me help? replace this 0 , should work. basically, dialog box doesn't need parent. can stand alone , not have problem. https://qt-project.org/doc/qt-4.8/objecttrees.html and comments question said, can't call warning in const method either. another option rid of const 'ness of newwizard() method. hope ...

nested - Within same regex expression , performing multiple regex operations -

how can perform new regex operation regex group , within same regex expression ? "nested regex operations maybe?" greetings , kind of understand how regex works havent been able perform operation yet using regex , can c# combined regex. as in example. "the quick 1234brown fox jumps on lazy 1234dog" the regex (quick 1234brown fox jumps on lazy) yields "quick 1234brown fox jumps on lazy" and im looking "1234" . first result. using regex (1234) "quick 1234brown fox jumps on lazy" return "1234". in c# im able make work using regex multiple times. string test_string = "the quick 1234brown fox jumps on lazy 1234dog"; string clipped_text = ""; string end_result = ""; var match = regex.match(test_string, "quick 1234brown fox jumps on lazy", regexoptions.singleline); if (match.success) { clipped_text = match.value; match = regex.mat...

sql - Can Rails array be "unzipped"? -

i using following queries in customer model call obtain desired set of transactions. transactions = sub_account.transactions transaction_items = transactions.map{|transaction| [transaction.transaction_items]} however, returning array of array of hashes. rails console [ [# <transactionitem id: 29, amount: 20>, #<transactionitem id: 35, amount: 40>],<br> [# <transactionitem id: 31, amount: 30>, #<transactionitem id: 38, amount: 30>],<br> [# <transactionitem id: 43, amount: 30>, #<transactionitem id: 21, amount: 40>],<br> ] this process works well. trying run query on transaction_items can't becuase they're embedded in array. here final desired query unable run. transaction_items.where(:amount => 30).sum("amount") i know can zip array, can unzip it? can't find documentation on it. if no unzip, can adapt query work on embedded arrays? thanks. what about: transactions_items = ...

JavaScript Settings missing in PHP project settings -

Image
i'm using netbeans 7.3.1. i can see javascript files section in netbeans projects settings when create html5 project. but want same php projects. after want able add dependencies could, when using html5 project. is there workaround show javascript files in php projects? regards,

c++ - How to emit signal through a few class objects in Qt? -

Image
i have few classes: class - highest class, class b , class c initialized in class constructor. in class b constructor initialized class b1 , in class c constructor initialized class c1. c1 object , b1 object not see each other. every time need send signal c1 class b1 class, connecting c1 , c, c , b, finally, b , b1. every time programm emitting signal in c1 class object, sending c class object b , b1. (on image) right qt way? or there better way that? you add class c interface returns c1 , similar interface class b, too. after creating classes c , b, class ask c1 , b1 , connect c1's signal b1's slot. or, if have lots of these kind of cases , don't want expose classes c1 , b1 a, create own signaling mechanism. kind of "post office" classes register receivers , classes send messages. in case, class b1 register receiver , class c1 send messages. c1 , b1 know nothing each other. post office class send c1's message b1. kind of "post office...