Posts

Showing posts from March, 2012

C++ - Change private member from outside the class -

is code causes undefined behavior? or can run problem this? (copy full class without functions, variables public modifier , modify private memebers throw pointer) example: #include <iostream> using namespace std; class point { private: int x; int y; public: point(int x, int y) { this->x = x; this->y = y; } void print() { cout << "(" << x << ", " << y << ")" << endl; } }; struct pointhack { int x; int y; }; int main() { point a(4, 5); a.print(); ((pointhack *) (&a))->x = 1; ((pointhack *) (&a))->y = 2; a.print(); return 0; } output: (4, 5) (1, 2) (with original member order, of course) despite classes being layout compatible (see below), code exhibits undefined behavior due fact such pointer casts prohibited the c++ strict aliasing rules 1 . but: replacing casts union makes code st

hibernate - Using Grails Exector Plugin's runAsync , Why do I need a transaction to save a Domain object? -

here's i'm doing in service: runasync { <some work here> mydomainobject.merge() } i error saying "no hibernate session bound thread, , configuration not allow creation of non-transactional 1 here". know sure code being run asynchronously, seem executor plugin setup correctly. so tried next, thinking domain object "mydomainobject" must not bound in thread although thread has hibernate session executor plugin: runasync { <work> def instance2= mydomainobject.get(mydomainobject.id) // works instance2.field1=123 instance2.save() // fails } i same error here , interestingly, get() succeeds in bringing correct data , setting instance2. it's "save()" fails. know because i've stepped through code in debugger. finally, if following, works: runasync { <some work here> mydomainobject.withtransaction { mydomainobject.field1=123 mydomainobject.merge() }

unit testing - How do I setup FsUnit with Mono on Linux? -

without visual studio, can't use nuget. how can setup project use fsunit manually? the latest version of nuget works fine on mono. call mono nuget.exe needed command line

c# - Creating a child object using a parent object -

let have these classes: class {}; class b : {} ; and function return a : public read_an_a(); since b child of a , i'd able read it's a properties in following sense: b b = new b ( read_an_a() ); (that assuming use of default copy constructor) or maybe this: b b = (b) read_an_a (); all of above broken, right way achieve that? one way of doing add constructor of b takes a, , harvests relevant parts it: public b(a a) { this.x = a.x; this.y = a.y; } your b class in best position know take, approach reasonably clean, too. lets write b b = new b(read_an_a()); like suggested in question. of course b need other constructors, too.

android - Perform different operations depending on the parent activity? -

i know how intent started current activity, how should structure code if user comes in login page 1 thing happens, , if come signup page, thing happens? class login extends activity { public final static string extra_message = "net.asdqwe.activities.login.extra_message"; //code here public void onclick(view arg0) { intent sendloggedinusertohomepage = new intent(getapplicationcontext(), home.class); sendloggedinusertohomepage.putextra(extra_message,useremailloginpage); startactivity(sendloggedinusertohomepage); } } } asd class signup extends activity { public final static string extra_message = "net.asdqwe.activities.signup.extra_message"; //code here public void onclick(view arg0) { intent signupsuccesshome = new intent(getapplicationcontext(), home.class); signupsuccesshome.putextra(extra_message, useremail); startactivity(signupsuccesshome); } } and in home class , dont know do. until now,

c# - Visual Studio 2012 SQLite Install Not Appearing -

i have downloaded , installed sqlite-netfx45-setup-bundle-x86-2012-1.0.88.0.exe, despite following various instructions have not been able see in way within visual studio 2012. understand, x86 install package shown above install visualizer vs2012. have opened choose data source dialog server explorer, , not see sqlite database file option shown. additionally, have tried adding sqlite project , installing via nuget system, appeared install correctly, still see nothing anywhere. have read various tutorials , seems following instruction correctly, except not see sqlite listed anywhere in lists of data sources. have tried doing new project, , after restarting machine, same result, nothing. doing wrong, or can reset or try differently? obvious step missing assumes? thanks. just found this info , check out: install provider in order connect sqlite databases, need install appropriate ado.net , entity framework provider. luckily, provider we're using available via n

nginx PHP won't display -

i have website stored in /usr/share/nginx/html .gave 777 directories , files.when fire-up browser , navigate website, downloads page rather displaying it. php-fpm installed , running this /etc/nginx/conf.d/default.conf server { listen 80; server_name hostedweb.net; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { root /usr/share/nginx/html; index index.php index.htm; } #error_page 404 /404.html; # redirect server error pages static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy php scripts apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass php scripts fastcgi server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_filename /scripts$fastcgi_script_name; includ

html - How can I add php to an xml file using .htaccess and make it work? -

i have in xml file addtype application/x-httpd-php .xml which using inside xml file can print things inside database. <?xml?> apparently php , returns parse error. how can fix this? try using addhandler application/x-httpd-php5 .php .xml also check short_open_tag , make sure it's in php.ini file , not using it short_open_tag = off also, can write/generate xml .php file using (if option) <?php header('content-type: text/xml'); echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <item> <title><?php echo "something"; ?></title> </item> <?php // more php code ?>

javascript - jsonp and callback function name -

after reading jsonp explained still have questions. 1) happens if don't supply callback function name, supply ?callback=? ? 2) happens if supply callback function name, don't have function same name declared in code ? thanks jquery replace ? char callback function name. name must function name in response make jsonp request working. $.getjson('url/?callback=?').success(function(response){ // process response data; }); wil call e.g. http://url/?callback=jquery325412324_2343224 then server need send callback like jquery325412324_2343224(['json_data'])

java - Simple clarification on javac command -

i studying ant scripts in java reading hello world tutorial: http://ant.apache.org/manual/tutorial-helloworldwithant.html in previous tutorial create new directory dos md src command (mkdir in linux) then put following simple code into: src\oata\helloworld.java : package oata; public class helloworld { public static void main(string[] args) { system.out.println("hello world"); } } now compile shell statment: md build\classes javac -sourcepath src -d build\classes src\oata\helloworld.java java -cp build\classes oata.helloworld i know javac compile classess line? javac -sourcepath src -d build\classes src\oata\helloworld.java i think sayng javac src sources class compile, -d build\classes path put compiled class but means final: src\oata\helloworld.java ? tnx andrea it means filename(s) compile. the purpose of -sourcepath option tell compiler source files dependent classes may found. doesn't imply in directory shou

html - how to make a div transparent without affecting the child in CSS 3? -

how make div transparent without affecting child in css 3 here's html code: <div id="icon"> <ul> <li><a href=""><img src="iconpaper.png"></a></li> <li><a href=""><img src="movies.png"></a></li> <li><a href=""><img src="phone.png"></a></li> <li><a href=""><img src="stocks.png"></a></li> <li><a href=""><img src="love.png"></a></li> </ul> </div> <div id="search"> search </div> </div> and here's css:- #header{ background-color:#000; width:1349px; height:60px; position:fixed; z-index:2; opacity:0.7; } #icon{ float:left; padding:10px; } li{ display:inline; } #header img{ width:35px;

multithreading - Make new connections when blocked in a select() call -

i have 2 threads: thread a: it's select() loop. perform socket handling reading operations, such accepting new connections, receiving data. while (1) { fd_zero(&fdreadset); numactivesockets = 0; (std::unordered_map<socket, tcpsocket*>::iterator = m_sock_table.begin(); != m_sock_table.end(); it++) { numactivesockets++; fd_set(it->first, &fdreadset); } int ret; bool haslisten = false; if (( ret = select(numactivesockets, &fdreadset, null, null, null)) == socket_error) { printf("select failed, error code = %d\n", wsagetlasterror()); return -1; } (std::unordered_map<socket, tcpsocket*>::iterator = m_sock_table.begin(); != m_sock_table.end(); it++) { if (fd_isset(it->first, &fdreadset)) { if (it->first == tcpsocket::m_listen_sock) { if (!haslisten) { sockaddr

java - Not able to run Apache James -

i downloaded apache james mailing server apache-james-3.0-beta4-app . tried run on windows 7 ultimate clicking on run.bat file inside following directory c:\users\jack\desktop\new folder\servers\mailserver\apache-james-3.0-beta4-app\apache-james-3.0-beta4\bin. command prompt started while , getting disappeared. not able read error on command prompt quick. kind of suggestion appreciated. when running telnet command in command prompt showing command not recognized. don't know how turn on in windows. you can view error in \bin\wrapper.log , server status in \log\james-server.log. you can start james server follows also. run follows: run cmd , goto apache-james folder. apache-james\bin folder type "james.bat". see following message. usage: james.bat { console : start : pause : resume : stop : restart : install : remove } type: > james.bat install > james.bat start server start. if james.bat start doesn't work, try james.bat console

c# - Generate Report Using Report Viewer in asp.net -

i want display report in admin panel when select sales person dropdown list in page nothing displayed , display error here. below code: protected void btnviewreport_click(object sender, eventargs e) { reportviewer1.processingmode = processingmode.local; reportviewer1.localreport.reportpath = server.mappath("~/salesperson.rdlc"); dataset ds = getdata("select * customer_new salesperson in (select + email registration name='" + ddsalesperson.selectedvalue.tostring() + "')"); reportdatasource datasource = new reportdatasource("customer_new",ds.tables[0]); reportviewer1.localreport.datasources.clear(); reportviewer1.localreport.datasources.add(datasource); } private dataset getdata(string query) { string constring = configurationmanager.connectionstrings["constr"].connectionstring; sqlcommand cmd = new sqlcommand(query); using (sqlconnection con = new sqlconnection(constring))

asp.net - doing a post from HTML anchor -

is possible have post request if click on html anchor instead of linkbutton? is anchor exclusively used requests , there no way around it? there trick ways accomplish this? a linkbutton uses snippet of (messy, inline) javascript on anchor post page calling asp.net client method __dopostback() . can replicate behavior by: writing own script post page (keep in mind may cause problems validators) writing own script call __dopostback() using server method generate script

Use php to combine 3 mysql tables -

is possible combine following 3 mysql tables using php? table 1: columns - userid, username, userpass table 2: columns - accountid, accounttype table 3: columns - userid, accountid, date, rating please note new mysql , php to fetch, example, result-set of usernames account types , ratings you'd use: select table1.username, table2.accounttype, table3.rating table1 join table3 on table3.userid = table1.userid join table2 on table2.accountid = table3.accountid; in future, recommend listing tables descriptive names, , in order joined acheive result-set need. hope helps

json - How to pass back html and logic information after an ajax call with CI -

i have ci , jquery based project. i've got site searching db. consists of jqueryui accordion. 1 section contains input fields advanced search , other section used display html table results. the search parameters first section sent server using ajax post. crunched server , either html styled error message or html table results (and later other stuff such how many results found, how time consumed etc.) returned. back on client jquery must able distinguish between two. best able transmit variable 'search_success'. if 'search_success' false, error prepended section 1 above input fields. otherwise html block displayed in section 2 , jquery opens section 2. right i'm returning plain html 0 or 1 prepended. first char chopped off jquery , used distinguish between 2 possible results. kind of ugly. after reading post about sending array using json thought addressing problem in json. intended build echo json_encode(array('search_success' => $sea

How we can save java file without name -

i want save java file name , want compile or run file. possible in java or not? example: class { public void display() { system.out.println("hello ..how you..??"); } } i want save file name .java only. possible in java , if possible how can compile file without name through cmd? if try get .java:1: error: class public, should declared in file named a.java so not.

ios - Extract one word from a two word string -

i have 2 word string in view controller containing user defined first , last name nsstring *username = ([self hasattributewithname:kcontractorname] ? [self attributewithname:kcontractorname].value : [self.certificate.contractor.name uppercasestring]); when retrieving string in view controller want extract only first name. i researched on using scanner , found helpful answer here: objective c: how extract part of string (e.g. start '#') , , im there. the problem can seem extract second name variation on origial code. im scanning string space between first , second name, returns second name fine. need nudge on how set extract first name instead of second nsmutablearray *substrings = [nsmutablearray new]; nsscanner *scanner = [nsscanner scannerwithstring:username]; [scanner scanuptostring:@" " intostring:nil]; // scan characters before while(![scanner isatend]) { nsstring *name = nil; [scanner scanstring:@" "

Android share intent from intentservice -

i want share multiple images app other apps. on android's developer page, found: intent shareintent = new intent(); shareintent.setaction(intent.action_send_multiple); shareintent.putparcelablearraylistextra(intent.extra_stream, savedimages); shareintent.settype("image/*"); startactivity(intent.createchooser(shareintent, "share images to..")); how can use code intentservice? when using sample code intentservice, app crashes logcat error: calling startactivity outside of activity context requires flag flag_activity_new_task so added shareintent.setflags(intent.flag_activity_new_task); but still same error , app crashes. how can use share intent intentservice? this line of code startactivity(intent.createchooser(shareintent, "share images to..")); that means create intent object used start dialog activity user choose activity handle shareintent. so, in case intent show chooser dialog acti

ios - UIScrollView not scrolling when adding UIButtons as subviews -

i'm trying build simple uiscrollview paging horizontally scroll between 3 images. tricky part each image clickable , catch click event. my technique create 3 uibuttons each consists uiimage. give each button tag , set action. problem: can catch click event - but it's not scrollable! here code: - (void) viewdidappear:(bool)animated { _imagearray = [[nsarray alloc] initwithobjects:@"content_01.png", @"content_02.png", @"content_03.png", nil]; (int = 0; < [_imagearray count]; i++) { //we'll create imageview object in every 'page' of our scrollview. cgrect frame; frame.origin.x = _contentscrollview.frame.size.width * i; frame.origin.y = 0; frame.size = _contentscrollview.frame.size; // //get image use, want uiimage* image = [uiimage imagenamed:[_imagearray objectatindex:i]]; uibutton* button = [[uibutton alloc] initwithframe:frame];

java - Would changes be visible to a different thread if synchronizing using different objects? -

imagine piece of code inside class. trying change val value in different threads calling method1 , method2 , respectively. is expected changes made val visible in thread, if using different objects synchronize on? , test case design? private object lock1 = new object(); private object lock2 = new object(); private int val = 0; public void method1 () { synchronized (lock1) { system.out.println(val); val = 1; } } public void method2 () { synchronized (lock2) { system.out.println(val); val = 2; } } there no happens-before relation between acquiring , releasing different monitors, there no guarantee when changes visible.

ember.js - Properties of my view can't saved -

can me understand why this.get('property_1') null? , how can fix it? app.someview = em.view.extend({ property_1: null, didinsertelement: function() { this.schedulerefresh(); }, schedulerefresh: function(){ ember.run.scheduleonce('afterrender', this, this.refresh); }.observes('controller.filter_params'), refresh: function(){ if (!this.get('property_1')) { this.set('property_1', 'hello'); } } }); thanks! the code have above works fine. take @ jsfiddle . possible trying retrieve property_1 view property controller? if so, want define property on controller , bind view.

.net - VB.NET - [HTTP POST] Response.Cookies is only returning first cookie value -

i'm using following code loop throught response cookies , save them in cookiejar. each tempcookie cookie in response.cookies cookiejar.add(tempcookie) msgbox(tempcookie.tostring) next it happens it's returning 1 cookie, first 1 (only runs once in for): page_vis=a|186.213.98.144|1381089446.485193| response.cookies has 1 cookie on it, response.headers has of them. how parse them response.headers , add on cookiecontainer use them later? cookies in response.headers here: set-cookie: page_vis=a|186.213.98.144|1381089446.485193|; domain=page; path=/; expires=mon, 07-oct-2013 06:00:00 gmt,csasf=;version=1;domain=page;path=/;max-age=7776000,csapages=ekpeowluwtzsmxpdswrmmm8wwwz3ut09|5749|knm6h4hlob4swlfg2goimxxpmtxdd5tnvb/dj7as3muquiltphlxzswjfksi1rcq6fp/dkre3qhazhpqi968iw==;version=1;domain=page;path=/;max-age=7776000;httponly,nam_login_default=user;version=1;domain=page;path=/;max-age=129600,upl09=2-25|39|54|56|58|90|91|105|106|156|182|212|218

javascript - How to fade images at different times with jQuery -

i have 2 different images classed (letterfile , handfile). want 1 fade out other fades in , keep going that. this have, fading images @ same time: $( document ).ready(function() { setinterval(function() { $( ".letterfile" ).fadetoggle( "slow", "linear" ); settimeout(function(){ $( ".handfile" ).fadetoggle( "slow", "linear" ); }, 2000); }, 2000); }); any suggestions? you have issue because right after first iteration show both of them , there onwards toggles state, i.e both visible or not visible. can rid of timeouts etc , make more generic. give common class images(or divs or ever using) <img class="letterfile slide" src="http://placehold.it/100x100" /> <img class="handfile slide" src="http://placehold.it/200x200" /> js $(document).ready(function () { var duration = 'slow', type="linear"; functio

ios - Constructing NSStrings on the fly, mos effecient way -

i coordinates gps, need build small string looks : nsstring *location = @"40.7,-73.9"; my code right nsstring *latitude = [nsstring stringwithformat:@"%f", [locationfinder singleton].location.coordinate.latitude]; nsstring *longtitude = [nsstring stringwithformat:@"%f", [locationfinder singleton].location.coordinate.latitude]; // of course doesn;t work nsstring *location = latitude, logtitude; now know can nsmutablestring , append, wanted aks ehether there effecient ay of doing process. coming .net , java hate obj c weirdness has. the simplest answer best here, use +stringwithformat: actual multipart format string, instead of separately you're doing there: coordinate *coord = [locationfinder singleton].location.coordinate; // or whatever type here nsstring *location = [nsstring stringwithformat:@"%f,%f", coord.latitud

ios - Undefined symbols for architecture arm64 -

Image
i getting apple mach-o linker error everytime import file cocoapods. undefined symbols architecture arm64: "_objc_class_$_fbsession", referenced from: somefile ld: symbol(s) not found architecture arm64 i 12 of these, various pods use. i trying build iphone 5s using xcode 5. i've been trying various solutions here on so, haven't got of them work yet. how fix apple mach-o linker error? just found warning might interesting, hope leads me solution: ignoring file ~/library/developer/xcode/deriveddata/someapp/build/products/debug-iphoneos/libpods.a, file built archive not architecture being linked (arm64):~/library/developer/xcode/deriveddata/someapp/build/products/debug-iphoneos/libpods.a if architectures , valid architectures right, may check whether have added $(inherited) , add linker flags generated in pods, other linker flags below:

java - Sort strings in an array based on length -

i have below program sorting strings based on length. want print shortest element first. don't want use comparator or api this. if please give me inputs on going wrong, i'd appreciate it. ps: please go easy on comments/ downvotes chemical engineer, , trying learn java on own. been month :) public class sortarrayelements { public static void main(string[] args) { string[] arr = new string[]{"fan","dexter","abc","fruit","apple","banana"}; string[] sortedarr = new string[arr.length]; for(int i=0;i<sortedarr.length;i++) { sortedarr[i] = comparearrayelements(arr); } system.out.println("the strings in sorted order of length are: "); for(string sortedarray:sortedarr) { system.out.println(sortedarray); } } public static string comparearrayelements(string[] arr) { string temp = null; for(int i=0;i<arr.leng

ruby on rails - Creating an admin user in production on Spree -

i deployed spree app server. locally can login admin , change things, on server password , account not work. when go /admin message authorization failure. i did run bundle exec rake spree_auth:admin:create , bundle exec rake db:migrate not work. furthermore, can login e-mailaddress , password got hosting company, can not go admin page. does know how create admin user? deploying spree doesn't (and shouldn't) copy database development production. so development admin user doesn't exist on production database. ssh production server , try: rake spree_auth:admin:create update: do in /data/spree/current

Qt, C++: GConf-WARNING **: Client failed to connect to the D-BUS daemon -

i'm trying make form application under arch linux qt , c++, when try run application below: firstwindow.h #include <qmainwindow> #include <qlabel> #include <qpushbutton> #include <qlineedit> #include <qlayout> class firstwindow:public qmainwindow { q_object public: qlabel *lbl; qpushbutton *btn; qlineedit *row; firstwindow():qmainwindow() { setwindowtitle("first window"); qwidget *win = new qwidget(this); setcentralwidget(win); lbl = new qlabel("hello universe", win); btn = new qpushbutton("click click", win); row = new qlineedit(win); qvboxlayout *main = new qvboxlayout(win); main->addwidget(win); qhboxlayout *nextto = new qhboxlayout(); nextto->addwidget(row); nextto->addwidget(btn); main->addlayout(nextto); resize(200,50); win->sho

finding the minimum and maximum in tuples (database) -

consider relation r number of tuples of r n. how can find minimum , maximum possible sizes (in tuples) result relation produced following relational algebra expressions? please help.. (1) σa=5 , b=5(r) (2) Πa,b(r) (a,b random names of attribute) σ means select , Π project... "how can find ..." restrict filters out tuples input. can filter out 0 tuples in total ? less 0 tuples ? can filter out n tuples in total ? more n ? similar reasoning projection.

c++ - Class matrix addition -

i have program suppose add 2 matrices when gets add part in main gets stuck , nothing. have messed quite time no avail. or recommendations appreciated. #include <iostream> using namespace std; class matrix { private: int **p, m, n; public: matrix(int row, int col) { m = row; n = col; p = new int*[m]; (int = 0; < m; i++) p[i] = new int[n]; } ~matrix() { (int = 0; < m; i++) delete p[i]; delete p; } void fill() { cout<<"enter matrix elements:"; for(int = 0; < m; i++) { for(int j = 0; j < n; j++) { cin >> p[i][j]; } } } void display() { cout <<"the matrix is:"; for(int = 0; < m; i++) { cout << endl; for(int j = 0; j < n; j++) { cout << p[i][j] <<" "; } } cout << endl; } matrix operator +(matrix m2) { matrix t(m, n); for(int = 0; < m; i++) { for(int j = 0; j < n; j++)

java - just a quick thing about polymorphism -

say class classone extends classtwo , classone subclass , classtwo superclass. if went class , typed in: classtwo hello = new classone(); mean can use methods in classone have been inherited classtwo , not methods in classone ? (e.g a. method called void eat(); in classtwo , classone inherited method void walk(); in classone , not in classtwo using hello keyword, access eat function , not walk function?), don't quite understand concept of polymorphism. can explain , giving example? much. yes true, system see classone classtwo in regards available methods. think these concept buckets, in case classone fits classtwo bucket. if put classone in classtwo bucket can see classtwo bucket. pick out classone classtwo bucket, can cast it. this helps in case of upcasting , downcasting, casting object supertype or subtype. either put item in basket(upcasting) or take out basket (downcasting). this analogy might crap helps me :) to answer question yes,

javascript - How to properly append html into a div, so if the div becomes too large in height, I can scroll its content -

i need append html content retrieved url inside div. this html code: <div id="top-container"> <div id="views-container"> <div id="html-container"> </div> <div id="original-page-container"> </div> <div id="result-page-container"> </div> </div> </div> and script , paste page content is: $.get("http://alf.wikia.com/wiki/alf_goes_wild", function(data) { $("#original-page-container").append($(data).find(".wikiamaincontentcontainer").html()); }); this can , paste data succesfully inside div, problem new html exceeds dimentions of original-page-container div , need retrieved content fits dimensions of div, if height greater, should able scroll div. i hope explained myself clearly. this jfiddle (the script works in browser internet security disabled): http://fiddle.jshell.n

android - How long is a Intent available -

im wondering how long getintent() in activity available (does not return null). lets start activity b activity , pass data in intent. in activity b read data intent in activities oncreate() method. far good. how long getintent() available? mean, if user displaying activity b, switchs app (i.e. using multitasking button) , after hours user clicks on multitasking button again (the activity may have been destroyed in meantime) , opens activity b again. activity b oncreate() called reinstantiate activity b. getintent() still returns original intent value or have save intent value in activities onsaveinstancestate() , use bundle in oncreate(bundle state) ? does getintent() still returns original intent value technically, returns copy of intent . speaking, should identical original intent , including extras.

java - JPA OneToOne join issue -

here simplecost entity @entity @table(name="simplecost") public class simplecost { @id @generatedvalue(strategy = generationtype.identity) private long id; private long userid; private long cost; @onetoone(cascade=cascadetype.all,fetch = fetchtype.eager) @joincolumn(name = "userid") private userbare user; } userbare: @entity @table(name="user") public class userbare{ @id @generatedvalue(strategy = generationtype.identity) private long id; private long userid; private string fname; private string lname; } so i'm having trouble populating simplecost.user attribute. need use simplecost.userid retreive user table data , fill simplecost.user object. here database structure. database tables: user create table `user` ( `id` bigint(20) not null auto_increment, `fname` varchar(100) default null, `lname` varchar(100) default null, `mname` varchar(100) default null, `title` varchar(100) default null, `email` varchar(100) default n

ios - Where exactly can I access IB auto generated layout constraints? -

i have uilabel inside uitableviewcell seems have nsibprototypinglayoutconstraints auto generated ib. it doesn't can access constraints calling mylabel.constraints or mycell.constraints . is stored somewhere else or not able access through code? if it's custom table cell (that is, dragged uilabel objects library table cell), select uilabel in ib. in bottom right-hand corner of ib canvas, click "resolve auto layout issues" button--it looks tie-fighter star wars. pop-up menu, choose "add missing constraints". should show automatically generated constraints. can re-configure them in ib , make outlets them. if using uilabel comes 1 of pre-configured table cells (e.g., basic style), might not able re-configure label's constraints. uilabel in pre-configured cell, "add missing constraints" item disabled. if want modify constraints of uilabel in pre-configured table cell, might consider using custom style table cell instead.

oracle - What changes are visible to select statements? -

Image
looking @ following transactions on same table: which changes t1 selects get? for oracle, default isolation level (read committed) t1, first select -> not see changes t1, second select -> not see changes t2 t1, third select -> not see changes t3, sees changes t2 (phantom read) t1, forth select -> sees changes (phantom read) so committed visible t1.

java - styles toast background - no resource found that matches the given name -

in theory simple thing. change background color of toast (android:minsdkversion="14" android:targetsdkversion="18"). did? i've found theme.holo.light definition use parent own style: theme.holo.light definition next i've found: <item name="android:toastframebackground"> nest wanted modify it: <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="mytheme" parent="android:theme.holo.light"> <item name="android:actionbarstyle">@style/myactionbarstyle</item> <item name="android:toastframebackground">@android:color/holo_blue_light</item> etc. while action bar works without problems, toastframebackground eclipse displays always: error: error: no resource found matches given name: attr 'android:toastframebackground'. styles.xml android aapt problem i've set original version (just copied original the

c++ - Bit manipulation tilde -

i understand tilde flips every bits, if int num = ~0 why result num = -1 , neither max value of int or unsigned int ? but max value of unsigned : #include <iostream> #include <limits> int main() { std::cout << ( unsigned(-1) == std::numeric_limits<unsigned>::max() ) << std::endl; return 0; } http://ideone.com/y4jufe

c# - Inserting into SQL using an OpenXml -

hi trying insert data sql server database using xml file has data follows.i able attribute mapping in openxml.if try pass xml elements instead of attributes error regarding null insertion. following xml file (containg attributes) <newdataset> <sampledatatable id="20" name="as" address="aaa" email="aa" mobile="123" /> </newdataset> i successful using above format.if use below format face errors <customer> <id>20</id> <name>cn</name> <address>pa</address> <email>bnso@gmail.com</email> <mobile>12345513213</mobile> </customer> this openxml in sql insert @temptable select * openxml (@xmlhandle,'root/customer/',1) (cust_id int '@id', customer_name varchar(30) '@name', address varchar(30) '@address', email_id varchar(30) '@email', mobile_n

css - How to enable auto indentation in lists and list items? -

i new css, took on someone's css code has: .. css reset .. ul, ol, li .. { .. margin: 0; padding: 0; .. } however, setting padding 0 disables automatic list item indentation, want indentation, wrote: <ul style="padding: 10;"> <li style="padding: 10;"> <ul style="padding: 10;"> <li style="padding: 10;">123</li> </ul> </li> </ul> padding: 10 not have effect, browser still displays no padding, no indentation. how auto indentation in place? friend, 10px not 10 padding value. <li style="padding: 10;">123</li> should be <li style="padding: 10px;">123</li> cheers,

javascript - Check for node modules being loaded using jasmine-node -

so i'm trying teach myself jasmine (for node) working through tutorial mongoose project, tdd style, writing tests each step supposed accomplish, following actual tutorial, etc. of course, first test failing. app.js @ point 2 lines: var mongoose = require('mongoose'); console.log(mongoose.version); this runs fine. test however, still fails: var app = require('../src/app.js'); describe('app startup', function() { it('loads mongoose', function() { expect(app.mongoose.version).tobedefined(); }); it('loads jasmine-jquery', function() { expect($).tobedefined(); }); }); results in failures: 1) app startup loads mongoose message: typeerror: cannot read property 'version' of undefined stacktrace: typeerror: cannot read property 'version' of undefined @ null.<anonymous> (/home/jbhelfrich/mongooseblog/spec/init.spec.js:5:36) (the jquery test is, of course, expected fa

post - how is that x=20;x= ++x + ++x + x++ ;final value of x in java is 65 -

this question has answer here: how post increment (i++) , pre increment (++i) operators work in java? 13 answers how possible post increment operator should increase x 66? when did same y= ++x + ++x + x++; gave value 65 y , 23 x. so let me know how java compilers solving these expression. let java show you. javap -c myclass shows bytecode: public static void main(java.lang.string[]); code: 0: bipush 20 2: istore_1 3: getstatic #2 // field java/lang/system.out:ljava/io/printstream; 6: iinc 1, 1 9: iload_1 10: iinc 1, 1 13: iload_1 14: iadd 15: iload_1 16: iinc 1, 1 19: iadd 20: dup 21: istore_1 22: invokevirtual #3 // method

git - How to set up a gitconfig file -

trying set aliases git config, know can through terminal setup git config file given here. http://gitimmersion.com/lab_11.html . dont understand need do, have tried saving exact text in file ".gitconfig" through sublime 2 not work. home directory of git? have used "which git" in terminal path "/usr/local/git/bin/git". placing file in /usr/local/git/bin nothing, ive tried several other directories no avail. that post makes clear: add following .gitconfig file in $home directory. that means $home/.gitconfig (e.g. /home/felipec/.gitconfig). but precisely reason why --edit option added: git config --global --edit now don't have know or care file, edit it.

Error Connecting to SQL Sever ->Setting AD ID user for connecting to SQL server using mqsisetdbparams for broker running on linux -

i have requirement of configuring broker ad id , password connect sql database server . the commands entered setting given below : first created dsn stopped broker executed : mqsisetdbparams brokername -n sql_asda_tms -u uk\\sqltmsdb -p wmbdev started broker after setting above property , restarting broker tried validate connectivity using mqsicvp command failed , error logged in sql server login failed user 'uk\sqltmsdb' .reason:attempting use nt account name sql server authentication . find dsn details below : ;# unix sqlserver stanza [sql_asda_tms] driver=/opt/ibm/mqsi/7.0/odbc/v6.0/lib/ukmsss24.so description=datadirect 6.0 sql server wire protocol address=labuknts5028.uk.wal-mart.com,14481 ansinpw=yes database=tms trusted_connection=yes quotedid=no columnsizeascharacter=1 logintimeout=0 note: broker running on linux . the windows application able connect sql server using ad id broker able connect same sql server using normal sql

file - Qt signal driven tail program -

i'm looking create simple 'tail' type program prints out new lines appended onto file. instead of polling file stat updated modified date, there way catch signal when: the file has been appended to the file has been renamed a new file of given name appears those 3 requirements need design for. found qfilesystemwatcher give me signal these 3 (i think)...but signal simple...no details has changed still have call stat. way info qfilesystemwatcher? maybe looking qfilesystemwatcher , filechanged signal. you hold qhash<qstring, qfileinfo> in application, mapps filepath qfileinfo . in slot connected qfilesystemwatcher::filechanged(const qstring & path) signal create qfileinfo changed file , compare 1 in hash. after set new qfileinfo into hash. // myapplicationobjec.h class myapplicationobject { // ... private: qhash<qstring, qfileinfo> m_fileinfos; }; // myapplicationobjec.cpp // slot connected qfilesystemwatcher::filecha

javascript - How to create knockout data bindings at runtime w/o data attributes -

is possible create knockout bindings javascript alone, i.e. without writing custom html attributes? i'm stuck our existing markup , can't add data-bind etc. knockout.js relies on (html generated programmatically , there no access rendering pipeline, please assume i've exhausted options in trying :) one idea i'm tentatively pursuing adding data-bind attributes @ runtime prior calling ko.applybindings . there preferred approach? i'll accept alternative, sufficiently documented/popular/stable framework if implements bindings similar knockout.js if / visible . knockout 3.0 (which around corner , in release candidate now) opens lot more ways interact binding process , such ability preprocess nodes , dynamically generate bindings. take @ knockout.punches see examples of possible. between , things mentioned unobtrusive , class binding providers, should have no trouble working whatever markup you're stuck with. it may worth pointing out knockout

Jquery How to load flexslider with two slider and slide at the same time? -

jquery how load flexslider 2 slider , slide @ same time? jquery <script type="text/javascript"> $(window).load(function(){ $('#banner').css("visibility", "visible"); $('#banner').flexslider({ animation: "fade", pauseonhover: true, controlnav: false, slideshowspeed: 3000, directionnav: false, slideshow: true }); $('#tag').css("visibility", "visible"); $('#tag').flexslider({ animation: "fade", pauseonhover: true, controlnav: false, slideshowspeed: 3000, directionnav: false, slideshow: true }); }); </script> my html <div id="banner"> <ul class="slides">

Accessing an object within another object in Drupal -

i have array output drupal, how access value of [name] field_episode_tags, have far print $node->field_episode_tags['und']['0']['taxonomy_term']->['name'] when 'taxonomy term' there object tried using -> poitner did not work. stdclass object ( [vid] => 25 [uid] => 1 [title] => there cosmos theory? [log] => [status] => 1 [comment] => 1 [promote] => 0 [sticky] => 0 [nid] => 25 [type] => tv_episode [language] => en [created] => 1380610491 [changed] => 1381115053 [tnid] => 0 [translate] => 0 [revision_timestamp] => 1381115053 [revision_uid] => 1 [body] => array ( [und] => array ( [0] => array ( [

rest - How to Get Lists for Uri Templates based on other Ids -

lets have couple uri template endpoint rest api such: "/events" - gives me events "/events/{eventid}" "/events/2234" - gives me event specified eventid what if wanted events specific broker. thinking maybe this: "/events/{brokerid}" e.g. "events/2345" - gives me events specific brokerid problem how service know if incoming url sending in broker vs. eventid? /2234 , /2345 indistinguishable. i'm wondering how handled in rest. people typically like: "events/broker/{brokerid}" or somehow specify type of id other way? i'm not sure others, like: /brokers/{brokerid}/events for example: /brokers/2345/events of course, less rest-ful, such as: /events?brokerid=2345

asp.net - How to apply rights to specific IIS Users? -

i have application in have map drives. cannot allow permission upload or create files/folders. few iis users allowed upload files. able access folder when allow permission on folder remove , allow specific user gives error:"access path denied". kindly , explain in detail if possible. one asp.net applicaion works under 1 user in iis, i.e. application pool user. so, should give right permission application pool user, if restrict upload rights, should create rules asp.net application users. so, should login in asp.net applicaiton , have rights upload files on server. regards

ios - Why doesn't my app return to my detail view when it's restored? -

my app has simple organization, i've configured in interface builder storyboard (not in code). there navigation view controller, has root view controller set main view controller. main view contains table, cells segue detail view controller. when suspend application while looking @ detail view , resume it, i'm returned main view, rather detail view. why might be? details: i have set restoration ids in interface builder navigation view controller, main view controller , detail view controller. i've tried adding restoration id table view , making main view controller implement uidatasourcemodelassociation. my app returning yes shouldrestoreapplicationstate , both main view , detail view have encode/decoderestorablestatewithcoder methods. i'm testing suspend/resume using simulator: run app, navigate detail view, hit home button, , click stop button in xcode. resume, i'm running app again xcode. i see following calls on suspend: appdelegate shouldsavea

How to get a tooltip text on mouseover using Selenium WebDriver -

i not able tooltip text after mouseover on icon tooltip. need tooltip text,this html code. <a class="tooltip" onclick="socialauth.showopenidloginwindow('google');_gaq.push(['_trackevent','loginform','google-login','google login clicked']);" href="javascript:void(0);"><span>we dont store password or access contacts on google account.</span><img class="social" height="39" width="40" src="/images/login/google.png"/> you have use actions this. in printing mouse hover message in google actions tooltip1 = new actions(driver); webelement googlelogo = driver.findelement(by.xpath("//div[@id='hplogo']")); thread.sleep(2000); tooltip1.clickandhold(googlelogo).perform(); perform mouse hover action using 'clickandhold' method. get value of tool tip using 'getattribute' command string

java - Key listener for composite? -

i want add key listener composite. code follows: @override protected control createdialogarea(composite parent) { //add swt text box , combo etc parent } the composite a: org.eclipse.swt.widgets.composite want add key listener composite parent. when ever user presses ctrl or escape, user should notified. if focus on 1 text or combo field , parent listener should notified. help. ok, here go: add filter display . within listener check if parent of current focus control shell of composite . if so, check key code. in conclusion, handle key event, if focus "within" composite , ignore if "outside" composite . public static void main(string[] args) { display display = new display(); final shell shell = new shell(display); shell.setlayout(new gridlayout(1, false)); final composite content = new composite(shell, swt.none); content.setlayout(new gridlayout(2, false)); text text = new text(content, swt.border); butt

c++ - Loading different objects from file -

i'm trying load , b objects file like a 3 4 b 2 4 5 b 3 5 6 2 3 i have following classes, base, , b, subclasses of base. each operator>> overloaded. the problem in function load(). i'm not sure how instanciate objects.. load() doesn't compile because ‘po’ not declared in scope . how fix ? or best way achieve ? also, if manage make work somehow, need delete objects manually ? class base { public: base() {} base(int tot_) : tot(tot_) {} void print() const { std::cout << "tot : " << tot << std::endl; } private: int tot; }; class : public base { public: a() : base(0) {} a(int a1, int a2) : base(a1+a2) {} }; class b : public base { public: b() : base(1) {} b(int b1, int b2, int b3) : base(b1+b2+b3){} }; std::istream& operator>>(std::istream& in, a& a) { int a1, a2; in >> a1; in >> a

android - Override res folder determination -

so, i'm making app has many different res folders values, drawables , layouts. variation screen size, mobile country code (i'm using field override , enable different skins in app, ios targets), landscape / portrait, screen widths, languages & dpi. one of biggest problems app fact need support both tablets & phones. create layout phones under layout-normal. if this, seems must copy-paste tablet layout both layout-large & layout-xlarge folders. if don't, app defaults normal layout. i wondering if there way in android override way runtime determines folder goes to. way, via code, direct run-time correct folder depending on device's configuration, , not need copy-paste layouts on place. note: i specified 1 reason want this, there several others. i'm looking way override way android determines res folder goes to, not different solution 1 problem specified above. any advice appreciated! in order avoid duplication use resource alias mec

r - Change plot area background color -

Image
i graph in r using our company colors. means background of charts should light blue, plotting region should white. searching answers , found drawing rect job (almost). plotting region white , graph not visible anymore. possible? getsymbols('spy', from='1998-01-01', to='2011-07-31', adjust=t) graph_blue<-rgb(43/255, 71/255,153/255) graph_orange<-rgb(243/255, 112/255, 33/255) graph_background<-rgb(180/255, 226/255, 244/255) par(bg=graph_background) colorplottingbackground<-function(plottingbackgroundcolor = "white"){ rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col ="white") } plot.xts(spy, col=graph_blue) colorplottingbackground() the issue plot white rectangle after plotting data, therefore overwriting them. since plot.xts doesn't have argument add allow call after drawing rectangle, solution see modify function plot.xts . plot.xtsmodified<