Posts

c# - Detecting and replacing all smilies in a string -

this question has answer here: mysql server not support 4-byte encoded utf8 characters 8 answers i have integration facebook , have notice thay sends example u+1f600 called grinning face. when try store in mysql text field server not support 4-byte encoded fast solution remove these special chars string. the question how? know u+1f600 suspect there more of them. consider switching mysql utf8mb4 encoding... https://mathiasbynens.be/notes/mysql-utf8mb4

node.js - How to find a sub document in mongoose without using _id fields but using multiple properties -

i have sample schema - comment.add({ text:string, url:{type:string,unique:true}, username:string, timestamp:{type:date,default:date} }); feed.add({ url:{type:string, unique:true }, username:string, message:{type:string,required:'{path} required!'}, comments:[comment], timestamp:{type:date,default:date} }); now, don't want expose _id fields outside world that's why not sending clients anywhere. now, have 2 important properties in comment schema (username,url) want update content of sub document satisfies feed.url comment.url comment.username if comment.username same client value req.user.username update comment.text property of record url supplied client in req.body.url variable. one long , time consuming approach thought first find feed given url , iterating on subdocuments find document satisfies comment.url==req.body.url , check if comment.username==req.user.username if so, update comment object. but, think...

javascript - active item li on menu where hover -

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <div id="topbar"> <ul> <li class="active"> <a href="">about us</a> </li> <li> <a href="">services</a> </li> <li> <a href="">gallery</a> </li> <li> <a href="" class="nav-quote-button">get quote</a> </li> </ul> </div> how set class active on li 2,3,4... hover, , remove class active has go thank you! unless need active kind of query down line (i don't know why would, though), try css. li:hover { // active class css here } you can add further selectors li keep...

java - How to change JFileChooser label "Look in:" to "Save in:" (not title)? -

Image
how change jfilechooser label "look in:" "save in:" (not title)? here can see want change: i found solution, maybe useful too: jfilechooser chooser = new jfilechooser("open"); //set text , language of components in jfilechooser uimanager.put("filechooser.opendialogtitletext", "open"); uimanager.put("filechooser.lookinlabeltext", "lookin"); uimanager.put("filechooser.openbuttontext", "open"); uimanager.put("filechooser.cancelbuttontext", "cancel"); uimanager.put("filechooser.filenamelabeltext", "filename"); uimanager.put("filechooser.filesoftypelabeltext", "typefiles"); uimanager.put("filechooser.openbuttontooltiptext", "openselectedfile"); uimanager.put("filechooser.cancelbuttontooltiptext","cancel"); uimanager.put("filechooser.filenameheadertext","filename"); ...

c# - How can I pass values of a listview from aspx page to another ? -

i working on class project creating listview in 1 .aspx page. can display database through list view cannot transfer value of selected item .aspx page another. my designing code below: <asp:listview id="lvpresent" runat="server" datasourceid="sqldatasource1" onitemdatabound="lvpresent_itemdatabound" > <layouttemplate> <table> <tr> <td></td> </tr> </table> <asp:placeholder id="itemplaceholder" runat="server"></asp:placeholder> </layouttemplate> <itemtemplate> <td> <asp:hyperlink id="hyperlink1" runat="server"> <asp:image id="imagebutton1" runat="server" imageurl='<%#eval("url")%>' height="200px" width=...

pthreads - Can't pass in struct into function for pthread_create correctly -

i'm trying pass in professor struct professor function can't information stored in pass function. suspect has how malloc'd p thought freeing after it's completed solve problem. segfault when try print *professor->id, because apparently decides read p memory location 0x0, though it's not in main typedef struct{ int *id; int *assignings; int *min_wait; int *max_wait; int *min_assignments; int *max_assignments; int *min_hrs; int *max_hrs; } professor; professor* makeprofessor(){ professor *professor = malloc(sizeof *professor); return professor; } void * professorfunc(void *p){ professor *professor = (professor*)p; fprintf(stdout,"starting professor %d\n", *professor->id); pthread_exit(0); } int main(int argc, char **argv){ //creating threads pthread_t professor[num_professors]; professor *p; int i; int id; for(i = 0; < num_professors; ++i){ id = + 1; ...

r - frequency() and cycle() of a monthly xts object returns value "1" -

i have monthly xts object, , function frequency() returns value of 1, expect 12. function cycle() not return month numbers, instead value of 1 each observation. library('quantmod') getsymbols("gs10", src="fred") frequency(gs10) cycle(gs10) try this: time(gs10) <- as.yearmon(time(gs10))