Posts

Showing posts from March, 2011

html - alter css on another div not working as it is not in the same element -

#match1 not change when hover on #id1 ? worked when both in same div element on page stops working when #id1 inside div. i want use css no javascript please! http://jsfiddle.net/fhzen/ html <div> <div id="id1">div</div> <div id="id2">div</div> <div id="id3">div</div> </div> <div id="match1">a </div> <div id="match2">b </div> <div id="match3">c </div> css #id1:hover ~ #match3 { color: red; font-weight:bold; font-size:40px; } you using preceding selector the preceding selector targets precedent element same parent 1 of target , if want target match3 div being preceed id1 markup should follows <div> <div id="id1">div</div> <div id="id2">div</div> <div id="id3">div</div> <div id="match1"

plsql - Correct way of writing PL SQL conditions -

below condition table request. level of till 300$ 301-500$ 501-3400$ credit card usage in 3 month 0% 0% 0% 0% 1-30% 30% 0% 0% 31-50% 50% 0% 0% 51-60% 50% 15% 0% 61-70% 100% 15% 0% 70%~ 100% 30% 30% my task retrieve information mentioned above in 1 table using pl sql. have table request consists of 3 columns client_id, level_3m , credit_limit output(for example) should using above information: level_3m credit_limit($) new_limit(%) 0 50 0 45 400 0 45 250 50 65 350 15 80 1500 30 what have done far? here own script: declare v_level varchar2(100); v_credit_limit varchar2(100); v_id varch

magento - Access custom order attributes -

i have created 3 custom order attributes sales_person_name, sales_type, referral i trying access them in different module. can tell me how access order attributes in different module do have call model i tried $order = mage::getmodel('sales/order')->load($order); and got below output cant data in it. mage_sales_model_order object ( [_eventprefix:protected] => sales_order [_eventobject:protected] => order [_addresses:protected] => [_items:protected] => [_payments:protected] => [_statushistory:protected] => [_invoices:protected] => [_tracks:protected] => [_shipments:protected] => [_creditmemos:protected] => [_relatedobjects:protected] => array ( ) [_ordercurrency:protected] => [_basecurrency:protected] => [_actionflag:protected] => array ( ) [_cansendnewemailflag:protected] => 1 [_historyentityname:protected]

elasticsearch - Faceting on part of a string -

let's i've got documents in index. 1 of fields url. like... {"url": "server1/some/path/a.doc"}, {"url": "server1/some/otherpath/b.doc"}, {"url": "server1/some/c.doc"}, {"url": "server2/a.doc"}, {"url": "server2/some/path/b.doc"} i'm trying extract counts paths search results. presumably query-per-branch. eg: initial query: server1: 3 server2: 2 server1 query: some: 3 server1/some query: path: 1 otherpath: 1 now can broadly see 2 ways approach , i'm not great fan of either. option 1: scripting. mvel seems limited mathematical operations (at least can't find string split in docs) have in java. that's possible feels lot of overhead if there lot of records. option 2: store path parts alongside document... {"url": ..., "parts": ["1|server1","2|some","3|path"]}, {"url":

c# - Whats the opposite opperation for += using strings? -

for example have string a="hello"; a+="world"; this put world @ end. how can put @ beginning? simply: string = "hello"; = "world" + a; ultimately, a += "world"; abbreviated syntax for: a = + "world"; no such abbreviation exists if want reverse order of operands. as side note - keep in mind if doing lot (in loop etc) may better consider stringbuilder avoid lots of intermediary string s.

jenkins - is sonar multi-module broken? -

trying make multi module project dowloaded samples in github: use folder https://github.com/sonarsource/sonar-examples/tree/master/projects/multi-module/sonar-runner/java-sonar-runner-modules-own-configuration-file project base dir in command line in folder, type /opt/sonar-runner/bin/sonnar-runner first thing find sonar-project.properties has property named sonar.sources=src , executing throws exception in thread "main" org.sonar.runner.runnerexception: must define mandatory properties: sources then correct property sources=src , runner execution finish, adds project sonar server, no code, modules or file detected. if project empty. it same other examples , own project. no matter if java, python... any welcome you using old version of sonar runner and/or sonar. please update latest versions (sonar runner 2.2 , sonar 3.5.1).

php - phpBB remote file upload -

i want able upload remote file server through phpbb without having file downloaded pc first. how can achieved? i have simple code have tested , job, can put , need modify in phpbb? <form method="post"> <input name="url" size="50"/> <input name="submit" type="submit"/> </form> <?php // maximum execution time in seconds set_time_limit(24 * 60 * 60); if (!isset($_post['submit'])) die(); // folder save downloaded files to. must end slash $destination_folder = 'mydownloads/'; $url = $_post['url']; $newfname = $destination_folder . basename($url); //open remote file $file = fopen($url, "rb"); if ($file) { //write local file $newf = fopen($newfname, "wb"); if ($newf) { while (!feof($file)) { fwrite($newf, fread($file, 1024 * 8), 1024 * 8); } } } if ($file) { fclose($file); } if ($newf) { fclose($newf

iphone - Can i test accelerometer effect in Xcode simulator? -

i creating app manage alpha property of image views. alpha property increase/decrease user moves phone.i saw on here using subclass of uiaccelerometer. can 1 me can test on simulator. thanks yo cant test using simulator, should use real device testing accelerometer. check here , may you.

iphone - How to use NSInvocation to call a class method? -

i've class method not declared in h file, implemented in m file. want call in class, since return value int, can't use selector directly, use nsinvocation. below i'm doing: sel selector = ***; nsmethodsignature *signature = [classa methodsignatureforselector:selector]; nsinvocation *invocation = [nsinvocation invocationwithmethodsignature:signature]; invocation.selector = selector; invocation.target = [classa class]; [invocation setargument:(void *)arg atindex:2]; [invocation invoke]; the invoke doesn't succeed, why? when passing arguments, pass address, not value. try following: [invocation setargument:&arg atindex:2]; see [nsinvocation setargument:atindex:] in class reference.

Compare a nullable-int and a string for equality in C# -

i find reason compare 2 values or objects in c# - different types - , find myself unhappy code write. code ends looking (to me) verbose , unclear , end feeling need add comment says "//check if they're equal". (i blame fact that there's no nullsafe-dereference operator saw in groovy once.) in recent example, have 2 variables: string s; int? i; let's want compare them can if they're "obviously equal". i'm defining them "obviously equal" if either: a) int? doesn't contain number , string null, or else... b) string you'd if wrote out numerical value of int? in plain / unformatted fashion. [note in case i'm not bothered whether number 1234 considered equal strings "01234" or "1234.00" (or indeed "1234,00", if you're consider foreign). can have flexibility either way on long "1234" is considered equal, , (e.g.) "1233+1" , "1234z" aren't . c

api - Dilemma with TripIt integration -

we trying integrate tripit our web application itinerary management. created new app , got api key & secret. want use employee's trip account , retrieve trips & create trip in account. have 1 dilemma, since using api key & secret, can able retrieve trips created in account, want retrieve trips of whoever logged in tripit account, api key. so in scenario, ask user's trip credentials , there way can trips using api key? viable solution welcome. if clear me flow can able understand. the (oauth) api key , secret issued application , not specific user account. means application can given permission access user's data. if you've ever worked twitter or facebook apis, tripit's api behaves same. you register application through tripit (sounds you've got step down) using sdk of choice , create endpoints in code handle various steps in oauth workflow . here quick rundown of workflow oauth 1.0, tripit uses. the user begins process of co

postgresql - Join mutiple tables with date -

i have 3 tables **table a** +-----------------+ | name | id | +------------------ | a1 | 1 | | a2 | 2 | | a3 | 3 | +------------------ **table b** +---------------------------------------+-----+-------+ | timestamp | type| id | +---------------------------------------+-----+-------+ | 2013-05-10 08:10:10.161302-04 | b1 | 1 | | 2013-05-10 09:20:10.171302-04 | b1 | 1 | | 2013-05-12 08:10:10.161302-04 | b2 | 3 | | 2013-05-13 08:10:10.161302-04 | b2 | 3 | | 2013-05-14 08:10:10.161302-04 | b1 | 2 | +---------------------------------------+------+------+ **table c** +---------------------------------------+-----+-------+ | timestamp | type| id | +---------------------------------------+-----+-------+ | 2013-05-12 08:10:10.161302-04 | c1 | 1 | | 2013-05-12 09:20:10.171302-04

java - android cannot get the text and do the login -

i trying create login page android app. have 2 editview , button. using static user credentials login. when run app, , try login correct username , password, gives incorrect credential message. here code, simple piece of code public void sendmessage(view view) { edittext user_name = (edittext)findviewbyid(r.id.txt_username); edittext password =(edittext)findviewbyid(r.id.txt_password); if(user_name.gettext().tostring()=="rotanet" && password.gettext().tostring()=="rotanet"){ intent intent = new intent(this, mainactivity.class); startactivity(intent); textview lbl_error = (textview)findviewbyid(r.id.lbl_error); lbl_error.settext(""); } else{ textview lbl_error = (textview)findviewbyid(r.id.lbl_error); lbl_error.settext("wrong credentials!"); } } you using == compare strings. use .equals insted. if(user_name.gettext().tostring().equals("rotan

c# - Extract json data from string using regex -

i have data string below: .... data=[{"caseno":1863,"casenumber":"rd14051315","imageformat":"jpeg","shiftid":241,"city":"riyadh","imagetypeid":2,"userid":20}] --5qf7xjyp8snivhqycpkmdjs-zg0qde4oqiyig content-disposition: form-data ..... i want fetch json data above string. how can use regex find part of string? tried finding indexof("data=[") , indexof("}]") not working fine , proper way do. i'm not entirely there isn't better way this, following regex string should data need: // define regular expression, including "data=" // put latter part (the part want) in own group regex regex = new regex( @"data=(\[{.*}\])", regexoptions.multiline ); // run regular expression on input string match match = regex.match(input); // now, if we've got match, grab first group if (match.success) { // our json string st

intellij idea - Automatic Upload not working in Webstorm -

i have "upload changed files automatically default server" set "always", not working. can upload files if right click on project , select upload server context option. if save file change there no automatic upload happening. this used work me before. idea doing wrong? problem coped across .idea folder project , adjusted that. i started fresh new projet , seems work fine. lesson learned, don't reuse other projects in idea. create fresh new project

How to set combox value on form from grid with nested data? Extjs 4.2 Mvc -

i have grid pops edit form combobox. before show view load combobox store. set values of form using form.loadrecord(record); . loads primary record ok. how load associated data value tied combobox combobox's value set correctly. i know can use setvalue manually, guess thinking handled via load form. if form has 3 fields lets firstname lastname , combobox of contacttype. firstname , lastname in primary record contacttype being associated record. if change values in fields lastname or firstname change detected , record marked dirty. if change combobox value record not marked dirty. guessing because 2 different models. how make 1 record. think having combobox on form has values set record in grid common can't find examples of best way accomplish this. here code. my json looks this. primary record has firstname lastname hasone associated record contacttype { "__entities":[ { "__key":"289", "__stamp&qu

java - How to add specific color to Table row in Vaadin? -

i'm trying change color of row on table based on hex value row item. i'm trying generate css on fly similar generating csslayout this csslayout content = new csslayout( ) { @override public string getcss( component c ) { return "background: " + colorcode + ";"; } }; here's code i'm using table.setcellstylegenerator( new table.cellstylegenerator( ) { public string getstyle( object itemid, object propertyid ) { return "green"; } } ); but works setting stylename, i'd have have millions of style names accommodate possible hex values colors user wants. you can use cssinject add-on add needed style name on fly. see https://vaadin.com/directory#addon/cssinject string color = "#ccddff"; cssinject css = new cssinject(getui()); css.setstyles("."+color+" { background-color: "+color+"; }");

ios - uibuttontypedetaildisclosure custom image -

is possible change image of uibuttontypedetaildisclose default 1 more interesting. however, notice i'm asking button, rather 1 type of uibutton. you have change accessoryview of cell. -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath // code initializing cell.. uiimage *image = [uiimage imagenamed:@"interestingimage.png"]; uibutton *button = [uibutton buttonwithtype:uibuttontypecustom]; cgrect frame = cgrectmake(44.0, 44.0, image.size.width, image.size.height); button.frame = frame; [button setbackgroundimage:image forstate:uicontrolstatenormal]; [button addtarget:self action:@selector(accessorybuttontapped:) forcontrolevents:uicontroleventtouchupinside]; button.backgroundcolor = [uicolor clearcolor]; cell.accessoryview = button; return cell; }

a free solution to package java web application with tomcat to an exe -

i made java web application uses hibernate, spring , jsf. deployed on tomcat 7. want distribute external users, i'm afraid can decompile classes , java code. excelsior jet fits needs because packages tomcat , war file of web application exe file can distributed third party. but excelsior expensive me , i'm looking free solution pack staff 1 exe file. edit : if use obfuscation. it's going modify methods , fields names. problem i'm calling them xhtml files. won't accessible anymore. you obfusticate code free using proguard . there other solutions that'll too, might not free.

javascript - Internet Explorer Error : SCRIPT5009: ArrayBuffer is undefined -

i receiving error in internet explorer 9 , under not occur on other browsers. it's: script5009: 'arraybuffer' undefined my code follows var rawlength = raw.length; var array = new uint8array(new arraybuffer(rawlength)); for(i = 0; < rawlength; i++) { array[i] = raw.charcodeat(i); } the line breaks var array = new uint8array(new arraybuffer(rawlength)); does know if there solution or workaround this? require functionality work in browsers. arraybuffer isn't supported until ie10 (and think shows it: http://caniuse.com/typedarrays ). you can use polyfill, , here's one: https://github.com/inexorabletash/polyfill/blob/master/typedarray.js polyfill taken from: https://github.com/inexorabletash/polyfill

openerp - Stock moves & multi-company -

structure: created companies (a, b, c, d). b , c, d children of a. companies b,c,d has own warehouses. company don't have - it's main office. i need move stock b c - use internal moves. products go 1 warehouse another... , operation visible manager b. what want: manager company b start move products c. manager c see document started operation, approve , manager b can continue operation. is here ability this? the goal let managers b & c work , see documentation moves b c. the best way organise in openerp internal sales. example: manager c wants goods company b warehouse. manager b create sale order company c. , invoice created visible in company c too. manager b create delivery order (that visible in c !) , create stock moves has openerp ? you can select destination location , source location on move line of internal move movement of goods between 2 child companies.

gwt - Vaadin InvientChart widgetset error -

can explain me how start invientchart add-on? have : make new vaadin project add jar webcontent/web-inf/lib add jquery.js , highchart.js webcontent/js folder create class extend applicationservlet , add url above js file change servlet class in web.xml make invientpie class link run project , compile widgetset i'm getting error : failed load widgetset: /chartproject/vaadin/widgetsets/com.example.chartproject.widgetset.chartprojectwidgetset/com.example.chartproject.widgetset.chartprojectwidgetset.nocache.js?1368453503030 i'm using invientcharts 0.8.6 , vaadin 6.8.5, gwt-dev 2.3.0, gwt-user 2.3.0 am missing something? can please tell me right sequence use add-on clearly. thanks edit : here widgetset.xml after compile <?xml version="1.0" encoding="utf-8"?> <!doctype module public "-//google inc.//dtd google web toolkit 1.7.0//en" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gw

c++ - Activate cursor in QTextEdit -

i cannot find way activate cursor inside qtextedit without clicking inside actual widget. want able is, type in side qtextedit window, click on qpushbutton , have cursor stay active inside qtextedit without having click in window again. ideas? when user clicks button, should give focus text edit using setfocus() : mytextedit->setfocus();

java - a long bigger than Long.MAX_VALUE -

how can long number bigger long.max_value? i want method return true: public static isbiggerthanmaxlong(long l){ return l>long.max_value; } um, method can't return true . that's point of long.max_value . really confusing if name were... false. should called long.some_fairly_large_value , have literally 0 reasonable uses. use android's isuseragoat , or may roll own function returns false . note long in memory takes fixed number of bytes. from oracle : long: long data type 64-bit signed two's complement integer. has minimum value of -9,223,372,036,854,775,808 , maximum value of 9,223,372,036,854,775,807 (inclusive). use data type when need range of values wider provided int. as may know basic computer science or discrete math, there 2^64 possible values long, since 64 bits. , know discrete math or number theory or common sense, if there's finitely many possibilities, 1 of them has largest. long.max_value . asking tanta

javascript - js dataTable not working -

Image
i dont know im doing wrong. have normal table this: <table id="table_list_values"> <thead> <tr> <th> seq </th> <th> order </th> <th> code </th> <th> description </th> <th> label code </th> </tr> </thead> </table> nothing anormal. then, populate datatable have make ajax call once press buttom(not before alse). returns me alot of data how table being display: what have make paginate? here i've tried: "bpagination:" $('#listvalues').datatable( { "bpaginate": true } ); "blengthchange" $('#listvalues').datatab

python - Script not working since windows 7 -

i have following script worked fine on xp, since have new pc on windows 7 professional code has stopped working import os import shutil time import strftime logsdir="c:\logs" zipdir="c:\logs\puttylogs\zipped_logs" zip_program="zip.exe" files in os.listdir(logsdir): if files.endswith(".log"): files1=files+"."+strftime("%y-%m-%d")+".zip" os.chdir(logsdir) os.system(zip_program + " " + files1 +" "+ files) shutil.move(files1, zipdir) os.remove(files) the error getting u:>python logs.py zip warning: name not matched: ping_dms_155.log zip error: nothing do! (ping_dms_155.log.2013-05-14.zip) traceback (most recent call last): file "logs.py", line 24, in <module> shutil.move(files1, zipdir) file "c:\python27\lib\shutil.py", line 301, in move copy2(src, real_dst) file "c:\python27\lib\shut

row height - Excel VBA rowheigt from value in range -

i have excel-sheet values in column d. set row height in relation value of cell d of each row. values in d small %-values 0.0593 %, except of first (d4 = 31 %) , last (d92 = 40 %) to small values @ reasonable height i'd multiply them 10'000 - there comes problem 409 max height. i have script works until comes high values tried if formula. frankly: have no idea doing here... copied together. so problems: working in range of d5-d91 , if value should go on 409 give him 15px. thanx help! private sub worksheet_selectionchange(byval target range) dim long = 4 cells(rows.count, 1).end(xlup).row - 1 cells(i, 4) if .cells(i, 4).value * 10000 > 409 rows(i).rowheight = 12 else rows(i).rowheight = cells(i, 4).value * 10000 end if end next end sub copy below code standard module & run. may have tweak code per requirement. sub sample() dim long = 4 c

asp.net - Why WCF service change date value in case different TimeZone on client and server side -

i have wcf service, 1 service method return array of objects, single object contain date values, example {14-05-2013 08:00:00} kind: unspecified. can see in debug mode value before return point in method. on cleint side getting json object contain wrong date value property: date(1368511200000+0200) equal tue may 14 2013 09:00:00 gmt+0300 (fle daylight time) it happens in case when client (browser) , iis server in different time zones. why see shifted date values , how fix ? thanks. the date values stay same, presentation shifts because timezone changes. 08:00 in berlin is 07:00 in london. if want transfer same presentation regardless of fact it's no longer same instant in time once presentation crosses time zones, send string instead of date. you change kind of datetime utc, have implications on server side well. more information time zone conversion available here .

objective c - Value comparison with NSString - Xcode -

i'm trying compare value 1 stored in nsstring, following error: implicit conversion of int 'nsarray *' disallowed arc here code: nsstring *tmplabel = [tmpc description]; temp.text = [nsstring stringwithformat: @"%.f", [tmplabel doublevalue]]; if (tmpc >= 10) { // perform action } else { // perform action } how can comparison? want see if value stored bigger or equal 10. thanks time :)

ruby - Sidekiq workers use too many mongo connections -

i'm running sidekiq under mri 1.9.3, , using mongomapper orm. my sidekiq workers dying following exception: mongo::connectiontimeouterror: not obtain connection within 15.0 seconds. max pool size 40; consider increasing pool size or timeout. sidekiq configured run concurrency level of 30. as can see, i've set mongo connection pool 40 timeout of 15 seconds, thinking should give me more enough mongo connections active sidekiq threads. however exception happens frequently, particularly when number of active workers approaches maximum. i've seen mentioned respect mongoid on sidekiq wiki: https://github.com/mperham/sidekiq/wiki/problems-and-troubleshooting#too-many-connections-to-mongodb however mongoid uses different mongo driver mongomapper, kiqstand middleware doesn't help. mongomapper uses official mongo driver supposed thread safe , employs connection pool. what needs happen in sidekiq server middleware free mongomapper connections when thread fin

html - A variable width div to hold paragraph elements? -

here first attempt: http://jsfiddle.net/nqaqb/6 <div id = 'hold'> <p class='item'>men1</p> <p class='item'>men2</p> <p class='item'>men3</p> </div> #hold{ background: #ff0000; width: auto; } .item{ display:inline; margin-left: 20px; } however width covers whole window. how can have width expand , contract, depending upon how many p tags in holding div. i want div width vary inside content. production code: /*************************************************************************************************** **media control ** */ #mi_control{ position: absolute; top: 660px; display: inline; border: 1px dotted #aaaaaa; padding-top: 5px; padding-bottom: 5px; width: 400px; border-radius: 5px; } .menu_bottom{ font-family: "lucida grande", verdana, arial, "bitstream vera sans", sans-serif; font-size: 12px; color: #000000;

c++ - Dependent name resolution & namespace std / Standard Library -

while answering this question (better read this "duplicate" ), came following solution dependent name resolution of operator: [temp.dep.res]/1: in resolving dependent names, names following sources considered: declarations visible @ point of definition of template. declarations namespaces associated types of function arguments both instantiation context (14.6.4.1) , definition context. #include <iostream> #include <utility> // operator should called inside `istream_iterator` std::istream& operator>>(std::istream& s, std::pair<int,int>& p) { s >> p.first >> p.second; return s; } // include definition of `istream_iterator` after declaring operator // -> temp.dep.res/1 bullet 1 applies?? #include <iterator> #include <map> #include <fstream> int main() { std::ifstream in("file.in"); std::map<int, int> pp; pp.insert( std::istream_iterator<

delphi - How do I display a WebP image in a TImage or just TBitmap? -

delphi-webp project providing delphi bindings google's libwebp.dll , loads webp images, project provides no delphi-specific image code. how can load webp image timage or tbitmap? you should develop , register tgraphic sub-class, can load/save webp format images, tpngimage, tjpegimage , tgifimage classes work. you can examples of such classes in recent versions of vcl (jpeg , png), on torry.net or libraries like: http://melander.dk/delphi/gifimage/ http://www.soft-gems.net/index.php/libs/graphicex-library http://galfar.vevb.net/imaging/doc/html/faq.html just learn how implemented in there projects , same project of webp support. ps. can derive class tbitmap rather tgraphic - less effective simplier do. example of approach see http://galfar.vevb.net/wp/projects/jpeg2000-for-pascal/ loose webp-specific information , "quick , dirty" hack rather proper vcl-targeted implementation.

About ASP.NET Web Pages Global -

i new learner asp.net. saw “_appstart.cshtml”, “_pagestart.cshtml” , “_viewstart.cshtml” act global headers or footer. (1)if want trigger right before page output, should put code in _viewstart.cshtml of others? (2)let c html code before output, beside appending code c can replace code c? such making text uppercase or replace text? (3)will asp.net cache process won't run each time? benone answer point 1 the _viewstart file can used define common view code want execute @ start of each view’s rendering. example, write code within our _viewstart.cshtml file programmatically set layout property each view sitelayout.cshtml file default actually it's basepage in asp.net can keep common code. or can write logic directly in view below. @{ layout = "~/views/shared/_layout.cshtml"; if (some consition) { layout = "~/views/shared/_adminlayout.cshtml"; } } alternatively you can override action executing method, executes before e

Delete NOT IN an array deletes all the rows, PHP Mysql -

i trying accomplish delete rows of table event id equal value(unique key) , ids not in array; so lets event_id=5 has 4 rows (1,2,3,4) , array has (1,2) want delete 3,4 event id equal 5 . to that: ->select id array , put id's array (seems working) ->delete rows except 1 comes select query(fails deletes rows of table). $query = "select file_id files event_id=$event_id , name in ('$names')"; $result = $sql->query($query); //printf("$query: %s\n", $query); var_dump($query); //printf("\n"); if (!$result) { var_dump($result); printf("query failed: %s\n", $mysqli->error); sendresponse(417, json_encode("query failed")); exit; } //printf("\n"); $rows = array(); while($row = $result->fetch_row()) { $rows[]=$row; printf("\n"); } $result->close(); var_dump($rows); p

jquery - How to get the style value using attr -

Image
my html code here <i id="bgcolor" style="background-color: rgb(255, 146, 180)"></i> i want background-color value using jquery attr what tried bellow $("#bgcolor").mouseleave(function(){ var bodycolor = $(this).attr("style"); $("body").css(bodycolor); }); but output background-color: rgb(255, 146, 180); and add .css not work .how achieve task ? check out documentation .css: http://api.jquery.com/css/ var bodycolor = $(this).css("backgroundcolor");

arrays - How to split value from mysql query in php -

i'm newbie in php , mysql. i've got table called 'cat_filter' done this cat_filter_id cat_filter_value cat_filter_name categories_id 5 colore metallo bianco 13 2 tipologia schienale rete 11 3 finiture cromata 11 4 tipologia poltrona direzionale;operativa;visitatori 11 i've done code : $connessione=mysql_connect($db_host,$db_user,$db_password); mysql_select_db($db_database,$connessione); $data = mysql_query("select * cat_filter categories_id=$current_category_id") or die(mysql_error()); echo '<p>'; while($info = mysql_fetch_array( $data )) { echo ''.$info['cat_filter_value'] . ': <a href="index.php?main_page=advanced_search_result&keyword='.$info['cat_filter_name'] . '&search_in_description=1&categories_id='.$current_category_id . &#

matlab - Fourier transform of image in magnitude not working -

Image
i want plot magnitude , phase of fourier transform of image in matlab. implemented tutorial read in link line line magnitude, white screen plotted. my code: i=imread('16.jpg'); ffta = fft2(double(i)); figure, imshow(abs(fftshift(ffta))); title('image fft2 magnitude'); figure, imshow(angle(fftshift(ffta)),[-pi pi]); title('image fft2 phase') my original image : where problem? two things here. input image 2d fft should intensity image (or grayscale), mxnx1 in size, not rgb, mxnx3 in size. if image matrix of class double , intensity expected in [0,1] range. values greater 1 shown 1 (filled highest color of figure colormap). to convert rgb image grayscale use rgb2gray : irgb = imread('16.jpg'); igray = rgb2gray(irgb); to solve latter rescale image or use imagesc combined axis equal preserve scale: figure; imagesc(abs(fftshift(ffta))); axis equal; axis tight;

html - @media screen (min-width:1200px) not working in Chrome -

i have problem in @media screen (min-width:1200px) . i have set 2 kinds of attributes (classes) image , in css, expecting make image , "td" in put image smaller when resizing screen, when screen more 1200px still shows smaller size of image. this html : <tr> <td class="indexphototd"> <img class="indexphoto" src="../wp-content/uploads/2013/05/indexphoto300.jpg" /></td> <td>more stuff here</td> </tr> this css : /* browsers larger 1200px width */ @media screen (min-width: 1200px) { .indexphototd { width:300px !important; } .indexphoto { width:300px !important; } } @media screen (min-width: 800px) { .indexphototd { width:200px !important; } .indexphoto { width:200px !important; } } your media queries overlap: 1200px still 800px or larger. reverse media queries. @media

c# - Reading data from a RS232 port with RFID -

update i'm reading rfid card , , signing it's value textbox.text . it's working in first time pass card in rfid reader , form second time pass card, instead shows whole card's id on textbox.text , it's showing last letter of card's id. can see whole number appear , vanish fast on textbox, second time pass card, last letter remain in textbox. may causing ? here's current code: using system; using system.windows.forms; using system.io.ports; using system.text; using system.text.regularexpressions; namespace rfid_reader { public partial class portaserial : form { private serialport porta_serial = new serialport("com1", 9600, parity.none, 8, stopbits.one); public portaserial() { initializecomponent(); } private void portaserial_load(object sender, eventargs e) { try { if (porta_serial.isopen) {

tee - Python - How do I split output? -

this question has answer here: how duplicate sys.stdout log file in python? 14 answers newb python question. i've been reading on tee() , different ways of splitting output. cant find example splitting output terminal , log file. i've been playing around options , have far: def logname(): env.warn_only = true timestamp = time.strftime("%d_%b_%y") return "%s_%s" % (env.host_string, timestamp) sys.stdout = open('/home/path/to/my/log/directory/%s' % logname(), 'w') the above log file host name_datestamp won't display on screen. when want stop logging do: sys.stdout = sys.__stdout__ how can log file definiton above , display terminal @ same time? on right path tee()? like this? [user@machine ~]$ python python 2.7.3 (default, aug 9 2012, 17:23:57) [gcc 4.7.1 20120720 (red hat 4.7.1-5)] on l

r - Can the minimum y-value be adjusting when using scales = "free" in ggplot? -

Image
using following data set: day <- gl(8,1,48,labels=c("mon","tues","wed","thurs","fri","sat","sun","avg")) day <- factor(day, level=c("mon","tues","wed","thurs","fri","sat","sun","avg")) month<-gl(3,8,48,labels=c("jan","mar","apr")) month<-factor(month,level=c("jan","mar","apr")) snow<-gl(2,24,48,labels=c("y","n")) snow<-factor(snow,levels=c("y","n")) count <- c(.94,.95,.96,.98,.93,.94,.99,.9557143,.82,.84,.83,.86,.91,.89,.93,.8685714,1.07,.99,.86,1.03,.81,.92,.88,.9371429,.94,.95,.96,.98,.93,.94,.99,.9557143,.82,.84,.83,.86,.91,.89,.93,.8685714,1.07,.99,.86,1.03,.81,.92,.88,.9371429) d <- data.frame(day=day,count=count,month=month,snow=snow) i y-scale in graph, not bars: ggplot()+ geom_line(data=d

phpmyadmin: save query history to central server -

i trying setup central phpmyadmin server multiple db servers. was reading these: http://wiki.phpmyadmin.net/pma/pmadb http://www.howtoforge.com/forums/showthread.php?t=55811 signon works fine both localhost(phpmyadmin.example.com) , remote server(db1.example.com) , users able login both. have created phpmyadmin database , pma_* tables in phpmyadmin.example.com. history gets saved sql queries on localhost. when user logs in db1, sees error: the additional features working linked tables have been deactivated. more details: $cfg['servers'][$i]['pmadb'] ... ok $cfg['servers'][$i]['relation'] ... not ok [ documentation ] general relation features: disabled $cfg['servers'][$i]['table_info'] ... not ok [ documentation ] display features: disabled $cfg['servers'][$i]['table_coords'] ... not ok [ documentation ] $cfg['servers'][$i]['pdf_pages'] ... not ok [ documentation ]

c# - ASP.Net 4.5 Model Binding Sorting By Navigation Property -

all, i have grid view has following columns. paging work great, not sorting. everytime click on category column sort category error: instance property 'category.categoryname' not defined type 'esa.data.models.entity.project' this error statement not true because gridview able display column correctly. here select method public iqueryable<project> getprojects() { applicationservices objservices = new applicationservices(); iqueryable<project> lstproject; lstproject = objservices.getprojects(); return lstproject; } any suggestion? <asp:gridview id="grdproject" runat="server" showheader="true" autogeneratecolumns="false" cellpadding="2" cellspacing="2" itemtype="esa.data.models.entity.project" selectmethod="getprojects" datakeynames="projectid" allowsorting=&qu

Browser issue with constant refresh when typing in text field -

this more of computer question programming question , posting in wrong place, please let me know. system running windows 8, 64bit. regardless of browser use - ie or chrome, every time attempt type text field, screen refreshes. have noticed refresh symbol starts flash. can stop pressing esc key, screen goes blank. have done complete scan of computer , found no viruses. ideas great appreciated making things difficult, including typing message. i uninstalled , reinstalled , seemed fix problem.

configuration - Multi language Android application -

i'm creating multi language android application , made folders different languages , works perfect. the issue troubles me when user selects different language use method change local configuration , working great! but don't feel changing user local setting right way because changing local setting effecting not application. is there smarter way? don't want affect user setting outside application.

sql server - Efficient way to match column values with corresponding master table values -

i importing excel data in stored procedure , storing records in temporary table. want validate values of few columns corresponding values in master table. i have added 1 more column temp table namely: status, holds either null or skip value. for instance, temporary table contains 1 column namely location. customers send pre-filled excel sheet columns filled. on such column location column. spelling of location not correct. if location say, new jersey, excel sheet might contain spelling new jarsey. i have location master table stores correct names of locations , ids well. want match location name in temp table corresponding location name in master table. if location fails match, mark status column skip in temp table. there several columns in temp table values of needs match corresponding master table values. is there way verify these column values in more efficient , faster way? want match locations row row , other column values. if understand correctly (actually

windows - python socket: winerror 10056 -

i've read throught introduction python sockets: http://docs.python.org/3.3/howto/sockets.html this server import socket serversocket=socket.socket(socket.af_inet,socket.sock_stream) serversocket.bind(("localhost",8000)) serversocket.listen(5) while true: (client,addr)=serversocket.accept() data=serversocket.recv(1024) print(data.decode("utf-8")) and client import socket s=socket.socket(socket.af_inet, socket.sock_stream) s.connect(("localhost",8000)) the idea server prints data sent client. can see, intended encode message strings bytes utf-8. never came far. with server script running, typed client lines 1 one idle python shell. after third line, error prompted up. since i'm german, vague translation. error message sound different if can reproduce error traceback (most recent call last): file "", line 1, in s.connect(("localhost",8000)) oserror: [winerror 10056] connection attempt tar

git diff tmp file invalid on windows when using external program on Windows 7 -

i'm following docs git configuration page , trying apply windows 7 environment. when run say, "git diff file0" error in p4merge: errors: '/tmp/ch9ccm_file0' (or points to) invalid file. this true statement. not have directory called "/tmp". i've checked in c:\tmp, c:\cygwin\tmp, , %programfiles%\git\tmp. any ideas on how change directory have? edit: additional info. ultimately, i'm trying winmerge (or external program) work. chose use p4merge earlier, because couldn't winmerge work, decided go program used in aforementioned article. below relevant part of .gitconfig: [merge] tool = extmerge [mergetool "extmerge"] cmd = extmerge \"$base\" \"$local\" \"$remote\" \"$merged\" trustexitcode = false [diff] external = extdiff extdiff script: #!/usr/bin/sh # extdiff # wrapper using external diff tool in git echo "file 1: $2" echo "file 2: $5" /usr/local/bin/e

python - delete items from a set while iterating over it -

i have set myset , , have function iterates on perform operation on items , operation deletes item set. obviously, cannot while still iterating on original set. can, however, this: mylist = list(myset) item in mylist: # sth is there better way? first, using set, 0 piraeus told us, can myset = set([3,4,5,6,2]) while myset: myset.pop() print myset i added print method giving these outputs >>> set([3, 4, 5, 6]) set([4, 5, 6]) set([5, 6]) set([6]) set([]) if want stick choice list, suggest deep copy list using list comprehension, , loop on copy, while removing items original list. in example, make length of original list decrease @ each loop. l = list(myset) l_copy = [x x in l] k in l_copy: l = l[1:] print l gives >>> [3, 4, 5, 6] [4, 5, 6] [5, 6] [6] []

c++ - <built-in>:1:2: warning: use of C++0x long long integer constant [-Wlong-long] -

what warning about? seems warning long long constants in built ins. gcc version 4.7.3 (ubuntu/linaro 4.7.3-1ubuntu1). in file included ../include/log4cplus/helpers/stringhelper.h:36:0, ../tests/performance_test/main.cxx:6: <built-in>:1:2: warning: use of c++0x long long integer constant [-wlong-long] you can use new c++11 standard daniel fischer suggests. however, if cross-compiling or have older compiler: -wno-long-long is valid compiler flag inhibit warning (of course man gcc ).

osx - How to set the width of the view displayed as a row in a NSTableView? -

Image
i have view-based nstableview . i have created nsview insert in nstableview row. in xib defining nsview , latter has width set 280 . when add nsview nstableview , width of former changed equal width of nstableview . is there nice way prevent behavior ? thought of including nsview in one, feel bit hacky. if possible, solution involves settings of nstableview . nstableview indeed populated many differents nsview s. as mentioned in comment previous question. want add own views subviews of nstablecellviews. nstablecellview set width of table, child view can width like.

javascript - Undo action if "cancel" is pressed in response to confirm() -

i made quick list, can drag trash can (which removes it). everything works when press "ok", , item gets removed told to. although if press "cancel" confirm popup, item shows in trash, , instead want go in list. jsfiddle: http://jsfiddle.net/gdze8/2/ javascript: $( init ) function init() { $(".contentitem").draggable({ revert: 'invalid' }); $(".list4").droppable( { accept: ".contentitem", drop: function(event, ui) { ui.draggable.hide(); if (confirm("are sure want delete?")){ ui.draggable.remove(); bottominfo (); } else { ui.draggable.show(); } return false; } }); } you'll add confirm on draggable instead, reverting if confirm not confirmed etc : $(".contentitem").draggable({ revert : function(event, ui) { var state = confirm(&qu