Posts

Showing posts from September, 2012

jquery - custom nivo slider slideshow -

i want customize nivo slider slideshow bullets appear in inner image. the slideshow nivo slider looks this: http://demo.dev7studios.com/nivo-slider/ i want customize bullets this: http://wowslider.com/automatic-jquery-slider-noir-squares-demo.html bullets appear in right corner of image. how can this? please me. simply adding following css should trick: .slider-wrapper{ position:relative; } .theme-default .nivo-controlnav{ position:absolute; top:15px; right:15px; padding:0px; z-index:9; }

java - Best approach (if any possible) in windows for getting live screen image -

i want capture frame in display on screen of windows pc regardless of being displayed bitmap or image file or similar. until used java robot api , c++ api, can capture desktop , windows etc. cannot capture that's being drawn using overlay videos or directx games. capturing while video playing returns image video region black , when in game returns image of desktop game isn't running! is there standard method capturing on screen (like in fraps etc.)? or need make custom driver each graphics card (impossible) the following code capturing screenshots java: http://www.codinguide.com/2010/04/capture-screen-shot-from-java.html hope helps.

java - How to send payload data using sitebricks web client using http delete method -

i using sitebricks http client send http requests rest service. question how send payload data delete ? post method accepts data parameter webclient<subnetid> client = web().clientof(deleteuser()).transports(user.class).over(json.class); //client.post(user) <-- ok ! client.delete(); // <-- delete not accepts user !!! ok guys, discussion raised in here answer.

How to redirect folders to index.php using .htaccess? -

folder structure: /index/ /upload/ /something/ these folders don't have .htaccess in them(and shouldn't). when accessing http://site.com/something redirects http://site.com/something/url=something , not desired. rewriteengine on # rewritebase /base/ # rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?url=$1 [l,qsa] adding rewrite condition appending '/' @ end of folders makes additional(and unnecessary) request, not nice. how write rule folders sent directly front controller without unwanted redirects? try adding additional condition exclude existing directories: rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?url=$1 [l,qsa]

UIwebview open document (pdf) in other app -

hello everyone, trying open pdf file in uiwebview other app. can display popup this. screen http://i33.tinypic.com/axv1i.jpg i write code this. put delegate also. uidocumentinteractioncontrollerdelegate -(void)webviewdidfinishload:(uiwebview *)webview { //other code if([filetype isequaltostring:@"pdf"]) { nslog(@"it pdf file."); //other code save nsdocumentdirectory , path // file://localhost/var/mobile/applications/024d40ff-4518-4526-beab- 2a0679fd6308/documents/iphone_user_guide.pdf nsurl *pdfurl = [nsurl fileurlwithpath:pathtodownloadto]; uidocumentinteractioncontroller *doccontroller = [uidocumentinteractioncontroller interactioncontrollerwithurl:pdfurl]; [doccontroller setdelegate:self]; [doccontroller presentopeninmenufromrect:cgrectzero inview:self.view animated:yes]; } } - (uiviewcontroller *) documentinteractioncontrollerviewcontrollerforpreview: (uidocumentinteractionc

ruby - Using rubzip2 and paperclip in rails, how to you create a temporary zip file and save it to paperclip? -

i had code preciously zipped load of files, created zip file in tmp file system , added files there. i'm trying make more efficient using ruby's tempfile store file in code instead of manually writing tmp directory myself , deleting later on. i've written code try , it… def zip_up_files require 'zip/zip' t = tempfile.new(["temp-filename-#{export_type}", '.zip'], :type => 'application/zip') zip::zipoutputstream.open(t.path) |z| #pop files in zip... end #save has_attachment :download on model self.download = file.open(t.path) self.save #delete tempfile... t.close end this sucsfullt saved tempfile .download on model. if navigate saved zip file it's not zip file garbled text document. wondering if there's missing creation or saving of zip before get's saved modle. i've tried putting type tempfile creating. looks zip's missing mimetype. i'm not sure, can help? thanks! the

javascript - how to add comma in textfield in html web page -

this question has answer here: how print number commas thousands separators in javascript 35 answers i have web page in input data <input /> , 1000 want 1,000 not change id value show becuase using same id in other calculation if 1,000 show nan... how can avoid this? <input type="text" id="test" onblur="addcommas()"> <script> function addcommas(nstr){ var offset = nstr.length % 3; if (offset == 0) return nstr.substring(0, offset) + nstr.substring(offset).replace(/([0-9]{3})(?=[0-9]+)/g, "$1,"); else return nstr.substring(0, offset) + nstr.substring(offset).replace(/([0-9]{3})/g, ",$1"); } alert(addcommas("1234567")); </script> i have got code forum... have idea how make function simple shows in input box when id value

html - Javascript function not working properly in IE<10 -

i have link, hides , shows fb:comments element <a onclick="comments(this)"> + comments ( <fb:comments-count href="http://some.url.com" fb-xfbml-state="rendered"> <span class="fb_comments_count">1</span> </fb:comments-count> ) </a> <div class=\"facebook-comments\"><!-- default style 'display:none'--> <fb:comments href=\"http://some.url.com" width="644" num_posts="10"> </fb:comments> </div> this comments() function: function comments(src){ //hide 'a' element called function src.style.display="none"; //show comments element src.parentnode.getelementsbyclassname('facebook-comments')[0].style.display="block"; return false; } this works fine in chrome, firefox, opera, safari , ie10 too, it's buggy in ie<10, happens when click + comments

c - I can't figure out what is wrong with my semaphore implementation -

i need implement producers , consumers in c89 using semaphores. i admit school assignment, going use pseudocode. it took me forever simplify code, can figure out wrong there 1 global variable: threadqueue ready; //global queue holds threads ready run these functions use in code. tried make them self-explanatory: newthread(function); //turns function thread rotatequeue(queue); //rotates queue head becomes tail , next becomes head add2queue(thread, queue); //adds thread queue runthread(newthread); //stops current thread, , runs newthread removehead(queue); //removes head of queue , returns here how designed semaphore: struct semaphore{ threadqueue queue; int val; } wait(semaphore s) { if(--s.val < 0) { add2queue(currentthread, s.queue); runthread(ready.head); } } signal(semaphore s) { if(s.val++ < 0) { add2queue(removehead(s.queue), ready); } rotatequeue(ready); runthread(ready.head); } finally

crud - Insert/Delete/Update With ZK MDB Microsoft Access database File Not work -

i cant insert/update/delete access mdb file on file mdb saw readonly, reason cant use command it? note: mdb file readonly note: software come zk fingerprint product code: 'b3-c/usb' "attendance management system" can work database.mdb, think can too. i try this: try cn.open() commandtext = "insert userinfo(userid,name) values(2,'madaraz')" sqldataadapter = new oledbdataadapter(commandtext, cn) sqlcombuilder = new oledbcommand(commandtext, cn) sqlcombuilder.executenonquery() catch er mysqlexception messagebox.show("error connecting database: " & er.message) cn.dispose() end try when try run above code not error has nothing happens don know going on. i hope expert can me thx guy in advance. if database file read only, won't work. remove read attribute mdb file.

html - Javascript for loop in a select box -

i have webpage form contains input fields , 1 of these listbox. inside listbox have add (in crescent order) numbers go 40000 99999 , increase 1000 every time. example: 40000 - 41000 - 42000 - 43000 ... 97000 - 98000 - 99000 - 99999 i wrote javascript function it's not working. here can see html code: <fieldset style="width:500px;"> <legend><font color="#d8d8d8"><b>required fields</b></font></legend> <font color="#ffffff"><b>player's name</b>:</font> <input type="text" name="nome" /> <font color="#ffffff"><b>vrs</b>:</font> <select name="cognome"> </select> <br /> </fieldset> here there's javascript function <script> var i=40000 for(i;i<42000;i=i+1000) {var select = document.getelementbyid("cognome"); select.options[select.options.length] = new option(i,

html - Why is my 100% height waaay oversized? -

i'm trying track down why background containers "background-overlay" , "background-gradient" pushing height of document beyond content displayed? i'm not sure what's going on here. simple. here template in work http://jordan.rave5.com/tmp/ i'm not sure code problem think 2 aforementioned classes. possible culprits: #background-overlay { z-index: 100; width: 100%; height: 100%; margin: 0; padding: 0; background-color: #273722; background-image: url(images/main-bg.png); background-repeat: repeat; background-attachment: fixed; opacity: 0.0; top: 0; bottom: 0; } #background-gradient { position: fixed; z-index: 200; width: 100%; height: 100%;

Rails and PHP encode64 not agreeing -

i'm try create hmac in rails , verify in php. rails shell: pry(main)>appsecret = '00916893840fe0a29dfdc261efd3a26a&' pry(main)>openssl::hmac.hexdigest('sha1', appsecret, 'get&http%3a%2f%2fopen.tianya.cn%2foauth%2frequest_token.php&oauth_consumer_key%3dfc69b18eb12bab1e9b35d1093c4de9290516cfdc4%26oauth_nonce%3dc09e4bf167fbc7eb374b1abb02b5268d%26oauth_signature_method%3dhmac-sha1%26oauth_timestamp%3d1366882036%26oauth_version%3d1.0') => "8494f6237ee6042a3da8848db21284be17bf6ade" php: $appsecret = '00916893840fe0a29dfdc261efd3a26a&'; $signature = base64_encode(hash_hmac('sha1', $appsecret, 'get&http%3a%2f%2fopen.tianya.cn%2foauth%2frequest_token.php&oauth_consumer_key%3dfc69b18eb12bab1e9b35d1093c4de9290516cfdc4%26oauth_nonce%3dc09e4bf167fbc7eb374b1abb02b5268d%26oauth_signature_method%3dhmac-sha1%26oauth_timestamp%3d1366882036%26oauth_version%3d1.

webpage - Prestashop - Display quantity and features on home featured product -

i dispay features on home featured product. on homefeatured.tpl, i've added : <!-- features --> {foreach from=$products->features item=feature} <!-- wine --> {if $feature.id_feature eq 7} <p class="feature-wine"><a href="{$products->product_link}" title="{$products->name|escape:html:'utf-8'}">{$feature.value|escape:'htmlall':'utf-8'}</a></p> {/if} {/foreach} but doesn't work... have idea ? you need modify homefeatured.php variable model , pass smarty via smarty->assign()

c# - Show Form depending on database condition -

on initial startup of application looking check whether table within database has tuples within it, if condition true not want adddialog form show when false show it. appreciated. this have tried: private void home_loaded_1(object sender, routedeventargs e) { //addsafelimits dialog = new addsafelimits(); //dialog.show(); var query = level in context.safelimits level.upperlimit == null select level; levels = query.tolist(); if (levels== null) { addsafelimits dialog = new addsafelimits(); dialog.show(); } } i think linq return empty instead of null can try use: if (levels== null||levels.count==0) { addsafelimits dialog = new addsafelimits(); dialog.show(); }

javascript - CSS through jQuery not applied -

i in process make slideshow responsive. using simple jquery achieve this. logic is: if width of window < 620, make changes in css through jquery. else set default(fixed) css i have element has top:470px fixed css when window of normal size. if size of window goes below 620, i've changed relative image size (which changes on window resize). here code: function resizevideo() { var width = $(window).width(); if(width < 620) { $('#controls').css('top', $('img').height()); } else { $('#controls').css('top', '470'); } } $(window).resize(resizevideo); in way, controls stick bottom of image when size less 620. of problems stopping me right are: whenever i'm maximizing window size less 620, images scale original sizes, #controls element remains @ same height before maximizing. when resize window size greater 620, #controls stay somewhere around 345px when in actual, height of image gre

mpi - Why is MPI_Bsend not returning error even when the buffer is insufficient to accommodate all the messages -

i trying implement logical ring mpi; every process receives message process id 1 less of current process , forwards next process in cyclic fashion. aim traffic buffer such loses messages or maybe puts them in out of order. cycle of communication finish when message dispatched root node comes again root. here code have tried: including relevant parts of it. if(procid!=root) { sleep(100); while(1) { tm = mpi_wtime(); mpi_irecv( &message, str_len, mpi_char, ((procid-1)>=0?(procid-1):(numproc-1)),return_data_tag, mpi_comm_world,&receiverequest); mpi_wait(&receiverequest,&status); printf("%d: received\n",procid); if(!strncmp(message,"stop",4)&&(procid==(numproc-1))) break; mpi_ssend( message, str_len, mpi_char, (procid+1)%numproc, send_data_tag, mpi_comm_world); if(!strncmp(message,"stop",4))

php - Want to insert into two tables using one form in ZF2 -

this might bit strange, i'll try explain. have table containing users , table containing customers. users have permission data of customers. figured make separate table user permissions, taking user id , customer id foreign keys , having 1 row per customer/user permission. when admin adds new user database using class called userform (posted shortened below reference), uses zend\form, want display customers next form buttons can selected added permissions. now, thought having javascript array appends or removes customer ids if they're selected/deselected, passing array form hidden value , looping through array inserting row permissions table each customer id in array, , taking user id that's been created well. i'm not sure if best way it, it's best come with. hope that's @ least understandable. so, have 1 form, want insert 2 different tables. question, guess, how pass array form value? , how insert not users table, permissions table, when saveuser() meth

import - R - raster function NAs values lower than -9999 in ASCII file -

i have been having problems importing ascii raster has values go min. :-69826220 max. :167780500 . problem encountering when use raster function import ascii file every value smaller -9999 reported na , minimum value -9458 . is bug of function , there workaround? when import same ascii file data frame fine , whole range of values. using same procedure import other ascii rasters , don't have problem. here link ascii file https://dl.dropboxusercontent.com/u/24234831/ps0011yme.asc here session info, opened new session in case. sessioninfo() r version 3.0.0 (2013-04-03) platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] lc_collate=english_united states.1252 [2] lc_ctype=english_united states.1252 [3] lc_monetary=english_united states.1252 [4] lc_numeric=c [5] lc_time=english_united states.1252 attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] raster_2.1-16 sp_1.0-8

sql - Select multiple values from same column based on 2 columns -

best explained using example. trials , results bellow example. there 2 tables (in reality have multiple tables) table: products id name ----------- 1 apple 2 orange 3 pear table: attributes id prod_id attr_id value ---------------------------- 1 1 101 20 2 1 102 red 3 1 103 sweet 4 2 101 30 5 2 102 orange 6 2 103 sour 6 3 101 40 7 3 102 green 8 3 103 sweet desired output name attr_id 101 'price' attr_id 102 'taste' ------------------------------------------------------ apple 20 sweet orange 30 sour pear 40 sweet i have managed sql till have had call 3 tables , combine column values shown above. can't head wrapped around this. appreciated. you have query each column separately... select p.name, (select value attributes attr_id=101 , a.prod_id=p.id) price

java - trouble returning an object, Bin, through a method. Needs to "Cast" or change to Object -

i'm beginner trying learn java! i trying out book building skills in object-oriented design, , working on roulette. i have class, bin, constructs treeset contains outcome-objects. constructed in outcome class. now, working on wheel class, , here using new vector(38) i'm filling 38 new bin() s. now, issue. i want create method retrieves bin-object vector. bin get(int bin){ return bins.elementat(bin); } this doesn't work , eclipse suggesting 2 fixes: 1: add cast 2: change bin object what going on here? why can't return bin way want to? when cast or change object, doesn't work. this outcome class this bin class this wheel class package roulette; import java.util.random; import java.util.vector; public class wheel { vector bins; random rng; wheel(random rng){ rng = new random(); bins = new vector(38); (int i=0; i<38; i++){ bins.add(i, new bin()); } } void addoutcome(int bin, outcome outcome){ th

ruby on rails - Managing static pages from admin interface -

i have few static pages( contacts , about us , etc) in rails app. admin interface realized separating routes( namespace :admin ... ). how can manage static(!) content in static pages admin interface? thanks i recommend using authorization solution ryan bates' cancan or elabs' pundit . there can define ability admin-users regarding restful actions in :admin namespace. then can use ruby's file class (docs 1.9.3 or 2.0 ) manipulate files (only when users admins) want to. but aware of caching mechanisms: if caching these files (e.g. on server nginx, unicorn or caching-solution e.g. varnish, squid), must purged out of cache can view changes.

c - How can I examine in gdb a variable that has the same name as its type -

i'm debugging existing c library gdb 7.4 i'm trying examine variable which, unfortunately, declared same name type: extern const enum rtx_class rtx_class[num_rtx_code]; now can't find way examine variable. p rtx_class returns attempt use type name expression , same p &rtx_class , p rtx_class[0] . however, info var rtx_class works , returns const rtx_class rtx_class[145] expected. any idea? try workaround. binary like: nm your-executable |grep rtx_class you should address (let's it's 0xabcdef, assuming global variable. in gdb like: print *(rtx_class*)(0xabcdef+sizeof(rtx_class)*n) this should print rtx_class[n]. or @ least in simple testcase.

rad - unable to get type of control for radcombobox in javascript -

i new radcontrols, want know how type of control of radcontrol using javascript, normal asp.net controls write var controltype=document.getelementbyid("hdncode").type; the above code give type of control "hidden" and textbox give "text". when try type of rad control gives undefined var controltype=document.getelementbyid("radcombobox1").type; the above code gives undefined. please suggest me how type in case of rad controls thanks you can't check type of control this, these complex objects (iscriptcontrols) , not simple html elements. you can try following approach see instances of given type (the if block shows how can make check only): function get_allradcombos() { var allradcombos = []; var allradcontrols = $telerik.radcontrols; // radcontrols referenced (var = 0; < allradcontrols.length; i++) { var element = allradcon

How do I implement proper Exception handling in Java? -

i writing simple program in java in response question. question says : you fixing bug documents (represented string) failing converted proper xml. problem can occur because either: a. characters fail in xml, or b. documents passed in have length > 100 characters (they’re small documents) it lists 5 characters need escaping (e.g. replace '">'" escape sequence;). i've coded part replace special characters escapes, i'm not sure length. if (length of string > 100) { what? } i thinking of maybe implementing try catch statement, that's used runtime exceptions correct? (null pointer, etc). in design standpoint, best way avoid bug while @ same time completing job of function? you not handling exception here, rather should throw one: private static final int max_length = 100; // ... if (inputstring.length() > max_length) { throw new illegalargumentexception( string.format("string large. found %d chara

javascript - Variable Returning NaN Value - Cannot find out why -

i having pickup in business left off many years ago aging texting system. it built using asp classic , sends string api texts out, neither here nor there. problem have no js experience, am sql developer , did little bit of asp classic (vbscript) years ago. this piece of jscript picks information several form boxes , places them in string passed variable on processing page text out. fields 'qvalue, indemnity , excess' numeric. cover text , replacing cover text 'nan' understand 'not number' is, not number want text string. here snippet of code in question: <script type="text/javascript"> function changemessagetext() { var messagetxt = document.getelementbyid('message').value var qvalue = document.getelementbyid('qvalue').value var cover = document.getelementbyid('cover').value var excess = document.getelementbyid('excess').value var indem = document.getelementbyid('indemnity').value var message

php - Inner join 2 tables with same column names -

i'm working on displaying achievements minecraft server on website. can't work. function achievements() { global $id; $sql="select * achievements inner join stats on achievements.type=stats.type inner join stats on achievements.block=stats.block inner join stats on achievements.data=stats.data inner join stats on achievements.value=stats.value player_id = $id"; $result=mysql_query($sql) or die(mysql_error()); $rows=mysql_fetch_array($result); } will able use $rows['achievements.type']; , $rows['stats.type']; column "type" selected table, or there way it? the column , table names defined plugin use, names can't changed. the reason why not working because ( in own opinion ) server little confused on how handle columns names properly. in order work, add alias on every table has same name want join columns, eg select achievements.*, a.nam

c# - How to check if column can be converted to double? (DataTable.Column.DataType) -

i need simple condition replace (incomplete) if condition. // dont want write possible data types if (col.datatype == typeof(int) || col.datatype == typeof(int64) ... types) { // want on numeric columns // (convert numbers double datatype) } else { // string , other non-numbers remain unchanged } i trying this: col.datatype.isnumeric() but there no such method in class. i cant use tryparse() method on data because there data. condition must determined datatable column datatype property. is there simple method simplify if ? you use datatype did, or make function (see determine if datacolumn numeric ): public static bool isnumeric(this datacolumn col) { if (col == null) return false; // numeric types var numerictypes = new [] { typeof(byte), typeof(decimal), typeof(double), typeof(int16), typeof(int32), typeof(int64), typeof(sbyte), typeof(single), typeof(uint16), typeof(uint32), typeof(uint64)}; return numerictype

java - Android UIAutomator: setAsHorizontalList() throws noSuchMethodError -

i'm running android version 4.1.2 on samsung galaxy sii. i've started working uiautomator test user interface. problem everytime try run test on phone nosuchmethoderror on method setashorizontallist() used on uiscrollable object. eclipse recognize method , doesn't give compile error. private void turnoffnetwork() throws uiobjectnotfoundexception { getuidevice().presshome(); uiobject allappsbutton = new uiobject(new uiselector().description("apps")); allappsbutton.clickandwaitfornewwindow(); uiobject appstab = new uiobject(new uiselector().text("apps")); appstab.click(); uiscrollable appviews = new uiscrollable(new uiselector().scrollable(true)); appviews.setashorizontallist(); uiobject settingsapp = appviews.getchildbytext(new uiselector().classname(android.widget.textview.class.getname()), "instellingen"); settingsapp.clickandwaitfornewwindow(); uiobj

redis - Hiredis waiting for message -

i using hiredis c library connect redis server. not able figure out how wait new messages after subscribing new message. my code like: signal(sigpipe, sig_ign ); struct event_base *base = event_base_new(); redisasynccontext *c = redisasyncconnect("127.0.0.1", 6379); if (c->err) { /* let *c leak now... */ printf("error: %s\n", c->errstr); return 1; } redislibeventattach(c, base); redisasyncsetconnectcallback(c, connectcallback); redisasyncsetdisconnectcallback(c, disconnectcallback); redisasynccommand(c, null, null, "set key %b", argv[argc - 1], strlen(argv[argc - 1])); redisasynccommand(c, getcallback, (char*) "end-1", "get key"); redisasynccommand(c, getcallback, (char*) "end-1", "subscribe foo"); now how tell hiredis wait message on channel ? you not have tell hiredis need wait on channel: event loop wait on redis connection has been reg

java - Get parameters returned from web-site using servlet -

hi, 1. send such form testing sandbox paypal server <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>start page</title> </head> <body> <form method=post action=https://api-3t.sandbox.paypal.com/nvp> <input type=hidden name=user value=my_sandbox_account> <input type=hidden name=pwd value=my_pass> <input type=hidden name=signature value=my_sign_key> <input type=hidden name=version value=72.0> <input type=hidden name=paymentrequest_0_paymentaction value=sale> <input name=paymentrequest_0_amt value=6.00> <input type=hidden name=returnurl value=http://www.my_return_url.com> <input type=hidden name=cancelurl

sublimetext2 - start opened file from sublimetext in associated program -

i edit files in sublime text 2 can edited , compiled program. have them opened in sublimetext following: right click , choose "copy file path" (to clipboard) win+r open windows run dialog ctrl+v paste file path hit enter open file associated program i wonder shortcut can configured automatically starts opened file associate program thanks in advance this can done. in similar situation using sublime editor of choice on default sas program editor. able use win32com.client.dynamic.dispatch module connect sas via ole , pass text sublime directly sas using sublime's build system call plugin. making connection easy part, other processing had time consuming part, since want pass file name or entire contents of file, should straightforward plugin. since not know program wish open, here code makes implementation work. maybe caan glean out of this. def send_to_sas_via_ole(selected_code): win32com.client.dynamic import dispatch sasinstance =

Django: hiding the primary key (pk) and using DetailView with get_queryset -

following on thread: django: how hash url database object's primary key? , hide primary keys users , use detailview in urlconf. able accomplish hiding using bitwise xor part (it worked in view functions), until got part had "unmask" masked primary key sent in url subclass of detailview . how "unmask" pk_masked named group before sending detailviewfilteredonuser(detailview) instance? there way send mask_toggle(pk_unmasked) call detailviewfilteredonuser right in urlconf? in searching solutions, found pk_url_kward in django documentation, couldn't work , anyways don't think can me perform operations on primary key detailview operates on. here masking function: def mask_toggle(number_to_mask_or_unmask): return int(number_to_mask_or_unmask) ^ settings.masking_key my models "pkgs" contain "items": class pkg(models.model): user = models.foreignkey(user, editable=false) tracking_number = models.charfield(max_leng

javascript - Can I create overlapping bar charts using Google Chart Tools? -

Image
i'm using google chart tools create charts of data. i'm pretty confined examples can find in charts gallery , , can't find example of overlapping bar chart (mspaint): is possible create chart google chart tools? this called "stacked bar chart" in google chart tools. create 1 make barchart multiple values per row , set isstacked option true . example result:

ruby - Rails scaffold strange undefined_method error for specific table -

i'm working on admin tool existing database , encountered strange problem when scaffolding particular table. here schema of table using rake db:schema:dump : create_table "locality", :force => true |t| t.integer "version", :limit => 8, :null => false t.string "truth_id", :null => false t.string "truth_record_id", :null => false t.binary "deleted", :limit => 1, :null => false t.string "internal_code", :null => false t.string "iso_code" t.string "materialized_path", :null => false t.string "invariant_name", :null => false t.binary "published", :limit => 1,

java - Connect to android device via WIFI -

i'm trying connect pc android phone via wifi.. but problem anytime disconnect phone wifi , turn on again i'm getting different ip address pc doesn't connect until change ip address connect to.. there way correct ip address of phone? that might router settings issue. have ever heard of "dhcp reservation"? routers support such option, enables router memorize ip every distinct client ever connected , assign ip respective client every time reconnects. check router settings / documentation option. here link, further investigation: http://lifehacker.com/5822605/how-to-set-up-dhcp-reservations-so-you-never-have-to-check-an-ip-address-again

Certification process : Windows Phone -Location Service API -

i upload windows phone application market place ; , certification process failed ; error is "comments: application not include privacy policy explaining how application uses location service api. application not appear use location service api." but application don't depend on location service api ! never ! any 1 have idea ? i see couple of reasons type of message: your app references 1 of location api namespaces a reference used app app references 1 of location api namespaces (normally happens ads frameworks) your wmappmanifest.xml contains id_cap_location capability, giving app location capabilities.

windows - Detecting USB insertion/Removal in C++ non-GUI application -

i want detect insertion/removal of specific (custom) usb device through c++ application runs in background , has no gui. i have seen lot of questions , solutions registerdevicenotification sample code on msdn but these application has window/form/gui. application doesn't have any. how can use in application? my last option create invisible window... there other way out?? create message-only window . despite name, it's message queue.

Logging things that happend in android by specific package name -

i'm after solution heavy logging mecanism, log out happens when instance anr occurs @ specific packagename. want achieve, log information logcat outputs when phone connected computer. is possible when phone disconnected , in use "regular" user? i've found great post , outputs som relevent logcat stuff text file on sdcard. i've used command: logcat -b main -d -v time string parameter sorting logging. i found possbile solution expanding command sort after level( debug , verbose , error etc). so command this: adb -d logcat com.my.package:e *:s i found command @ post , wouldnt't log out file. so questions is: how can i, based on information above, log out logcat information, level error , .txt file on phones sdcard, without having phone connected computer , eclipse. possible @ all? many thanks! after long trial , error found solution, hope helps others. write application specific log text file in sd card use command. "lo

xml:space in resource file of c# winform -

i have windows form application in have resource file(.resx) here write error messages below <data name="link_name" xml:space="preserve"> <value>the link name must not blank , not greater 255 symbols.</value> </data> here understood name name of resource needs accessed , value value of resource did not xml:space="preserve" ? have 1 more option there default xml:space="preserve" makes whitespaces @ begin of tag not removed. (and if place more 1 whitespace together) example: <data name="link_name" xml:space="preserve"> <value> link name must not blank , not greater 255 symbols.</value> </data> now value be: " link name must not blank , not greater 255 symbols." if xml:space not set: <data name="link_name"> <value> link name must not blank , not greater 255 symbols.</value> </data>

how to sort array date wise in cakephp -

i have 2 table booking , message , want show booking request , message in inbox @ time. $this->paginate = array( 'conditions' => $conditions,'limit' =>10, 'order'=>array('booking.created'=>'desc')); $bookings = $this->paginate('booking'); $this->paginate = array( 'conditions' => $conditions,'limit' =>10, 'order'=>array('messagedetail.created'=>'desc')); $messages = $this->paginate('messagedetail'); i have merge both table data ( array_merge($bookings, $messages); ) want sort date wise (or conditions) array ( [0] => array ( [booking] => array ( [id] => 4 [host_id] => 21 [place_id] => 10 [room_id] => 13 [user_id] => 12 [message_detail_id] => 16

C++ the meaning of getting size of a array -

here macro getting array size #define array_size(array) \ (sizeof( array ) / (sizeof( array[0] ) * (sizeof( array ) != sizeof(void*) || sizeof( array[0] ) <= sizeof(void*))) i think (sizeof( array ) / (sizeof( array[0] )) enough size of array. i guess part (sizeof( array[0] ) * (sizeof( array ) != sizeof(void*) || sizeof( array[0] ) <= sizeof(void*)) is avoid whole thing divided zero, explain? thanks in advance. cheers, multiplying sizeof array[0] in divisor by (sizeof( array ) != sizeof(void*) || sizeof( array[0] ) <= sizeof(void*)) makes divisor 0 if sizeof array == sizeof(void*) and sizeof array[0] > sizeof(void*) in cases, division 0 during compilation, cause compilation fail. these checks attempt detect arguments pointers (be result of array-to-pointer conversion or not), since 1 can't know how large "array" pointer points using quotient. it fails if other pointer types have different sizes void* , , doesn'

php - Code failing to pass query criteria to URL -

my problem since added switch function code quering cat_id code can no longer pass query criteria url paginating. cat_id categoryid saved foreign key in child table. here code if can help: $criteria = array('ctitle', 'csubject', 'creference', 'cat_id', 'cmaterial', 'ctechnic', 'cartist', 'csource', 'cposture', 'stolen'); $likes = ""; $url_criteria = ''; foreach ( $criteria $criterion ) { if ( ! empty($_post[$criterion]) ) { $value = ($_post[$criterion]); $likes .= " , `$criterion` '%$value%'"; switch ($criterion) { case 'cat_id': $likes .= " , `$criterion`='$value'"; break; default: $likes .= " , `$criterion` '%$value%'"; break;

Approach to refactor multi-portal solution asp.net mvc -

Image
i refactoring massive monolithic asp.net mvc solution (which runs website/portal) , extracting class libraries common business logic (that can used create similar portals) core business logic (that can used domain logic) common repository logic core repository logic portal specific business logic (if common business logic doesnt it) portal specific repository logic (if common repository logic doesnt it) the problem approach see @ time of introducing similar portals have create specific business logic layers , repository logic layers if need arises , increase number of projects in solution (with fear of going unmanageable) how achieve multi-portal solution in terms of manageable projects? i’ve been in similar situation having bunch of mvc sites sharing lot of common functionalities. what we’ve done first isolate common things in separate solution (we’ve called "global"). solution structured same way mvc sites , contains "global" specific

apache poi - How to do cell iteration of excel in java -

i having excel 2 rows , 5 columns. entered code manually take values 1st row. how can iterate process? below code 1st row in excel. 2nd row on, dont know how do... want iterate 1 row after another. workbook workbook = workbook.getworkbook(new file( "\\c:\\users\\a-4935\\desktop\\datapool_ca.xls")); sheet sheet = workbook.getsheet("sheet1"); system.out.println("reached sheet"); cell = sheet.getcell(2,1); cell b = sheet.getcell(3,1); cell c = sheet.getcell(4,1); cell d = sheet.getcell(5,1); cell e = sheet.getcell(6,1); cell f = sheet.getcell(7,1); cell g = sheet.getcell(8,1); cell h = sheet.getcell(9,1); cell = sheet.getcell(10,1); string uid = a.getcontents(); string deptfromdat = b.getcontents(); string depttodate = c.getcontents(); string dept1 = d.getcontents(); string arrival1 = e.getcontents(); string eihon1 = f.getcontents(); string branchcode1

c++ - Particular form of bind temporary to const reference has no effect -

given struct { void a(void) { std::cout << "a" << std::endl; } }; const &a = a(); /* make copy of , bind */ const &b(a()); /* nothing */ a.a(); /* prints */ b.a(); /* error, same if b doesn't exist */ why second form of "bind temporary const reference" seem equivalent no-op? this case of most vexing parse , you're declaring function rather const reference a . you fix using c++11 uniform initialization: const &b{a()};

css - CSS3 Transition (cubic-bezier) is not working in Firefox -

transition: 0.3s cubic-bezier(0.42, 0, 0.58, 1) 0; it supported according w3schools. works fine in chrome, ie , opera. http://jsfiddle.net/fseqt/1/ oddly not including unit of seconds in transition-delay property causes transition not work. change transition rule to: transition: 0.3s cubic-bezier(0.42, 0, 0.58, 1) 0s; http://jsfiddle.net/fseqt/7/

sql - How to retrieve generated primary key when row was inserted with QSqlTableModel::insertRecord -

this question pertains qt 4.7.3 on windows postgres. i'm trying insert row pretty large table via qsqltablemodel , because (hopefully) saves me trouble of typing out field names, using qsqltablemodel::settable . ask model record object qsqlrecord row(qsqltablemodel::record); , , fill data via qsqlrecord::setvalue . here's code persist row: const bool insertok = tablemodel.insertrecord(-1, row); if (!insertok || !tablemodel.submitall()) { return -1; } qsqlerror err = tablemodel.lasterror(); if (err.type() != qsqlerror::noerror) { std::cerr << "errormsg " << std::endl; return -1; } const int primarykey = tablemodel.query().lastinsertid().toint(); the above tried, content of tablemodel.query() giant select, no returning keyword. lastinsertid() returns invalid qvariant . possible have qt provide generated primary key without making additional - fugly - roundtrip database. i'd rather not lock table ensure last 1 created, if can avoid

javascript - JavaFX WebView disable Same origin policy (allow cross domain requests) -

i'm developing javafx application glorified web page. it's desktop application (it's no embedded web page) , has web view main ui. application serves sole purpose of accessing bluetooth devices using bluecove because that's not possible directly javascript on web browser. the proof of concept works ok (i able call javascript code java , vice-versa) have 1 requirement of calling arbitrary web services/api within javascript violates same origin policy (similar on android: allow remote ajax calls in android webview + jquery mobile ). possible on javafx? tips? p.s.: i'm using javafx 2.2. basically, javafx has issue coupled cors - https://javafx-jira.kenai.com/browse/rt-35868 . assuming web services using, have cors enabled can try following approach: system.setproperty("sun.net.http.allowrestrictedheaders", "true") or java -dsun.net.http.allowrestrictedheaders=true <your main class here> hope you

php - Zend Framework 2 with Doctrine 2 custom validation and object structure -

what proper class , object structure supports custom validations in zf2 , doctrine2 ? for example, have simple user entity, , wish check if email provided unique. validation requires access entitymanager can't done entity in getinputfilter method. what proper application structure support that? in current workflow user's name validated in controller, seems kind of wrong. relevant objects , scripts view: edituser.phtml controller: usercontroller.php - gets user post input , serves - creates validator, , checks if ($validator->isvalid()) entity: user.php - performs other basic property validation, cannot perform isunique if need create custom validation class, object instantiate , use it? absolutely need have separate user business model apart entity, have healthy oop structure ?

mysql - Get unique image for every user when call default image from query -

sorry, long title. have list registered users, profile pic, without. problem if user 1 logged in. in user list, has same profile image user 1. but if remove default caller query, every user gets own picture, default.jpg image doesn't work. remove query , use if statement on page, want avoid that. function fetch_users($uid){ $query = $this->link->query( "select user.id, user.username, user.email, userdetails.profile_img,userdetails.firstname, userdetails.lastname,userdetails.location,following.follow_id user left join userdetails on user.id = userdetails.user_id left join following on user.id = following.follow_id user.id != '{$uid}' "); $users = array(); while(($row = $query->fetch(pdo::fetch_assoc)) !== false) { #the row mess things#----->$row['profile_img'] = file_exists("img/{$uid}.jpg") ?

javascript - tab key is not working as expected when using jquery change event -

i had weird result jquery events, though not convinced whether jquery issue. hope jquery geeks can answer this. i had following code snippet in html page, change focus second input box once user enter string of length 9 in first input box. auto-focusing working smoothly. when press tab first input box, skipping second input box , goes next html element second input box. $("input.first").change(function (e){ var text = $(this).val(); if (text.length == 9){ $("input[id='second']").focus(); } }); i tried putting tabindex property html elements still continued misbehavior. @ end when changed change event keypress event tab key started flow expected. is there explain why happens? answers. you can add tab index controls manually. hope work. $(function() { var tabindex = 1; $('input').each(function() { if (this.type != "hidden") { var $input = $(this); $input.attr("tabi

c# - referring functions of 1st cs page in 2nd cs page -

can define function in 1 cs page , refer function in cs page functions designed in 2nd cs page executed 1st cs page function? such like..in 1st cs page iwebdriver driver; driver=new firefoxdriver(); in 2nd cs page, have many functions included based on above function, how can refer function in 2nd cs page code simplicity exists? this badly worded question can assume trying achieve have ability call functions 1 test in test, or rather 1 class class . this basic c#. your code should split out in way means achievable. means tests totally seperate actual logic. using page objects 1 way go: http://code.google.com/p/selenium/wiki/pageobjects this mean have page like: public class loginpage { public homepage login(string username, string password) { // login stuff // return home page } } public class homepage { // logic related user can see on home page. } you'd call in test like: var loginpage = new loginpage(); homepa

arrays - Dequeueing an class and individual values c# -

this follow yesterday's question have 2 queue, contain 5 elements each called player 1 , player 2. queued using following player2.enqueue(chuckcards[i]); chuck cards class has several different data members including 6 ints , 1 string. wish dequeue 1 item give values labels (multipul 1 per data member) , string picture box (i don't need that). know how values dequeue. able re queue on other players queue. might use peak operation values if outcome successful move off end of queue 1 , onto queue 2. hope that's clear. any appreciated. have searched around found no real answer yet. queue<foo> firstqueue = new queue<foo>(); queue<foo> secondqueue = new queue<foo>(); //todo populate var item = firstqueue.dequeue(); item.dostuff(); secondqueue.enqueue(item);

Mongodb update. setOnInsert Mod on _id not allowed -

i understand fact can't update _id on existing mongodb document. but there reason can't use in upsert in 'setoninsert' part ? because 'on insert' it's not update. my expected usage this: db.mycol.update({_id:12345},{$setoninsert:{_id:12345},$set:{myvalue:'hi'}}); is bug or missing ? mongodb uses 'query' part upsert query part of set, meaning don't have specify _id in set part of want specify own _id. note: query above had small bug missing upsert flag. this correct query: db.mycol.update({_id:12345},{$set:{myvalue:'hi'}},{upsert:true}); if record doesn't exist, query insert record looks this: {_id:12345,myvalue:'hi'}