Posts

Showing posts from September, 2013

php - Conditional Join Statement in MySQL using IF-ELSE -

i'm making notification scheme social networking app. i've different kind of notification categorized in 2 groups: friends-related , events-related. currently, database schema this: +---------------------+------------------------+------+-----+---------+----------------+ | field | type | null | key | default | | +---------------------+------------------------+------+-----+---------+----------------+ | notification_id | int(11) | no | pri | null | auto_increment | | notification_type | enum('event','friend') | no | | null | | | notification_date | datetime | no | | null | | | notification_viewed | bit(1) | no | | null | | | user_id | int(11) | no | mul | null | | +---------------------+------------------------+------+-----+---------+-----------

d3.js - Complex data object with duplicate 'values' = missing chart bars -

i'm not sure if d3 bug or if i'm doing wrong. take @ following: http://jsfiddle.net/jakobud/sfwjb/6/ var data = [ { value: 20, color: 'red' }, { value: 30, color: 'blue' }, { value: 30, color: 'purple' } // same value 2nd object ]; var w = 140, h = d3.max(data, function(d){ return d.value; }) + 30, barpadding = 4, toppadding = 1, bottompadding = 20; var svg = d3.select('#chart') .append('svg:svg') .attr('width', w) .attr('height', h); var rects = svg.selectall('rect') .data(data, function(d){ console.log(d); return d.value; }) // 3 objects found here .enter() .append('rect') .attr('x', function(d,i){ console.log(i); return * w / data.length + 1; }) // last data object ignored, not placed @ .attr('y', function(d){ return h - d.value - toppadding - bottompadding }) .attr('width', w / data.len

ruby - Join array of strings into 1 or more strings each within a certain char limit (+ prepend and append texts) -

let's have array of twitter account names: string = %w[example1 example2 example3 example4 example5 example6 example7 example8 example9 example10 example11 example12 example13 example14 example15 example16 example17 example18 example19 example20] and prepend , append variable: prepend = 'check out these cool people: ' append = ' #followfriday' how can turn array of few strings possible each maximum length of 140 characters, starting prepend text, ending append text, , in between twitter account names starting @-sign , separated space. this: tweets = ['check out these cool people: @example1 @example2 @example3 @example4 @example5 @example6 @example7 @example8 @example9 #followfriday', 'check out these cool people: @example10 @example11 @example12 @example13 @example14 @example15 @example16 @example17 #followfriday', 'check out these cool people: @example18 @example19 @example20 #followfriday'] (the order of accounts isn't i

data structures - C++ parenthesis matching application -

i have write function accepts string , returns bool. string passed in series or different parenthesis opened or closed ex.({[]}) , returns whether 'parens' well-balanced. has implemented adding items stack. getting following error: parenmatching_demo.cpp:18:12: error: no match 'operator==' in 'c == '(' the psudocode is: matcher(expression) each character in expression if character opener push on stack else if character closr if stack empty return false if (opener at) top of stack not match closer return false pop stack if stack not empty return false return true this have. template <typename t> bool parenmatching(string c) { stack<string> s; (int = 0; < s.size(); i++) { if (c == '(' || c == '[' || c == '{' || c == '<') s.push(c); else if (c == ')'

How can I click on a google map with capybara to create a marker -

i have google map on page. user's can click on map , drop marker @ point. how can simulate in capybara? doesn't matter click long it's somewhere on map. i think can use actionbuilder if use selenium driver. like: within_frame(locator_of_frame_with_map) map = find(locator_of_map).native page.driver.browser.action.move_to(map, x, y).click.perform end code above draft. can't provide working code without demo. capybara doesn't have cross-driver api clicking @ specific coordinates.

fragment - What happens in OpenGL 3.x+ if I don't specify a shader -

i'm working new core opengl 4, i'm using vao exclusively , vertex , fragment shaders. but, if don't specify shader @ all, system provide default shader? e.g. shader draws fragment current glcolor , mvp? thanks on core profile, not providing shaders prohibited.

c++ - Part 1: Referencing an Array Without Using Pointers and only Subscripting | Part 2: "..." with Pointers -

#include <iostream> #include <time.h> using namespace std; void my_func(); int main() { float start_time = clock(); cout << "starting time of clock: " << start_time; cout << endl << endl; (int = 0; < 100000; i++) { my_func(); } float end_time = clock(); cout << "ending time of clock: " << end_time; cout << endl << endl; } void my_func() { int my_array[5][5]; } i need write program large number of references elements of two-dimensional array, using subscripting. two-part project, i'm concerned getting first part right. second part allows use of pointers now, subject "subscripting" (indices?). advice on how proceed? i have completed first part volkan İlbeyli. moving on second part: i need write program large number of references elements of two-dimensional array, using pointers , pointer arithmetic. here's have far: #include

iphone - UIScrollview containing many images -

i'm using uiscrollview in xcode 4.6. want insert around 30 images scrollview. within storyboard can't add many doesn't let scroll down on storyboard add more images, hence images overlap each other. the answer quite simple sorry if dumb question. how add many images scrollview, there way code in android xml? or there anyway not have images overlap? also consider using uitableview. may more efficient way of handling many images. can load them they're displayed, rather @ once.

python - SqlAlchemy: Join onto another object -

my little website has table of comments , table of votes. each user of website gets vote once on each comment. when displaying comments user, select comments table , outerjoin vote if 1 exists current user. is there way make query vote attached comment through comment.my_vote ? the way i'm doing now, query returning list each result - [comment, vote] - , i'm passing directly template. i'd prefer if vote child object of comment. setup model add one-to-one relationship . sample code link verbatim: class parent(base): __tablename__ = 'parent' id = column(integer, primary_key=true) child = relationship("child", uselist=false, backref="parent", # lazy='joined', # @note: optional: uncomment have 'child' loaded when parent loaded. ) class child(base): __tablename__ = 'child' id = column(integer, primary_key=true) parent_id = column(integer, foreignkey('parent.id')

multilingual - how to setup drupal multi language site -

i searched , read many websites can't find how set drupal multi language website. i want use 2 languages in site. these 2 languages have different content . (not content translation). i had enabled locale module, enabled multilingual support in each content type but when added content in 2 languages the front page list of articles without filter site's language. how setup drupal 7 list articles filtered language. eg: http://example.com/en <- url should list english article. http://example.com/fr <- url should list france article. i have install i18n or internationalization module drupal contributed modules , enabled these option. multilingual select internationalization ** module require variable module.

c# - stuck calling oracle procedure multiple times -

any way can speed up. have call stored procedure each time latest value oracle , update. last bottleneck, can called thousands of times. converted other inserts array binding bulk inserts. c# call oracle for (int = 0; < r.receiptkey.count(); i++) { ld.receiptlinenumber.add(asngetnextavailablereceiptlinenumber(r.receiptkey[i])); } c# oracle public string asngetnextavailablereceiptlinenumber(string myreceiptkey) { using (oraclecommand cmd = new oraclecommand()) { oracleconnection conn; conn = new oracleconnection(connectionstringoracle); cmd.commandtext = "bppack.getnextreceiptlinenumber"; cmd.commandtype = commandtype.storedprocedure; cmd.connection = conn; cmd.parameters.add(new oracleparameter("ireceiptkey", oracledbtype.varchar2, 10)); cmd.parameters.add(new oracleparameter("oretvalue", oracledbtype.varchar2, 5)).direction

html - CSS Arrow Opacity Transition -

how take css arrows have (see below) , make them fade in , out when hover on each item? my css: #menu li { position:relative; } #menu li a:after { content: " ."; display: block; text-indent: -99em; border-bottom: 0.6em solid #1c525a; border-left: 0.6em solid transparent; border-right: 0.6em solid transparent; border-top: none; height: 0px; margin-left: -.6em; margin-right: auto; margin-top: -7px; position: absolute; left: 50%; width: 1px; } all code available in jsfiddle . to accomplish added following: #menu li a:after { -webkit-transition:all 0.3s ease-in-out; transition:all 0.3s ease-in-out; } #menu li:hover a:after { border-bottom: 0.6em solid #1c525a; -webkit-transition:all 0.3s ease-in-out; transition:all 0.3s ease-in-out; } see jsfiddle - i'm sure code can cleaned or bested, didn't find example/answer of on stack overflow yet thought add this.

TouchXML and Facebook SDK iOS -

i have been getting error , have been lost in trying solve it: ld: warning: directory not found option '-f/users/user/desktop/integratingfacebooktutorial-master/../../../documents/facebooksdk' undefined symbols architecture i386: "_fbtokeninformationexpirationdatekey", referenced from: -[pffacebooktokencachingstrategy cachetokeninformation:] in parse(pffacebooktokencachingstrategy.o) -[pffacebooktokencachingstrategy expirationdate] in parse(pffacebooktokencachingstrategy.o) -[pffacebooktokencachingstrategy setexpirationdate:] in parse(pffacebooktokencachingstrategy.o) "_fbtokeninformationtokenkey", referenced from: -[pffacebooktokencachingstrategy accesstoken] in parse(pffacebooktokencachingstrategy.o) -[pffacebooktokencachingstrategy setaccesstoken:] in parse(pffacebooktokencachingstrategy.o) "_fbtokeninformationuserfbidkey", referenced from: -[pffacebooktokencachingstrategy facebookid] in parse(pffa

xml - Unwrapping responses on WCF with XmlSerializer and Soap with RPC Literal -

i´m trying consume soap 1.1 web service wcf. after generating proxies svcutil wsdl definition, found responses null. it seems service uses rpc literal wcf fallbacks using xmlserializer . here wsdl definition: <wsdl:definitions xmlns:typens="http://www.myservice.es/schemas" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetnamespace="http://www.myservice.es/schemas"> <wsdl:types> <xsd:schema xmlns="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.myservice.es/schemas"> <xsd:include schemalocation="../xsd/myservicetypes.xsd"/> </xsd:schema> </wsdl:types> <message name="servicerequest"/> <messag

C: How to compare two strings? -

this question has answer here: why “a” != “a” in c? 11 answers edit: duplicate , i've flagged such. see [question] why "a" != "a" in c? so i'm trying print out specific message depending on field within struct. field contains string "1". whenever run printf("%s", record.fields[2]); output 1 ; i've no format warnings. however, when check field against corresponding string (in case, "1"), fails check: if (record.fields[2] == "1") { printf("the field 1!"); } you need use strncmp compare strings: if (strncmp(record.fields[2], "1", 1) == 0) ... you need compare zero, because strcmp returns 0 when 2 strings identical. however, looks not comparing strings: rather, looking specific character inside string. in case, need use character constant instead of

class - How to allow __init__ to allow 1 or no parameters in python -

right have class: class foo(): def __init__(self): self.l = [] right now, can set variable foo without argument in parameter because doesn't take one, how can allow continue take no required parameters, put in list if wanted foo()? example: >>> f = foo([1,2,3]) #would legal , >>> f = foo() # legal def __init__(self, items=none): if items none: items = [] self.l = items in response @eastsun's edit, propose different structure __init__ def __init__(self, items=()): ''' accepts iterable appropriate typeerror raised if items not iterable ''' self.l = list(items) note lowercase l bad name, can confused 1

Geting started with Android C++ debugging via gdb on Windows: Where to get gdbserver for Android from? -

i don't understand how debug c++ apks on android. can please me started? i found this: http://www.kandroid.org/online-pdk/guide/debugging_gdb.html but running gdbserver -help terminal emulator on actual device returns "gdbserver: not found". i've found online says run gdbserver on device, don't know how it. or there. please note running windows adb connection, ndk build system in linux virtual machine via terminal. gdb-ndk must run directly windows android device communicate via usb. adb logcat finds device under windows. thanks i've seen these links: ndk-gdb on windows http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/ http://mhandroid.wordpress.com/2011/01/25/how-cc-debugging-works-on-android/ http://cgdb.github.io/ http://mhandroid.wordpress.com/2011/01/23/using-cgdb-with-ndk-debug-and-cgdb-tutorial/ http://geekswithblogs.net/raccoon_tim/archive/2011/09/12/working-with-android-on-windows-and-without-c

javascript - Error when retrieving JSON from PHP using JQuery/AJAX -

i trying learn how build image gallery on website. creating page using .html / .css / .js files. have image folder on web server has arbitrary number of images in it. goal inject img tags containing each of images url's folder photos div in html. i wrote following php script have on server: <?php $imagesdir = '../images/art/'; $images = glob($imagesdir . '*.{jpg,jpeg,png,gif}', glob_brace); echo json_encode($images); ?> i realize generate entire html through php script , bypass ajax, don't want learning primary objective here , want learn how interact php through ajax. the output of php script when visit url ( http://www.fakedomain.com/php/images.php ) in web browser of following form: [ "../images/art/art01.jpg", "../images/art/art02.jpg", "../images/art/art03.jpg", "../images/art/art04.jpg" ] i trying make ajax call in javascript retrieve json php file. $.getjso

c++ - Calling Non Virtual Method from child class -

i know based on polymorphism cannot call non virtual function/method ex: class entity { public: entity() { health = 10; } void displayhealth() { std::cout << health << std::endl; } protected: int health; }; class player : public entity { }; class enemy : public entity { void sethealth(int n) { health = n; } }; int main() { entity *instance = new enemy(); instance->sethealth(1); // error return 0; } so have come counteract this: int main() { entity *instance = new enemy(); enemy e = *(enemy*)instance; e.sethealth(1); instance = &e; } this works fine needs i'm wondering if "correct" way of doing it. there more efficient way call child class method using polymorphism? entity *instance = new enemy(); enemy e = *(enemy*)instance; creates new enemy object , assigns pointed instance it. redundant. , then instance = &e; causes memory leak because lost pointer new enemy()

c++ - linkList copy constructor and assignment operator -

i'm writing node , list classes , works fine except when include destructor , copy constructor , assignment operator functions in list class, , don't know wrong them or have miss not include. linklist::linklist() :firstnode(null), lastnode(null), nodecount(0) {} linklist::~linklist()// destructor { node* current = firstnode; while( current != 0 ) { node* temp = current->getnextnode(); delete current; current = temp; } firstnode = 0; } linklist::linklist(linklist &l)// copy constructor { firstnode = null; nodecount = 0; node* temp = l.firstnode; for(int = 0; < l.getnodecount(); i++) { push_back(temp); temp = temp->getnextnode(); } } linklist& linklist::operator=(const linklist& l)// overloading assignemnt operator { linklist* ll; node* temp = l.firstnode; while( temp != null ) { ll->getlast(); temp = temp -> getnextnode();

java - Serialization return type -

public manager restoremanager(string filename) throws ioexception, classnotfoundexception { // read disk using fileinputstream fileinputstream f_in = new fileinputstream(filename); // read object using objectinputstream objectinputstream obj_in = new objectinputstream(f_in); // read object object obj = obj_in.readobject(); return ????? ; } i'm "returning manager object based on serialization data found in file", don't know should returning code, can't return object, because return type manager. first time working serialization, i'm unsure of here. i've tried return manager(obj); return obj; ***just tried return (manager) obj; and working!! it's return (manager)obj; not return manager(obj); ! – johnchen902 apr 20 @ 5:05

php - Invalid argument supplied for checkbox -

my site showing warning: invalid argument supplied foreach() in /admin/insert.php on line 37 i have used php code data insert in mysql database checkbox how can solve it? thanks <table> <tr> <td bgcolor="#ffebc1"> <input type="checkbox" name="e1[]"value="1" > 国語 <input type="checkbox" name="e1[]" value="2" > 算数 <input type="checkbox" name="e1[]" value="3" > 理科 <input type="checkbox" name="e1[]" value="4" > 社会 <input type="checkbox" name="e1[]" value="5" > 英語 </td> </tr> </table> <?php $ele_school = $_post['e1']; $selected_schoo2 = ""; foreach ($ele_school

c# - WinbioEnrollment returns 8009802C? -

i have developed fingerprint management application wbf in windows 7 . it works fine in windows 7. but using windows 7 in vmware returns 8009802c . 8009802c told requested operation not valid current state of session or biometric unit. so how resolve this? note: in vmware,i using windows7 home basic.

how to run application even it is closed Blackberry -

how can make alarm application in blackberry? this means have time picker user selects time, save time , show dialog when system time matches time. i have used realtimeclocklistener , method clockupdated() give me time @ every minute. when closed app method closed i want execute method if app closed or not public void clockupdated() { int hour = calendar.getinstance().get(calendar.hour_of_day); int minute = calendar.getinstance().get(calendar.minute); //system.out.println("----"+calendar.getinstance().get(calendar.am_pm)); string = ""+calendar.getinstance().get(calendar.am_pm); } you have use alternate entry point , start background application on device startup listening realtimeclocklistener event. use persistence store , share alarm time data. see running in background part 1 , part 2 , creating always-on experience more details.

ruby on rails - Rake db:migrate - how do I know if there is an unrun migration -

i working on existing rails application, making changes , updating it. how check if there unrun rake db:migrate in it? there direct command? running this: rake db:migrate:status would give this: 20130415141113 rename coupon discount coupon 20130416144722 create ratings down 20130419102623 add published product down 20130419124429 add attachment photo users anything 'down' has not been migrated.

Add a day with selected date using Jquery datepicker -

i have been trying add day date field date selected of current field , onselect: function(date) { var date2 = $('.currdate').datepicker('getdate'); date2.setdate(date2.getdate()+1); $('.nextdt').datepicker('setdate', date2); } however getting @ date2.setdate(date2.getdate()+1); message: object doesn't support property or method how can solve issue? it because, currdate might empty. if currdate emtpy $('.currdate').datepicker('getdate') return null in case date2.setdate(date2.getdate()+1); throw error update: $(function() { $('#nxtdate').datepicker({ dateformat: "dd-m-yy", }); $("#currdate").datepicker({ dateformat: "dd-m-yy", mindate: 0, onselect: function(date){ var date2 = $('#currdate').datepicker('getdate'); date2.setdate(date2.getdate()+1);

Populating PHP array from MySQL for use by Amcharts -

i'm trying set simple amcharts graphs company intranet webpage. on last 2 weeks have created html/js , produced nice graphic using amcharts (data hard-coded in html demo purposes). installed xampp , created mysql database, populated tables , data gets imported csv files. so far, working fine - can display nice graphics , can collect data supplying data graphs. however, have been approaching problem 2 ends (getting source data database , presenting data in graph on webpage). need join these 2 ends, can feed amcharts data mysql. i know need use php data mysql , put array can used amcharts php knowledge basic , i'm struggling code. what have php code connects mysql , extracts data display in browser - works. don't know how data multi-dimensional array in format amcharts needs plotting graph. it great if guys give me here , fill in missing pieces. have pseudo code logic of creating array basis 'real' php code. this pseudo code populating array: ;chars

android - Achieving the same result without paddingLeft property -

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="5dip" > <linearlayout android:id="@+id/linearlayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_marginright="5dip" android:padding="1dip" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:paddingleft="20dp" android:text="total pregnancies" android:textcolor=&qu

php - file size increasing when while uploading and converting video to flv with ffmpeg -

i need upload , convert video format flv. i'm doing ffmpeg , using ffmpeg command ffmpeg -i input.mp4 -vcodec flv -sameq -ar 22050 -f flv output.flv this command running fine problem file size of output file 5 times grater original input file , if reduce it reduces quality also, need help. your command reveals this option 'sameq' removed. if looking option preserve quality (which not -sameq for), use -qscale 0 or equivalent quality factor option. this worked me instead ffmpeg -i input.mp4 -vcodec flv -q:a 0 -q:v 0 -ar 22050 -f flv output.flv

search - IF conditions in rails is not executing -

i'm trying solr search based on text entered user. firts i've check whether entered text store or brand or category. after checking condition want display corresponding riesults in mainnavigationurls table using solr search. here controller action. working fine if enter store , can proper results. not going inside brands loop if storesearch found nill. please explain why not executing second case. def search_all @storesearch=site.search fulltext params[:text] with(:multibrand,1) end if(@storesearch.nil?) @brandsearch=brand.search fulltext params[:text] end if(@brandssearch.nil?) @itemcategorysearch=maincategory.search fulltext params[:text] end @itemcategorysearch.results.each |result| @itemcategorysearch1=mainnavigationurl.search :main_categoty_id, result.id :department_id, params[:deptid].to_i paginate :page=>params[:page], :per_page=>

asp.net mvc - Specify QueryString Parameters in redirect_uri -

i have implemented signup facebook functionality, working fine, have specify parameter in redirect_uri , have specified when accessing fb, giving error: (oauthexception) error validating verification code. please make sure redirect_uri identical 1 used in oauth dialog request if redirect_uri http://localhost:5000/signup/fboauth it works fine,but when specify parameter this(this parameter can have null value) http://localhost:5000/signup/fboauth?checkout= or http://localhost:5000/signup/fboauth?checkout= it starts giving error, possible specify parameters in redirect_uri ? have read on facebook developer's site bug, here

php - Sniffer Snippet to allow brackets on new line -

is there codesniffer snippet allows/forces { } put on newlines every function/method? basically, forcing this: if (true) { // code logic } else { // code logic } and public function test() { // code logic } yes, there ready one. it's called openingfunctionbracebsdallmansniff , can find under /path/to/codesniffer/standards/generic/sniffs/functions . that's functions' declarations. for control structures can take /path/to/standards/squiz/sniffs/controlstructures/controlsignaturesniff.php , tweak pattern array protected function getpatterns() { return array( 'try {eol...} catch (...) {eol', 'do {eol...} while (...);eol', 'while (...) {eol', 'for (...) {eol', 'if (...) {eol', 'foreach (...) {eol', '} else if (...) {eol', '} elseif (...) {eol', '} else {eol

php - How to skip code when file_get_contents fails? -

when use valid url following, file_get_contents return html code $html = file_get_contents("http://www.google.com/"); but if url invalid: $html = file_get_contents("http://www.go1235ogle.com/"); //invalid url. line give error message my code output error message notice: trying property of non-object if file_get_contents can't open given url, want hide error message it's outputting , skip code bellow if else statement. if (false === $html) { //skip code in here ? } but code above doesn't help. can please tell me how can correct problem? if (false === $html) { // todo: handle case when file_get_contents fails } else { // todo: handle case when file_get_contents succeeds } to rid of notice: trying property of non-object , either turn off outputting error messages turning display_errors off (recommended in production environment), or set error_reporting lower level. however, code posted should not produce notice: t

Need guidance on RewriteRule for Opencart Site -

i have built new opencart shop in sub-directory of old root domain : ie. http://www.old-domain.com/opencart have new domain name points ok sub-directory: ie. http://www.new-domain.com (i have updated both config.php files correctly) however, clicking on internal link shows old-domain url in address bar. so need guidance in replacing (rewriting) old name new 1 - whilst still retaining correct paths etc. have done fair amount of research, , tried , in htaccess without success. thank you. the problem opencart installed on old domain url address set constant (define) within config files. if want change it, go open these 2 files: <opencart_root>/config.php <opencart_root>/admin/config.php and edit these defines: // http define('http_server', 'http://olddomain.com/admin/'); define('http_catalog', 'http://olddomain.com/'); define('http_image', 'http://olddomain.com/image/'); // https define('https_ser

javascript - C# webbrowser - trigger right click -

Image
i'm writing code on visual studio in order information web page. need open context menu of html element , looking that: webbrowser.navigate("javascript: document.getelementsbyclassname('classname')[1].rightclick();void(0);"); but, unfortunately, noticed click() function exists in javascript. there workaround? thank all! you can flowing steps: get position of web-browser control on form: point controlloc = this.pointtoscreen(webbrowser1.location); get position htmlelement on web-browser control x= element.offsetrectangle.left; y =element.offsetrectangle.top; sum positions: controlloc.x = controlloc.x + element.offsetrectangle.left; controlloc.y = controlloc.y + element.offsetrectangle.top; set mouse position new location: cursor.position = controlloc; simulate mouse right-click: mousesimulator.clickrightmousebutton(); complete code: public partial class form1 : form { public form1() { init

extjs4.1 - Extjs 4 How to merge 2 similar records into one record -

i have grid, want merge similar records 1 record. i don't want group record, want merge record i mean, { { firstfield: "record1", commonfield: "abc", fourthfield: "4" }, { firstfield: "record2", commonfield: "abc", fourthfield: "5" }, { firstfield: "record3", commonfield: "abc", fourthfield: "6" } } so above json u can see there "commonfield" has similar text. have show 1 record instead of 3 records, fourthfield added [4+5+6] final json should become like { { firstfield: "record1", commonfield: "abc", fourthfield: "15" } } is there way achieve ? summary addition or operation similar can on records ?

org.hibernate.SessionFactory not found in Spring 3.2.3.RELEASE, but works good in 3.2.0.RELEASE -

i have such maven configuration: <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> ... <dependencies> ... <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>3.2.3.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-orm</artifactid> <version>3.2.3.release</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.1.9.final</version>

PHP and XML - Set unique ids in document -

i have script example: while (count($xml->xpath('*[@id="' . $id . '"]/@id')) > 0) { $id = 'example_' . ++$x; } but if check 1.000 childrens in element, must wait more hour response. how quicker check if id exists? thank's in advance tip! get unique id grabbing highest id , add 1 it. didn't provide xml, assume following example: <elements> <element id="example_1" /> <element id="example_5" /> <element id="example_27" /> </elements> this code (php >= 5.3 inline function): $xml = simplexml_load_string($x); // assume xml in $x $ids = $xml->xpath("//element/@id"); $newid = max(array_map( function($a) { list(, $id) = explode("_", $a); return intval($id); } , $ids)) + 1; $newid = "example_$newid"; echo $newid; output: example_28 see working: http://codepad.viper-7.com/sfvf7v c

html - Outer span width of bigger inner span? -

i want make outer span width of longer inner span. c should hidden until hover make b hidden. if @ demo , click button you'll see once b longer c breaks. possibility server side check string length , choose should left side breaks depending on string lllllllll <-- 9 chars wwww <-- 4 chars wider source of demo html test <span class="a"> <span class="b">bbbb</span> <span class="c">ccccccccc</span> </span> test <button class="btn">make b bigger</button> css: .a { border: black dotted 1px; } .b { position:absolute } .c { visibility:hidden } .a:hover .b { visibility:hidden } .a:hover .c { visibility:visible } js: $(".btn").click(function () { $(".b").html("long word here"); }); my previous solution mistaken. 1 better: http://jsfiddle.net/jzjwm/10/ the disadvantage have give b , c fixed height . can

SQL query uses "wrong" join -

i have query gives me wrong result. tables: a +----+ | id | +----+ | 1 | | 2 | +----+ b +----+----+ | id | x | b.id = a.id +----+----+ | 1 | 1 | | 1 | 1 | | 1 | 0 | +----+----+ c +----+----+ | id | y | c.id = a.id +----+----+ | 1 | 1 | | 1 | 2 | +----+----+ what want do: select rows a. each row in count in b x value 1 , x value 0 b.id = a.id. each row in minimum y c c.id = a.id. the result expecting is: +----+------+--------+---------+ | id | min | count1 | count 2 | +----+------+--------+---------+ | 1 | 1 | 2 | 1 | | 2 | null | 0 | 0 | +----+------+--------+---------+ first try: doesn't work. select a.id, min(c.y), sum(if(b.x = 1, 1, 0)), sum(if(b.x = 0, 1, 0)) left join b on ( a.id = b.id ) left join c on ( a.id = c.id ) group a.id +----+------+--------+---------+ | id | min | count1 | count 2 | +----+------+--------+---------+ | 1 | 1 | 4 |