Posts

Showing posts from September, 2015

apache - VirtualHosts not working? -

i can't seem virtualhosts working... think i'm clueless i'm doing. httpd.conf namevirtualhost * <virtualhost *> servername localhost documentroot "/applications/mamp/bin/mamp" <directory "/applications/mamp/bin/mamp"> options indexes followsymlinks includes execcgi allowoverride none order allow,deny allow </directory> </virtualhost> # rev.dev <virtualhost *> servername revcms.dev documentroot "/users/manuel/sites/rev" <directory "/users/manuel/sites/rev"> options indexes followsymlinks includes execcgi allowoverride none order allow,deny allow </directory> </virtualhost> etc/hosts ## # host database # # localhost used configure loopback interface # when system booting. not change entry. ## 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.

math - transfer the co-ordinates error in function -

i trying transfer coordinates of points new generated system coordinates the original points in original system in top left corner .... i wrote following function transfer coordinates using formal got question pre_question question has 2 photos show mean , sign each part the problem , getting negative value w ! can please check function , let me know problem thanks { cvpoint transfer_coordinate (cvpoint pt1 , cvpoint pt2 , cvpoint pt3 , cvpoint pt4 , cvpoint origin , cvpoint current) { // pt1 , pt2 ==> points in line z // pt3 , pt4 ==> points in line w double a1 , a2 , b1 , b2 , d1 , d2; d1= sqrt(pow((pt1.x - pt2.x),2.0)+ pow((pt1.y - pt2.y),2.0)); d2= sqrt(pow((pt3.x - pt4.x),2.0)+ pow((pt3.y - pt4.y),2.0)); a1 =(pt1.y-pt2.y)/d1; b1 =(pt2.x-pt1.x)/d1; a2 =(pt3.y-pt4.y)/d2; b2 =(pt4.x-pt3.x)/d2; cvpoint new_point; //z = -sqrt(a1^2+b1^2)*(a2*(x-x0)+b2*(y-y0))/(a2*b1-a1*b2) //w = sqrt(a2^2+b2^2)*(a1*(x-x0)+b1*(y-y0))/(a1*b2-a2*b1) //z new_point.x = -r

c - Creating a two-dimensional array of fixed-length strings (character arrays) -

so i've been trying create object in c 2 columns of empty char arrays. contents resemble char * strings[3][2] { {"thing1", "value1"} {"thing2", "value2"} {"thing3", "value3"} } ...except actual char *s empty arrays fixed length, rather initialized strings, i.e. each string "char string[6]". i've been searching time i'm coming dry. happen know syntax creating such object? maybe this: typedef char sixchars[7]; sixchars strings[3][2] = { { "thing1", "value1" } , { "thing2", "value2" } , { "thing3", "value3" } };

c# - Castle Windsor instance configuration -

i trying implement configuration (from distributed cache) injection using castle windsor message handler. the configuration of single instance straight forward, i'm not sure best way provide different configuration multiple instances, injected same class i have following class hierarchy, , injection working ok, cant create different configurations iadapter instances: public interface iadapter { void send(string message) string receive(); } public interface imsmqadapterconfig { string queuename {get;set;} } public class msmqadapter { private readonly imsmqadapterconfig _config; public imsmqadapter(imsmqadapterconfig config) { _config = config; } public void send(string message) { string queuename = _config.queuename; // queuename } } public class messageprocessor { private readonly iadapter _input; private readonly iadapter _output; public messageprocessor(iadapter input, iadapter output)

git - Push commit to 2 different remote branches? -

i have 2 remote branches, branch , branch b. consider case checkout branch a, made commit , pushed. now, want push same commit branch b. these 2 branches pretty different cannot user rebase , can i? because if git rebase rebase changes 1 branch another, need 1 commit. how can that? ps. in stupid way: checkout branch b, cherry pick last commit branch a, , push b (remote). way don't need switch branch b. that git cherry-pick for. since branches different each other , don't want merge or rebase 1 commit, option.

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -

Image
is possible create , use 'custom' prototype table cells in xamarin ios (monotouch) using storyboard? i find stuart lodge explaining method using xib/nibs: http://www.youtube.com/watch?feature=player_embedded&v=vd1p2gz8jfy let's answer question! looking one. :) 1) open storyboard have viewcontroller tableview: add prototype cell (if there no cell added before): customize cell want (in case there custom uiimage , label): remember set height of cell. select whole tableview , properties window select "layout" tab. on top of properties window should see "row height" - put appropriate value: now select prototype cell once again. in properties window type name of class (it create code-behind class it). in case "friendscustomtableviewcell". after provide "identifier" cell. can see "friendcell". last thing set "style" property set custom. "name" field should empty. once click &

r - How to include a \perp symbol in a ggplot2 annotation? -

i put annotation : e \perp c using ggplot2 annotate("text", label = ...) . i searched quite thorougly on web managed lone symbol using annotate("text", label = "symbol('\136')", parse = t) . does have solution ? plotting code page: p <- ggplot(df, aes(x = gp, y = y)) + geom_point() + geom_point(data = ds, aes(y = mean), colour = 'red', size = 3) p+geom_text( aes(x="b", y=-0.4, label = "e(y)*symbol('\\136')*b" ), parse = true) after getting work able annotate(text"...) working: p+annotate("text", 1, -0.4, label="e(y)*symbol('\\136')*b", parse=true) the tricks: mix quoting characters did use plotmath syntax i'm guessing might not have used. edit: * not quoting character. if anything, should called linking character. in plotmath syntax every "atom" or function call needs separated (or "linked-to" de

java - How can I turn off extra logging? -

i have java service uses spring , cxf. code previous developer , i'm providing maintenance, i'm seeing in logs -------------------------------------- apr 16, 2013 1:44:11 pm org.apache.cxf.interceptor.abstractlogginginterceptor log info: inbound message ---------------------------- id: 33 address: /myapplication/endpoint encoding: utf-8 http-method: post content-type: application/x-www-form-urlencoded headers: {content-type=[application/x-www-form-urlencoded], connection=[close], host= [localhost:8080], content-length=[11504], user-agent=[apache-httpclient/4.2.3 (java 1.5)], content-type=[application/x-www-form-urlencoded]} payload: { "events" : [ { event }, { event }, ... ] } and have many events, , log becoming unmanageable. there way can turn off logging? these log calls not created inside app, created kind of interceptor can't find. did find in cxf-context.xml config file: <cxf:bus> <cxf:features> <cxf:logg

javascript - JQuery Using Cell Data to Reform Cells -

i'm using jquery, csvtotable (plugin here: https://code.google.com/p/jquerycsvtotable/ ) plugin convert large csv files tables can manipulate. need attach links relevant each row. i need convert text in 1 of these rows add link pdf. problem can't seem modify strings. i'm using data found here: http://jsfiddle.net/bstrunk/vacuy/297/ the file names generated system can't edited, i'm stuck using these formats: 423-1.pdf so need convert 2 strings tables formatted so: 4/23/2013 1 to drop year, slashes, , add '-' , digit. i'm able grab table data, can't seem manipulate variables either .replace or .substr $(document).ready(function () { $("tr td:nth-child(5)").each(function () { var $docket = $('td=eq(5)'); var $td = $(this); var $datadate = $td.substr(0, $td.lastindexof("/")); var $newdatadate = $datadate.replace("/", ""); $td.html('<

linux - Difference between a Hard Link and its Program in C -

i'm writing program similar disk usage utility on linux, , i'm having trouble when comes hard links. i have program running, , determines whether program has hard links. use stat() on file determine this. if (st.st_nlink > 1) when run this, both link , program linked return, disk usage utility report program , not hard link. how tell difference between program , hard link(s) in linux using c? first, why handle differently program , data files multiple hard links? then, matters not name or number (notice hard links add name file), inode . "file" (i.e. inode) having more 1 hard links, names pointing same inode of equal rights (there no "main" name, names pointing same inode equivalent). so after calling stat(2) syscall want use both st_dev , st_ino fields. uniquely identify file, inode. hence, files st.st_nlink>1 you'll add ( st_dev , st_ino ) pair hashtable or set container. in c++ use std::set<std::pair<dev_

foreach - How to pause for-each iterations php beginner -

for reason code not pause in between iterations, expecting pause second between loading thumbnails. doing wrong? foreach ($media->data $data) { echo "<img src=\"{$data->images->thumbnail->url}\">"; sleep(1); } if expecting generated code reach client-side before terminating script, may have force flush it: foreach ($media->data $data) { echo "<img src=\"{$data->images->thumbnail->url}\">"; @ ob_flush(); @ flush(); sleep(1); } but stupid, , cause formatting issues in client-side. why don't else , send whole page @ once? or better client-side control of loaded , in pace, use javascript.

Load a value into a register in LC3 -

is there single lc3 instruction load value register? need write assembly code , come need write single instruction store value 1 in r1. ld r1, value do .fill on "value" whatever value want load r1. don't believe there's way load literal value register single line, can 1 instruction , 1 label.

kml, High Performance KML for Maps and Earth, not working -

i made kml file mimic example " high performance kml maps , earth'-on youtube-link (at 15:11-16:05 or 15:51) this presentation on friday, on rush work, thanks. i error: validation stopped @ line 2, column 45: no decleration found element 'kml' when try run code googl earth crashes. here code: <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <placemark> <gx:track> <when>13:51</when> <gx:coord>-147.871 64.861</gx:coord> <extendeddata> <schemadata schemaurl="#schema"> <gx:simplearraydata name="pm 2.5"> <gx:value>0.0</gx:value> <gx:value>-6.0511e+15</gx:value> <gx:value>180</gx:value> </gx:simplearraydata> </schemadata> </extendeddata> </gx:track> </placemark> <placemar

python - Nested Django Forms: 'ManagementForm data is missing or has been tampered with' -

so i've looked around , seems nobody has had same problem having cause seemingly common error. rendering forms in html follows: <form method="post" action=""> {{ tags_formset.management_form }} <!-- code displaying formset --> ... <!-- --> <form method="post" action=""> {{ add_all_form.management_form }} {{ add_all_form.addtagstoall }} <input type="submit" value="add displayed applicants" /> </form> <form method="post" action=""> {{ remove_all_form.management_form }} {{ remove_all_form.removetagsfromall }} <input type="submit" value="remove displayed applicants" /> </form> <input type="submit" value="save changes" /> </form> when did not have 2 inner forms formset displayed correctly , submit button works submit form. whe

string - Getting the remainder of a stringstream c++ -

i have stringstream need first part out , remainder separate string. example have string "this car" , need end 2 strings: a = "this" , b = "is car" . when use stringstream first part using << ,then use .str() convert string of course gave me whole thing " this car" . how can play how want? string str = "this car"; std::stringstream ss; ss << str; string a,b; ss >> a; getline(ss, b); edit: correction @cubbi: ss >> >> ws; edit: this solution can handle newlines in cases (such test cases) fails in others (such @rubenvb's example), , haven't found clean way fix it. i think @tacp's solution better, more robust, , should accepted.

c++ - Dijkstra's algorithm pseudocode -

Image
i'm trying write dijkstra's algorithm in c++, , there countless examples on internet can't seem grasp how examples work. i'd rather in way makes sense me can understand algorithm better. know how algorithm should work, , have written code. wondering if point out flaw in thought process. i'm choosing represent graph edge list. i'll write in pseudocode because actual code huge mess: class node{ vector<node> linkvector; //links other nodes, generated @ random int cost; //randomly generated constructor bool visited = false; } vector<node> edgelist; //contains nodes int main(){ create n nodes add nodes edgelist each node { randomly add weight nodes linkvector } findpath(initialnode) } int findpath(node start, node want, int cost=0){ //returns cost src dest if(start==want) return cost; if(every node has been visited) return 0; //this in case of failure node result = getmi

php - array_diff not returning what's expected -

i've read tutorials on here none of them return need. have 2 arrays. $arraya = array(1960,1961,1963,1962,1954,1953,1957,1956,1955); $arrayb = array(1949,1960,1961,1963,1962,1954,1953,1957,1956,1955); however, when run array_diff, returns empty array. $diff = array_diff($arraya, $arrayb); but i'd return 1949. what's error in code? edit: since switching variables won't work, did var_dump 3 arrays (a, b, , diff) , here's pastebin http://pastebin.com/tn1dvcs3 array_diff works finding elements in first array aren't in second, per documentation . try inverting call: $diff = array_diff($arrayb, $arraya); to see in action, lets @ more manageable equivalent example: $arraya = array(1960); $arrayb = array(1949,1960); $diff = array_diff($arrayb, $arraya); var_dump($diff); this yields: [mylogin@aserver ~]$ vim test.php [mylogin@aserver ~]$ php test.php array(1) { [0]=> int(1949) } please note uses minimal demonstrative example of

Mule not rolling back JMS message after exception -

my flow consumes message based on cron expression , have deliberately added groovy code throw exception testing jms rollback. rollback doesn't return consumed message in queue. missing here ? here mule flow supposed rollback mule message after exception encountered. <jms:activemq-connector name="jmsconnector" specification="1.1" brokerurl="tcp://localhost:61616" /> <jms:endpoint name="testqueue" queue="test.queue" connector-ref="jmsconnector" /> <flow name="quartzbaseddelivery"> <quartz:inbound-endpoint jobname="deliveryjob" cronexpression="0 0/1 * * * ?"> <quartz:endpoint-polling-job> <quartz:job-endpoint ref="testqueue" /> </quartz:endpoint-polling-job> </quartz:inbound-endpoint> <logger message="quartz found message delivery #[payload]" level="info" /> <

sql - Cannot insert NULL values into database -

we use jpa load/persist our entities in prostges database. in 1 case must persist entity native query. heres code: string sql = "insert recording (id,creationdate,duration,endtime,filemaninfocomplete,lastupdated,packagesdeletetime,rcinfocomplete," + "rcrecordingkept,recordstate,recordingtype,starttime,tenantid,recordingnode_id,transcription_id) " + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; query query = getentitymanager().createnativequery(sql); query.setparameter(1, recording.getid()); query.setparameter(2, new date(), temporaltype.timestamp); query.setparameter(3, recording.getduration()); query.setparameter(4, recording.getendtime(), temporaltype.timestamp); query.setparameter(5, recording.isfilemaninfocomplete()); query.setparameter(6, new date(), temporaltype.timestamp); query.setparameter(7, recording.getpackagesdeletetime(), temporaltype.timestamp); query.setparameter(8, recording.isrcinfocomplete()); query.setp

Ruby CSV enumeration confusion -

how come not work? csv there , has values, , have 'require "csv" , time @ top, there. problem seems csv.each doing anything. it returns => [] common registration hour => [] common registration day (sunday being 0, mon => 1 ... sat => 7) if there more info can provide, please let me know. @x = csv.open \ 'event_attendees.csv', headers: true, header_converters: :symbol def time_target y = [] @x.each |line| if line[:regdate].to_s.length > 0 y << datetime.strptime(line[:regdate], "%m/%d/%y %h:%m").hour y = y.sort_by {|i| grep(i).length }.last end end puts "#{y} common registration hour" y = [] @x.each |line| if line[:regdate].to_s.length > 0 y << datetime.strptime(line[:regdate], "%m/%d/%y %h:%m").wday y = y.sort_by {|i| grep(i).length }.last end end puts "#{y} common registration day \ (sunday being 0, mon => 1 ... sat => 7)" e

selection - Zend Studio selecting full Block -

is there way select full block in zend studio? can use ctrl + shift + p and jump end of block there way select block code ? you use shift + down combination and change toggle mark occurence mode (alt+shift+o) if double click on { it's selecting block.

asp.net - Make asp label invisible using timer -

i have show label indicating success of insertion of data. label should disappear automatically after 5 seconds how can achieve this?? <html> <head id="head1" runat="server"> <title>test visibility</title> <script type="text/javascript"> $(document).ready(function () { settimeout(function () { $('#<%= lblerror.clientid%>').hide(); }, 100); // <-- time in milliseconds }); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:label id="lblerror" runat="server" text="label"></asp:label> </div> </form> </body> </html> you can use jquery this. call function , hide after particular duration. settimeout(function() { $('#labelid').hide(); }, 1000); // <-- time in milliseconds suppose have label <asp:label id="lblresult&q

how to install ffmpeg on macbookpro osx 10.8.3 -

i have downloaded ffmpeg link http://www.ffmpeg.org/download.html under ffmpeg mac os x builds section, builds come .7z extension need how configure on machine. the best way install ffmpeg use homebrew ruby -e "$(curl -fssl https://raw.github.com/mxcl/homebrew/go)" the above command install homebrew , install ffmpeg use following command brew install ffmpeg cheers

How to index apache nutch fetched content without parsing into solr -

i need index fetched content crawled nutch solr. solrjob in nutch indexes parse content. , need content html tags. can guide me on this? thanks sudh nutch has series of parsers , filters extract content fetched html. you need implement htmlparserfilter, write raw content metatag , insert solr field. the tutorial below indexing filter follows same flow. nutch plugin your class should implement "htmlparsefilter" instead of "indexingfilter". override filter() method: @override public parseresult filter(content content, parseresult parseresult, htmlmetatags metatags, documentfragment doc) { metadata metadata = parseresult.get(content.geturl()).getdata().getparsemeta(); byte[] rawcontent = content.getcontent(); string str = new string(rawcontent, "utf-8"); metadata.add("rawcontent", str); return parseresult; } after that, change schema.xml , add new field: <field name="metatag.rawcontent&quo

jira - Duplicate primary key exception MSSQL server 2008 -

i use mssql server 2008 database web application (jira) , few days had inserted values through database . when try add values through ui following exception . com.atlassian.jira.exception.dataaccessexception: org.ofbiz.core.entity.genericentityexception: while inserting: [genericentity:customfieldoption][id,10815][sequence,7][value,test][customfieldconfig,10400][parentoptionid,null][disabled,n][customfield,10300] (sql exception while executing following:insert dbo.customfieldoption (id, customfield, customfieldconfig, parentoptionid, sequence, customvalue, optiontype, disabled) values (?, ?, ?, ?, ?, ?, ?, ?) (violation of primary key constraint 'pk_customfieldoption'. cannot insert duplicate key in object 'dbo.customfieldoption'. duplicate key value (10815).)) i believe because primary key auto increment value , inserted value through query . can please me . guess resetting autoincrement sequence help. hope helps! fyi, sql server uses called ide

android - Customize the text in Facebook OAuth Dialog -

Image
i using facebook android sdk implement facebook login , access facebook platform apis android app. the oauth dialog follows: currently displays text: log in use your facebook account with... is there way through can change above text as: log in use {user_name}'s facebook account with.. here, can change text {user_name} dynamically? thank you. its not possible. think not important because how know facebook username in he/she going login? if display username provided in application, username provided in facebook might differ username in application. if differs, end user confused why need login other username. word your sufficient make user feel account.

keyboard - Smiles and long press feature in Android -

i've created android keyboard. how add features inserting smilies, , using long keypresses display symbols? to create long-press behavior allows select several options pop-up menu, follow guide (specifically pop-up menu section): http://developer.android.com/guide/topics/ui/menus.html smileys (also known emoticons) combination of keys, understood programs , parsed same way. have do, when clicks smiley face on keyboard, simulate pressing of key combination matching emoticon. example, when clicks smiley, should simulate key presses ':' , ')' :). here's list of emoticons: http://en.wikipedia.org/wiki/list_of_emoticons

SQLite C# WPF reading error -

i new c# , tring read .db file, have added ado.net 2.0 provider sqlite project link: http://sourceforge.net/projects/sqlite-dotnet2/ . getting error when running , can not understand problem. using system; using system.collections.generic; using system.linq; using system.text; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; using system.data; using system.diagnostics; using system.data.sqlite; namespace wpfapplication1.screens { /// <summary> /// interaction logic firstscreen.xaml /// </summary> public partial class firstscreen : usercontrol, iswitchable { public firstscreen() { initializecomponent(); debug.writeline("send debug output."); string connstrin

python - How to send email attachments? -

i having problems understanding how email attachment using python. have emailed simple messages smtplib . please explain how send attachment in email. know there other posts online python beginner find them hard understand. here's another, adapted here : import smtplib os.path import basename email.mime.application import mimeapplication email.mime.multipart import mimemultipart email.mime.text import mimetext email.utils import commaspace, formatdate def send_mail(send_from, send_to, subject, text, files=none, server="127.0.0.1"): assert isinstance(send_to, list) msg = mimemultipart() msg['from'] = send_from msg['to'] = commaspace.join(send_to) msg['date'] = formatdate(localtime=true) msg['subject'] = subject msg.attach(mimetext(text)) f in files or []: open(f, "rb") fil: part = mimeapplication( fil.read(), name=b

java - Tomcat Datasource configuration Connection timeout and Max Active to Idle connection ratio -

i having web application load balanced on 4 servers. these 3 servers connect common database max connections setup 600. my current database pool configuration in tomcat follows: <resource name="jdbc/appdb" auth="container" type="javax.sql.datasource" maxactive="100" maxidle="30" maxwait="10000" removeabandoned ="true" removeabandonedtimeout="300" testonborrow="true" validationquery="select 1" logabandoned ="true" username="username" password="password" driverclassname="com.mysql.jdbc.driver"

android - how to settittle to listview in infater layout? -

Image
i'm new android.. i'm facing problem tittle listview.. how implement tittle list view? me.. i try this.. layoutinflater inflater = (layoutinflater) getsystemservice(context.layout_inflater_service); viewlist = nexttopic.this.getlayoutinflater().inflate(r.layout.activity_nexttopic, null); dialogmarketlist = new dialog(nexttopic.this); dialogmarketlist.requestwindowfeature(window.feature_no_title); dialogmarketlist.settitle("topics"); dialogmarketlist.setcontentview(viewlist); dialogmarketlist.show(); lvfordialog = (listview) viewlist.findviewbyid(r.id.list_view); lvfordialog.settranscriptmode(listview.transcript_mode_always_scroll); arrayadapter<string> adapter = (new arrayadapter<string>(nexttopic.this, r.layout.row_topic, r.id.child_row,tnamelist)); lvfordialog.setadapter(adapter); its not working.. just remove this: dialogmarketlist.requestwindowfeature(

decode - Android BitmapFactory decodeStream() -

i have question seem find answer nowhere. lines of code: final bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds = true; bitmapfactory.decodestream(is, null, options); actually mean that, file being downloaded? android docs this: decode injustdecodebounds=true check dimensions and does: options.insamplesize = calculateinsamplesize(options, reqwidth, reqheight); // decode bitmap insamplesize set options.injustdecodebounds = false; bitmapfactory.decodestream(is, null, options); means download file smaller ( not downloaded original size , copied after smaller size bitmap ). clear example: have url's point many 2000 x 1500 images. decoding files , loading them bitmaps, need have enough memory downloading file @ full resolution (2000 x 1500), if need thumbnails of (200 x 150)? i know answer has been accepted right 1 clarity... this line options.injustdecodebounds = true; means call

android - How can I expand widget Expandable ListView to 10 layers? -

Image
i'm developing expandable listview 10 layers . i using following code second layer go forward . i have used following code: public void oncreate(bundle savedinstancestate) { try{ super.oncreate(savedinstancestate); setcontentview(r.layout.main); simpleexpandablelistadapter explistadapter = new simpleexpandablelistadapter( this, creategrouplist(), // creating group list. r.layout.group_row, // group item layout xml. new string[] { "group item" ,"level"}, // key of group item. new int[] { r.id.row_name ,r.id.row_name2}, // id of each group item.-data under key goes textview. createchildlist(), // childdata describes second-level entries. r.layout.child_row, // layout sub-level entries(second level). new string[] {&

what are the limitations of inverse_of in rails 3 with ActiveRecord -

i've been reading inverse_of , i'm seeing online seems inconsistent , confuses me. if here , can see there few limitations inverse_of support: they not work :through associations. they not work :polymorphic associations. they not work :as associations. for belongs_to associations, has_many inverse associations ignored. yet right above that, give example class customer < activerecord::base has_many :orders, :inverse_of => :customer end class order < activerecord::base belongs_to :customer, :inverse_of => :orders end i think they're saying first inverse_of nothing, if why did it? in addition, though above thing says inverse_of doesn't work through assocations, this page says if using belongs_to on join model, idea set :inverse_of >option on belongs_to, mean following example works correctly >tags has_many :through association): and gives example @post = post.first @tag = @post.tags.build :name =>

c++ - Managing cookies in CEF -

i using cef (chromium embedded framework) visual c++. possible manage cookies ? i should want save (by cookies) user's info. suggestion on how ? cefcookiemanager not enough? http://magpcss.org/ceforum/apidocs3/projects/(default)/cefcookiemanager.html

Get JSON response from AJAX and put in HTML to be rendered in another JSP -

i have jsp in web application. jsp displays data json in grid.: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>argo</title> <link rel="stylesheet" type="text/css" href="css/jquery-ui.css" /> <link rel="stylesheet" type="text/css" href="jtable/themes/metro/blue/jtable.min.css"/> <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="js/jquery-ui.js"></script> <script type="text/javascript" src="jtable/jquery.jtable.min.js"></s

android - Assert-Method with dot Operator -

this question textbook no answer key have ask here. the "simple" version is: assertequals (resourcestring, textview.gettext()); if have use dot-operator "whole" version, this? assert.assertequals (resourcestring, textview.gettext()); hope can understand mean :) i think answer looking equals function. resourcestring.equals(textview.gettext());

Ruby - 'require': 127: The specified procedure could not be found (LoadError) -

Image
so, have small ruby program, simple "hello world" - code below require 'ray' ray.game 'hello world!', :size => [800, 600] register { add_hook :quit, method(:exit!) } scene :hello @text = text 'hello, ruby!', :angle => 30, :at => [100, 100], :size => 30 render { |win| win.draw @text } end scenes << :hello end and worked fine on win7-32 bit machine. however, when took exact same program win7-64 bit machine, ruby interpreter spitted out following message: c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 127: specified procedure not found. - c:/ruby193/lib/ruby/gems/1.9.1 /gems/ray-0.2.0/lib/ray_ext.so (loaderror) from error message, seemed "ray_ext.so" missing, there: both pcs have exact same version of ruby (1.9.3), , exact same list of gems installed, yet how come exact same program worked fine on 32-bit win7 failed on 64-bit win7? i tried re-install gem (ray) agai

ios - How to use json data from localhost in objective-c? -

- (void)viewdidload { [super viewdidload]; // additional setup after loading view. nsurl *site_url = [nsurl urlwithstring:[nsstring stringwithformat:@"%@/json/data/post?sid=%@", secure, passcode]]; nsdata *jsondata = [nsdata datawithcontentsofurl:site_url]; nserror *error = nil; nsdictionary *datadictionary = [nsjsonserialization jsonobjectwithdata:jsondata options:0 error:&error]; self.items = datadictionary; } i trying parse json data. works fine data live server. however, when change link http://localhost:8090 . stops working. terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'data parameter nil' i can access data web browser. know why that? does work on emulator , not on real device? you should never use localhost when developing apps, use local ip server instead. localhost machine make call server. when try on emulator , have server on same machine works because same. whe

javascript - Passing a reference to an element without assigning an id -

i several elements use same onclick handler, have: function close_div() { $(this).remove(); } <div class="closex" onclick="close_div()">the first div</div> <div class="closex" onclick="close_div()"the second div</div> <div class="closex" onclick="close_div()"the third div</div> so when click div gets removed dom. the problem code above onclick doesn't pass useful keyword close_div() can't use it. if gave each div.closex different id pass close_div(id) , $("#"+id).remove() . seems there should way automatically pass reference element clicked, without assigning id element , passing that. missing something? thanks even better -- don't use inline handlers. $('.closex').on('click', function(e){ $(this).remove(); }); i'm guessing you're creating these elements dynamically, why you're wanting use inline handlers - s

jquery - Check for e-mail or phone validation (geektantra plugin) -

i'm validating form user either fills in phone number or e-mailadres. @ least 1 of 2 needs filled in. i'm using validation plugin: http://www.geektantra.com/projects/jquery-form-validate/advanced_demo/ i think should this, doesn't seem work: expression: "if ((val) || jquery('#email').val()) return true; else return false;", hoping help. if trying validate phone or email, try using this, expression: if ((val.match(/^[0-9]*$/) && val.length == 10) || val.match(/^[^\\w][a-za-z0-9\\_\\-\\.]+([a-za-z0-9\\_\\-\\.]+)*\\@[a-za-z0-9_]+(\\.[a-za-z0-9_]+)*\\.[a-za-z]{2,4}$/)) return true; else return false; this checks if phone number or email , if 1 of valid then, returns true. try if having 2 input fields, jquery(this).parents("form").submit(function(){ var isformvalid = true; if(selfid != <phone feild> || selfid != <email feild> ){ if (validate_field('#' + selfid)) e

android - Override onMeasure after getting ImageView by Id -

i need find view id , override onmeasure method. know how that? the following not work in java, conceptually it's need: imageview myimage = (imageview) findviewbyid(r.id.some_pic); myimage.onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(widthmeasurespec, heightmeasurespec); int width = measurespec.getsize(widthmeasurespec); int height = measurespec.getsize(heightmeasurespec); showother(width, height); }; myimage.setimagebitmap(bmp); java offers this imageview myimage = new imageview(this) { @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(widthmeasurespec, heightmeasurespec); int width = measurespec.getsize(widthmeasurespec); int height = measurespec.getsize(heightmeasurespec); showother(width, height); } }; or this imageview myimage. = (imageview) findviewbyid(r.id.some_pic); myimage.setimagebitmap(bmp); i thought of using setonmeasurelistener

class - Android - unexpected app crash -

ok have cocktail bible app lets select cocktail form list , should display various information cocktail text,img , button link youtube clip.the code compiling when click on 1 of items in list app unexpected crashes. @ moment app allows 2 cocktail's how run 20 cocktails? have removed imports way. code run list class package com.drunktxtapp; import android.app.activity; public class cocktailmenu extends activity { string classes[] = {"bloody_mary", "capirinha", "cosmopolitan", "cuba_libre", "daiquiri", "mai_tai", "manhattan", "margarita", "martini", "mint_julep", "mojito", "old_fashoned", "pina_colada", "screwdriver", "singapore_sling", "tom_collins", "whiskey_sour", "white_russian"}; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstances

c# - Merge 2 POCO into 1 Class and execute CRUD -

i using petapoco orm , want combine 2 poco 1 class , execute crud operations class. right got this: *table person has fk address_id.* public class person { public personpoco person { get; set; } public addresspoco address { get; set; } public person(string sql) { person = db.singleordefault<personpoco>(sql); address = db.singleordefault<personpoco>("select * addresses id = @0, personpoco.address_id"); } public void save() { var addressid = db.save(address); // returns inserted id person.address_id = addressid; db.save(person); } } this working fine far. gets annoying , repetive doing every needed combination. especially saving pain, since have map inserted id dependent object. are there better ways achieve this? petapoco designed fast , lightweight, so, won't find kind of complex mapping linq-to-sql or ef have in it.

c# - How to know the number of days until today in this year -

i want know number of days january 1st today. if today january 10th, numofdays=10 , if today february 1st numofdays=32 . how can total no of days? thank you you can use datetime 's dayofyear property. int dayofyear = datetime.now.dayofyear;

symfony 2.1 phpunit Swift_Message class not found -

i've issue symfony , phpunit. our peoject growing bigger , bigger. decided activate process isolation phpunit because server couldn't stand amount of tests anymore (not enough ram). since test send mails aren't working anymore. please us? test below works fine if processisolation="false" fails if processisolation="true" versions: symfony 2.1.8-dev phpunit 3.7.9 error message project\appbundle\tests\mailtest::testsendmail phpunit_framework_exception: php fatal error: class 'swift_message' not found in /var/www/project/src/project/appbundle/tests/mailtest.php test public function testsendmail() { $client = static::createclient(); $message = \swift_message::newinstance(); $message->setfrom('example@example.com') ->setto('example@example.com') ->setsubject('subject') ->setbody('hello world') ->setcontenttype('text/html'); $clie