Posts

Showing posts from April, 2011

sql - ORACLE 11g SET COLUMN NULL for specific Partition of large table -

i have composite-list-list partitioned table 19 columns , 400 million rows. once week new data inserted in table , before insert need set values of 2 columns null specific partitions. obvious approach following column_1 partition criteria: update blabla_table set column_18 = null, set column_19 = null column_1 in (value1, value2…) of course awfully slow. my second thought use ctas every partition need set 2 columns null , use exchange partition update data in big table. unfortunately wouldn’t work because it´s composite-partition. i use same approach subpartitions have use cats 8000 times , drop tables afterwards every week. guess not pass upcoming code-review. may has idea how performantly solve this? ps: i’m using oracle 11g database. pps: sorry bad english….. you've ruled out updating through ddl (switch partitions), lets dml consider. i don't think it's bad update table heavily partitioned. can split update in 8k mini updates (each single

java - ClassNotFoundException happens during calling ObjectInputStream.readobject in Android -

i want read object android internal storage. the following code. write static function reading object file in same class. no idea why exception happen . appreciate if give suggestions. thanks. package com.crescent.programmercalculator; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.objectinputstream; import java.io.objectoutputstream; import java.io.serializable; import android.util.log; import android.content.context; public class calculateconfigurations implements serializable{ static string configlocation="configfile"; public short radix; calculateconfigurations(){ radix=16; } public static calculateconfigurations loadobjectfromfile(context context){ try { fileinputstream fis = context.openfileinput(configlocation); objectinputstream = new objectinputstream(fis); calculateconfigurations

html - Delete last row of table in nested div -

i want delete last row. i have dive within div , has table , many rows. i wanted delete last row of table. unable iterate last tr. <div class="span15" id="murworksheetpage2"> <div class="span8"> <table> <tr> <td class="col1"> @html.displaynamefor(model => model.medicineuseno) @html.textboxfor(model => model.medicineuseno, new { id = "txtmedicineuseno", style = "width:20px" }) </td> <td class="col2">@html.displaynamefor(model => model.medicineprescribed) @html.textboxfor(model => model.medicineprescribed, new { id = "txtmedicineprescribed" })</td> </tr> <tr> <td class="

invoke a java method with int arguments from javascript/rhino -

how can invoke overloaded java method integer , float javascript/rhino? for example, how can invoke javascript/rhino java java.awt.color(int,int,int) constructor? have dealt next snipets not work: var integer = java.lang.integer; var color = new java.awt.color(12,58,92); // invokes java.awt.color(float,float,float) , throws wrapped java.lang.illegalargumentexception: color parameter outside of expected range: red green blue. var color = new java.awt.color(new integer(12), new integer(58), new integer(92) // invokes java.awt.color(float,float,float) , throws exception var color = new color(integer.valueof(12),integer.valueof(200),integer.valueof(80)); // invokes java.awt.color(float,float,float) , throws exception the mechanism documented here. can access constructor following syntax: js> new java.awt.color['(int,int,int)'](1,2,3); // no spaces allowed! java.awt.color[r=1,g=2,b=3] or js> java.awt.color['(java.awt.color.colorspace,float[],float)

sql - Importing query results from another database -

so have 2 access databases, let's call them mydatabase , anotherdatabase. in anotherdatabase there crosstab query. want results query produces mydatabase without making modifications anotherdatabase or query itself. want mydatabase enitrely self-sufficient in sense databases interacts not have modified. could give me advice on how approach this? use linked table manager link tables in anotherdatabase mydatabase . can have query anotherdatabase in mydatabase , use that. in external data tab (in mydatabase ), click button says import access. except, instead of importing table, click radio button says "link data source creating linked table". follow wizard , should set. you need link tables require query. option write vba code in mydatabase instantiates connection anotherdatabase , queries it, think linking tables better solution less hassle

c# - T4 Code Generator How To Use Web References -

i creating code generator go through each web methods of api (asmx web service) cannot figure out how reference web reference in .tt file <#@ assembly name="myapi" #> will not work compiling transformation: metadata file 'myapi' not found currently work around create .dll wsdl , can reference in .tt no problem: <#@ assembly name="c:\myapi.dll" #> is there way reference web references directly t4 without having make .dll s out of them? you can't directly(easily anyhow) reference current project's files in t4 generator. have use system.reflection , or envdte unless want access file directly not reference text file... can have system.io read file via relative path.

javascript - Perform a clean submit by removing hidden divs -

i trying perform 'clean' submit, i.e. submit invoked after removing hidden divs form field. since feature going use more often, shifted code extend-part: $.fn.extend({ bindcleansubmit: function() { $(this).submit( function(event) { event.preventdefault(); $(this).find("div:hidden").remove(); console.log("trying commit..."); return true; }); } }); now, divs removed, console event triggered @ end submit has not performed. do problem here? i'm not sure trying preventdefault() , if remove bindcleansubmit() , hidden divs removed form , submitted normally. given following html: <form id="myform" method="post" action="/"> <input type="text" name="displayedinput" value="1"/> <div style="display: none"> <input type="text" name="hiddeninput" value="1"/> </d

C# Can I make a namespace accessible everywhere in my dot net web site for code-behind and classes -

i have extension method string want available on every code behind , class in solution. method sitting in particular namespace. i'd everywhere have access namespace without me having include in every class. i've used "namespaces" tag in web config include on every aspx page, not make accessible on code behind or elsewhere. so, there similar way include namespace everywhere? so, there similar way include namespace everywhere? no, afraid there isn't. if place extension method in of root namespaces in scope child namespaces. example: namespace foo { public static class extensions { public static void go(this string value) { ... } } } will in scope inside classes declared in foo.* namespaces. might put extension method in root namespace has same name project , available everywhere because classes automatically generated in child namespaces (unless change that).

audio - How to avoid echo and noise in javascript for webrtc -

i trying implement webrtc-based chat room. , encountered following problems in laptop. without connecting other peer, use getusermedia(), can local video stream. when unmuted , echo happened. then wear headphone, , found there continue noise. , can hear voice clearly. i tried turn down volumn, doesn't work. thanks in advance. make sure muting local <video> element if have in dom: <video id="vid1" autoplay="true" muted="muted"></video> see this post on discuss-webrtc mailing list more details , webrtc samples .

c - Preprocessor error when defining = -

i trying awkward preprocessing , came this: #include <stdio.h> #define 6 =6 int main(void) { int x=6; int y=2; if(x=six) printf("x == 6\n"); if(y=six) printf("y==6\n"); return 0; } gcc gives me errors: test.c: in function ‘main’: test.c:10:8: error: expected expression before ‘=’ token test.c:12:8: error: expected expression before ‘=’ token why that? the == single token, cannot split in half. should run gcc -e on code from gcc manual pages: -e stop after preprocessing stage; not run compiler proper. output in form of preprocessed source code, sent standard output. input files don't require preprocessing ignored. for code gcc -e gives following output if(x= =6) printf("x == 6\n"); if(y= =6) printf("y==6\n"); the second = causes error message expected expression before ‘=’ token

android - Action Bar not showing in 4.2.2 -

Image
solution: problem image search icon. android did not find image search action , had not added them in res-folders , started show after that... i trying add action bar app , following basic app tutorial shown in google developer website i have written following code. mainactivity public class mainactivity extends actionbaractivity { public void opensearch(){ system.out.println("test search"); } public void opensettings(){ system.out.println("test settings"); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.main_activity_actions, menu); return super.oncreateoptionsmenu(menu);

jquery - Detecting node is a folder with dynatree -

how detect if clicked node folder ? i wish find out if clicked node folder modify right-click behaviour (if not folder => something). once have node, can test node.data.isfolder . in dynatree event handler straightforward: for example onclick: function(node, event) { if(node.geteventtargettype(event) === "title" && node.data.isfolder){ [...] // handle click event return false;// prevent default processing } } from inside custom handler might first have find node target element: var node = $.ui.dynatree.getnode(el)

ios - Is it possible to build from one Mac and launch the Simulator on another? -

i've got 2 macs , when doing ipad dev, interests me if it's possible have mac launch simulator , load app after build completed. would nice have ipad app running in simulator on 1 mac's screen , xcode , editing being done in another. i don't expect remotely possible, or worthwhile, understanding why or wouldn't possible worthwhile. indeed possible! you can transfer app ~/library/application support/iphone simulator/6.1/applications directory, reload simulator, , magically appear installed! or believe, can run app using tool ios-sim without copying simulator folder.

c# - Item is being selected in ListView on page load -

i have listview in xaml, , it's itemssource , selecteditem property binded viewmodel. xaml <listview itemssource="{binding sitescollection}" selecteditem="{binding selectedsite, mode=twoway}"> <listview.itemtemplate> <datatemplate> <textblock text="{binding url}"></textblock> </datatemplate> </listview.itemtemplate> </listview> viewmodel public observablecollection<awrestrictedsite> _sitescollection; public observablecollection<awrestrictedsite> sitescollection { { //populate collection return _sitescollection; } } public awrestrictedsite _selectedsite; public awrestrictedsite selectedsite { { return _selectedsite; } set { _selectedsite = value; //do stuff } } for reason when page loads, selects first item in listview. here happens when pa

html - .net: Application loses style in IE8 on server -

Image
i'm getting weird behavior .net application. when run within visual studio on ie8, looks fine: but when deploy application server , access via url, seems lose margin: it's same application, running in same version of same browser, why difference occurring? here css (the logo in class "logo"): body { font-family: helvetica, sans-serif; background-color: #aaa; margin: 0px; line-height: 1.5rem; } header, footer, nav, section { display: block; } /* styles basic forms -----------------------------------------------------------*/ fieldset { border: 1px solid #ddd; padding: 0 1.4em 1.4em 1.4em; margin: 0 0 1.5em 0; } legend { font-size: 1.2em; font-weight: bold; } textarea { min-height: 75px; } .editor-label { margin: 1em 0 0 0; } .editor-field { margin: 0.5em 0 0 0; } /* styles validation helpers -----------------------------------------------------------*/ .field-validation-error { color: #f00

c++ - BitBlt issues with Memory DC created from printer DC -

i have issue fix made allow flood filled object printed... so, full story using windows gdi floodfill function, noticed doesnt work on printers, found on inet, create memory dc, compatible printer dc, , make drawing operations on memory dc, , bitblt @ once printer dc (i had change use recursive, color replacment flood fill function too, since memory dc allows main dc did) the problem memory dc seems pixel or 2 bigger on x , y, dont know do, when selected bitmap memory dc, shows correct size, use stretchblt, values have access use params stretchblt, make no different calling bitblt let me know if need more info... thanks in advance!!! heres code: hdc hmemprndc = createcompatibledc (hprndc); hbitmap hbitmap = createcompatiblebitmap (hprndc, iwidthlp, iheightlp); hbitmap holdbitmap = selectbitmap (hmemprndc, hbitmap); // paint whole memory dc window color hbrush hbrush = createsolidbrush (getsyscolor (color_window)); rect rect; // add 1 right , bottom, fillrect do

c# - Using LINQ to select with object -

i have radio bullet list , want set values , text of radio list using linq, return "0" when first value on database "1". at database have 2 columns, codcategoria , dsccategoria , want define value of radio_bullet_list codcategoria , display text dsccategoria testesiteentities db = new testesiteentities();//create object //select object rblcategoria.datavaluefield = db.categoria.select( c => c.codcategoria ).tostring(); rblcategoria.datatextfield = db.categoria.select(dc => dc.dsccategoria).tostring(); rblcategoria.databind();//define valores no bullet list what wrong? the datavaluefield , datatextfield both looking string representation of they're supposed use. set datasource sort of ienumerable has properties, assuming db.categoria has properties "codcategoria" , "dsccategoria" like: testesiteentities db = new testesiteentities();//create object //select object rblcategoria.datavaluefield = "codcategoria

c - How to use Goto function -

can use goto jump other functions? example void x(){ printf("hello"); } void y(){ printf("hi"); } int main(){ /*assume var declared */ scanf("%d",&input); if(input == 1) goto y(); else(input == 2) goto x(); } do not use goto, ever. ugly, old , obfuscates things unnecessarily. int main() { /*assume var declared */ scanf("%d",&input); if(input == 1) { y(); } else if (input == 2) { x(); } }

multithreading - multiple threads calling same method in c# -

Image
i have following c# code snippet in have simulated problem.in program have service function call readrooms method. calling service method on different threads.i expecting both servicecall , readrooms method fired equally getting below result not correct. using system; using system.collections.generic; using system.linq; using system.text; using system.threading; using system.threading.tasks; namespace consoleapplication1 { class program { public static void readrooms(int i) { console.writeline("reading room::" + i); thread.sleep(2000); } public static void callservice(int i) { console.writeline("servicecall::" + i); readrooms(i); } static void main(string[] args) { thread[] ts = new thread[4]; (int = 0; < 4; i++) { ts[i] = new thread(() => {

postgresql - Sqlalchemy does not work with pagination -

i totally new flask , sqlalchemy. try make 1 web site better understanding of flask. there plenty of tutorials , use sqlite. purpose use postgres. , need 1 page can use pagination. time getting error attributeerror: 'query' object has no attribute 'paginate' my database uri = os.environ.get('database_url', 'postgres://login:password@127.0.0.1/db_name') engine = create_engine(uri, convert_unicode=true) db_session = scoped_session(sessionmaker(autocommit=false, autoflush=false, bind=engine)) base = declarative_base() base.query = db_session.query_property() simple model class user(base): __tablename__ = 'user' id = column(integer, primary_key=true, autoincrement=true) name = column(unicode(100), nullable=false) ... then use paginate users = user.query.paginate(1, 5, false) the same error get_or_404() , first_or_404(). normal or first works usual. i appreciate advi

ruby - conver string number to float -

i have string: "3,8" i float this: 3.8 you can using string#tr method: "3,8".tr(',', '.').to_f # => 3.8

Don't include blank fields in GET request emitted by Django form -

on django-powered site, have search page several optional fields. search page django form, , view function typical: def search(request): form = searchform(request.get or none) if form.is_valid(): return form.display_results(request) return render(request, 'search.html', {'form': form}) form.display_results() uses fields provided query db , render response. search.html includes: <form action="/search/" method="get">{% csrf_token %} <!-- render form fields --> <input type="submit" value="search" /> <input type="reset" value="reset form" /> </form> since searches have several blank fields, i'd not include them in request emitted submit button on search.html. current searches like: http://mysite/search/?csrfmiddlewaretoken=blah&optional_field1=&optional_field2=&optional_field3=oohiwantthisone and i'd them like: htt

php - Regex to replace spaces and brackets with underscore -

i have strings in following formats: this string string (string) string and want regex convert following: this_is_a_string with no leading i have following using preg_replace getting me of way: preg_replace('/[^a-za-z]+/', '_', $string) however, converts last ) underscore not acceptable uses. trim off in separate function im wondering if possible single regex? $result = preg_replace('~[^a-z]+([a-z]+)(?:[^a-z]+$)?~i', '_$1', $string);

javascript - Using multiple buttons on same function that redirects to different functions -

so..i'm having problem couple of days not knowing how this,and need help. i have multiple buttons , clicking of them redirecting me same function , function going function specified button. idea how can go true couple of functions knowing button clicked? example : <html> <button type="button" onclick="myfunction()" id="1">button1</button> <button type="button" onclick="myfunction()" id="2">button1</button> <button type="button" onclick="myfunction()" id="3">button1</button> <script> function myfunction() { var x=0; if (button 1){ x=1; myfunction1(x);} if (button 2){ x=2; myfunction2(x);} if (button 3){ x=3; myfunction3(x);} ... myfunction3(x){ alert(x); } } </script> </html> easiest way pass in element function: <button type="button" oncl

php - Where does Ghostscript need to be installed if I want to use it with imagemagick in XAMPP -

so using local installed server xampp imagemagick convert pdf files images, need ghostscript .. installing ghostscript , need installed in xampp folder in order imagemagick communicate or can install clicking here http://sourceforge.net/projects/ghostscript/?source=dlp , install it because imagemagick , had install , placed folder in xampp directory , add php_imagick.dll file in php/ext folder , edit php.ini, worked.. should done ghostscript though ? download , work wherever it's placed ? yes, have same scenario in im using different tools beside ghostscript , imagemagick xampp, installing imagemagick add environment variables can call anywhere, ghostscript should download @ specific place, call inside project fixed path .

visual studio 2012 - System.IO.FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, ... when running unit tests -

i'm trying run unit tests perform execute sql commands directly oracle database , following exception when unit tests started: testmethod1 threw exception: system.io.filenotfoundexception: not load file or assembly 'oracle.dataaccess, version=4.112.3.0, culture=neutral, publickeytoken=89b483f429c47342' or 1 of dependencies. system cannot find file specified. i have oracle.dataaccess in project references (added through nuget) , have have oracle data provider installed. i have other projects using oracle.dataaccess run in machine without problems. seems microsoft.net unit test framework (mstest) not able load assembly. this log taken fusion log viewer: *** assembly binder log entry (23/08/2013 @ 04:50:07 p.m.) *** operation failed. bind result: hr = 0x80070002. system cannot find file specified. assembly manager loaded from: c:\windows\microsoft.net\framework\v4.0.30319\clr.dll running under executable c:\program files (x86)\microsoft visual studi

Access inline event object function body without 'function' constructor javascript -

i filtering bunch of objects using jquery, , want have access function body of event without function constructor attached it. i'll show mean: $('li').filter(function(){ return this.onmouseout !== null; }) .each(function(){ console.log(this.onmouseout); }); what get's returned is: function onmouseout(event) { goodsearchbadgehidemenu('120'); } what returned is: goodsearchbadgehidemenu('120'); \\notice absence of 'function onmouseout(event)' , closing bracket i'm sure use string.replace() parse this, want know if function body accessible somewhere in element's attributes or in event object. thanks because you're attaching handlers element attributes, can use .getattribute() retrieve body set. this.getattribute("onmouseout"); so... $('li').filter(function(){ return this.onmouseout !== null;

gd - PHP - incorrect colors when using imagecopy -

i have couple of png images generate so: $img = imagecreatefrompng($full_path_to_file); imagealphablending($img , true); // setting alpha blending on imagesavealpha($img , true); // save alphablending setting the images come out fine, right colors , transparent background. i need combine these images one. following: create blank image right dimensions $full_image = imagecreate($full_width, $full_height); copy png images 1 one onto blank image imagecopy($full_image, $src, $dest_x, $dest_y, 0, 0, $src_width, $src_height ) the images combined ok. background transparent, the colors not correct. how can make sure right colors? update: suggested, fix use imagecreatetruecolor also, need set second parameter imagealphablending false. when creating png images , creating full_image, call imagealphablending($img , false); // updated false imagesavealpha($img , true); documentation imagesavealpha says : you have unset alphablending (imagealphablending($im, fa

android - setVisibility(View.Gone) with SwipeyTabs -

i'm beginner android programmer, , i'm trying figure out how work swipeytabs. first of all, way find view: rb2 = (radiobutton) getview().findviewbyid(r.id.rb2); rb2.setonclicklistener(this); my second question how set visibility of textview or edittext swipeytabs. i've made simple application without swipeytabs, , there use code: tvplayer1.setvisibility(view.gone); once use same line of code within swipeytabs, crashes. can explain me why can't work? thank in advance! turned out had grammar mistake in line of code. etplayer1 = (textview) getview().findviewbyid(r.id.etplayer1); had be: etplayer1 = (edittext) getview().findviewbyid(r.id.etplayer1);

pointers - Deleting Strings on the Heap Created from Char[] one the Heap in C++ -

i have simple question cannot seem find answer relating c++ std::string , how instantiated new. now, aware pointer returned new should subsequently deleted prevent memory leak. question comes happens when existing pointer subsequently used instantiate new string object. please consider following simplified example: char* foo() { char* ptr; ptr = new char[arbitrary_value]; ... ptr = strncpy("some null terminated string", arbitrary_value) ... return ptr; } int main() { char* buf; std::string mystr; buf = foo(); mystr = new std::string(buf); ...do stuff delete mystr; delete buf; //is necessary? return 0; } my question simple: deleting mystr free underlying memory used buf or buf need freed manually well? if buf has freed manually, happens in case of anonymous parameters? in: mystr = new std::string(foo()); my suspicion underlying implementation of std::string maintains pointer character buffe

make android HomeAsUp icon bigger -

as title says, how make android homeasup icon < bigger? i.e. need change size. know can things actionbar.setdisplayhomeasupenabled(true); but how resize mark? i not sure answer jake on how customize button on actionbar question may help. can define customized drawable instead of default homeasup indicator like: <style name="theme.myfancytheme" parent="android:theme.holo"> <item name="android:homeasupindicator">@drawable/my_fancy_up_indicator</item> </style> you can try make drawable of bigger dimension. might work. haven't tried though.

ruby on rails - HABTM relationships with polymorphism -

i've got person can linked many structures (structure polymorphic) i've got venue, can have many people, structure. i've got journal, can have many people, structure. here modelization : class venue < activerecord::base has_many :structure_people, :as => :structure has_many :people, :through => :structure_people end class journal < activerecord::base has_many :structure_people, :as => :structure has_many :people, :through => :structure_people end class person < activerecord::base has_many :structure_people has_many :structures, :through => :structure_people end class structureperson < activerecord::base belongs_to :structure, polymorphic: true belongs_to :person end my problem : when try people on venue or on journal, works. cool :) but when try structures on person, i've got error : activerecord::hasmanythroughassociationpolymorphicsourceerror: cannot have has_many :through association 'person#s

sql - How to remove this auto dot by php? -

i'm facing piculiar problem on site's registration form script. on date of birth field (1987-1-1 ) automaticall adding dot(.) on sql on phpmyadmin (1987-.01-.01) [n.b- month & date field contains dot] my form action- $rform .= "<form action=\"regagree.php\" method=\"post\">"; i'm using code on form $rform .= "e-mail *<br/><input name=\"email\" maxlength=\"35\" size=\"10\"/><br/>"; $rform .= "birth date *<br/>"; $rform .= "<select name=\"day\" value=\"01\">"; $rform .= "<option value=\"01\">1</option>"; $rform .= "<option value=\"02\">2</option>"; $rform .= "<option value=\"03\">3</option>"; $rform .= "<option value=\"04\">4</option>"; $rform .= "<option value=\"05

mysql - Query multiple rows that leads to one row in other table -

i'm noob @ making mysql queries couldn't work done. hope guys know answer question. i want make options products. if have black t-shirt, tanktop model , diamonds on it. must have black t-shirt tanktop model , diamonds row. want make this: table: product_option -------------------------------- product_option_id name product_combination_id 1 black 1 2 diamond 1 3 tanktop 1 4 option 2 5 option 2 table: product_combination -------------------------------- product_combination_id name 1 black tanktop diamonds so question is. possible query product_options , product_combination row out of it? i hope guys know answer question! thank time :) edit: i think question general , want ask more specific. let's say. have shop clothes. have product (let's t-shirt). , there couple of options choose from. like this: colo

assembly - .align directive proper usage with .align(5) and 0x90 -

i attempting learn assembly programming.i came across code.the macro entry used in asm file.but cannot understand code means?. #define align(log) .align(log) ,0x90; what 0x90 mean? quite new assembly.and why align(5) used instead of typical align(4) or align(8) #if defined(__apple__) || defined(__freebsd__) || defined(__netbsd__) || defined(__openbsd__) # define align_log #endif #ifdef align_log # define align(log) .align (log), 0x90; #else # define align(log) .align 1 << (log), 0x90; #endif #define entry(name) \ align(5); \ .globl name; \ .globl _##name; \ name: ; \ _##name: ~ it's power-of-2 alignment, e.g., align(4) 16-byte alignment, align(5) 32-byte, etc. 0x90 specifies opcode nop instruction - used padding instructions achieve alignment. there longer instructions sequences effective nops . many of assemblers support more flexible .p2align directive; recent g

javascript - Dynamically creation select box options issue in IE8 -

i using following function create add options select box //add options requested select box addoptionstoselect : function(__enum , obj, selected_value) { $(__enum).each(function(i){ var optn = new option(this.text, this.val) if(selected_value === this.val){ optn.setattribute('selected', 'selected') } $(obj)[0].options.add(optn); }); return obj } __enum key value pair containing value , text pass select option obj select box obj created dynamically selected_value value needs set selected on select box. the problem here optn.setattribute('selected', 'selected') works fine in browsers expect ie8. i looking workaround allow me set selected value in browsers dynamically. i'd add option so: var select = document.getelementbyid("drop-down"); var newoption = document.createelement("option"); newoption.innerhtml = 'hello'; select.appendchild(newoption); her

html - background overlays text -

demo as can see in jsbin background overlays text in 3 link objects (move cursor above see it). i have tried around z-index (as suggested friend), doesn't seem have effect. how go fixing it? here's relevant css: a { color: #cccccc; } a:hover { background-color: #cccccc; } as can see, font color , background color same on hover. z-index has nothing it. change color on :hover , see text, demonstrated on fiddle: http://jsfiddle.net/yvdvx/

In Fiddler, how can I edit the session context menu? -

what wondering is, how can edit existent item in context menu opens when session has been selected right clicked? speaking, looking change text item "unlock editing" through fiddler2 script editor. seems quite simple, when looking through fiddlerapplication.ui , thing can find relating context menu strip fiddlerapplication.ui.contextmenustrip , don't see items within direct members. maybe looking on something, know can't find item text should "unlock editing". also, if know talking about, have yet 1 more question; how can make happen upon event of context menu being opened, , without overriding original code opening event method? thank help! update earlier post: have found direct member contextmenu looking for. contextmenu member session list inside of sessionlistview data member list of sessions, member named fiddlerapplication.ui.lvsessions . you didn't why hope this? changing existing menu items isn't supported action , wh

Bash getopts: reading $OPTARG for optional flags? -

i'd able accept both mandatory , optional flags in script. here's have far. #!bin/bash while getopts ":a:b:cdef" opt; case $opt in ) apple="$optarg";; b ) banana="$optarg";; c ) cherry="$optarg";; d ) dfruit="$optarg";; e ) eggplant="$optarg";; f ) fig="$optarg";; \?) echo "invalid option: -"$optarg"" >&2 exit 1;; : ) echo "option -"$optarg" requires argument." >&2 exit 1;; esac done echo "apple "$apple"" echo "banana "$banana"" echo "cherry "$cherry"" echo "dfruit "$dfruit"" echo "eggplant "$eggplant"" echo "fig "$fig"" however, output following: bash script.sh -a apple -b banana -c cherry -d dfruit -e eggplant -f fig ...o

core data - NSExpression is always returning zero -

i have entity called rounds has basic data golf rounds. trying calculate number of rounds average score. however, every time try , calculate these values returns 0 (zero). there no errors, , no crashes. i have following function in rounds.m: +(nsnumber *)aggregateoperation:(nsstring *)function onattribute:(nsstring *)attributename withpredicate:(nspredicate *)predicate inmanagedobjectcontext:(nsmanagedobjectcontext *)context { nsexpression *ex = [nsexpression expressionforfunction:function arguments:[nsarray arraywithobject:[nsexpression expressionforkeypath:attributename]]]; nsexpressiondescription *ed = [[nsexpressiondescription alloc] init]; [ed setname:@"result"]; [ed setexpression:ex]; [ed setexpressionresulttype:nsinteger64attributetype]; nsarray *properties = [nsarray arraywithobject:ed]; nsfetchrequest *request = [[nsfetchrequest alloc] init]; [request setpropertiestofetch:properties];

Django + disqus: Comment options below every blog entry -

on site, displaying multiple blog entries on 1 page. give users option comment below every entry, django-disqus giving me hard time. in html template , rotating through blog entry items , want display comment option disqus below: ... {% load disqus_tags %} {% disqus_dev %} ... {% entry in blog %} <div class="span5"> <p>{{ entry.text }}</p> {% set_disqus_identifier "entry_" entry.id %} {% disqus_recent_comments shortname 5 50 0 24 %} {% endfor %} ... however, django complaining error exception type: attributeerror exception value: 'list' object has no attribute 'var' how can display dedicated comment field disqus every blog entry? it seems not possible display multiple comment sections on same page since disqus using url identifier. there post regarding similar implementation in js. i have discarded django-disqus , implemented django-fluent-comments link github . seems allo

objective c - OSX application freezes when try to set the value of TextView? -

i new objective-c. first please see code: here property: @property (atomic) iboutlet nstextview *txtresponse; and here action: - (ibaction)sendreq:(id)sender { @synchronized(self) { request *req = [[request alloc] init]; voidcallback callback = ^(nsurlresponse *resp, nsdata *data, nserror *error) { nsstring *val = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; [self.txtresponse setstring:val]; //nslog(val); }; [req seturl:[[nsurl alloc] initwithstring:@"http://foo.bar"]]; [req setcallback:callback]; [req send]; } } the ui freezes when try use [self.txtresponse setstring:val]; tried code without @synchronized(self) problem? in advance! 3rd day working objective-c , found answer :) i used performselectoronmainthread , solved problem - (ibaction)sendreq:(id)sender { request *req = [[request alloc] init]; voidca

python - Loading data via a module and a text file in another directory -

i have directory structure: main/ __init__.py foo/ __init__.py names.py names.pickle bar/ __init__.py my_module.py names.py has code works names.pickle, including loading pickled data. however, in my_module.py if do: from main.foo import names then run my_module.py main/bar, python complains me can't find names.pickle, presumably because looks inside main/bar/, not main/foo/. what recommended way resolve this? temporarily change os.curdir? you should use file location of names.py locate names.pickle from main.foo import names import os names_pickle = os.path.join(os.path.dirname(names.__file__), 'names.pickle') each module has __file__ attribute tells located on file system.

Highstock navigator padding issue -

i using highstock charts single series having flags on x-axis 'datetime' type , y-axis numerical value. when chart loads provide bit of padding on x-axis using attribute "max" end point doesn't touch edge (which working fine) drag navigator, padding gets lost , point touches edge. there way of maintaining padding on graph line after drag navigator? appreciated... unfortnately maxpadding works first time, ddescribed, can catch adtersetextremes , (setextremes]( http://api.highcharts.com/highstock#xaxis.events.setextremes ) modify range on chart.

android - Do I need root access for accessing internal classes? -

my question simple: if want access field in internal classes, through java reflection, need have device rooted make field accessible .setaccessible(true) ? as 323go said, rooting phone has nothing visibility of class members. you need proper visibility control, that's :)

uitableview - Label and frame expansion on button click in iOS -

i need expand frame , label on click of button in section of table view. similarly, when button clicked again, frame , label should restore original (compressed) state. has done sections of table view. if click on button of 1 section, it's expanding frames sections. label expanded on clicked section. below code: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsuinteger section = [indexpath section]; if(section==0 || section==2) { static nsstring *myidentifier = @"tablecell"; dugsprojecttablecell *cell = (dugsprojecttablecell*)[tableview dequeuereusablecellwithidentifier:myidentifier]; cell.readmorebutton.tag=[indexpath section]; [cell.readmorebutton addtarget:self action:@selector(buttonpressed:) forcontrolevents:uicontroleventtouchupinside]; if (section==0) { cell.mylabel.text=@"on festive season 1

asp.net mvc - DataAnnotation Regular Expression always returns false for file input -

Image
i've tried many regular expressions regularexpression data annotation check if file extension image , returns false e.g. i've tried fileextension attribute creates error on jquery.validation. i'm using asp.net mvc 4 razor [regularexpression(@"^.*\.(jpg|gif|jpeg|png|bmp)$", errormessage = "please use image extension of .jpg, .png, .gif, .bmp")] public string myimage { get; set; } and markup <div class="editor-field"> @html.textboxfor(x => x.departmentimage, new { type = "file" }) @html.validationmessage("departmentimageerror") @html.validationmessagefor(model => model.departmentimage) </div> could show me how make work? try modifying code below. @html.validationmessagefor(model => model.myimage) my suggestion your form should below. @using (html.beginform("acion", "conroller", formmethod.post,

parse css with media queries and other end cases to php array -

id break css file php array. have code: function parsecss($css_str) { $css = array(); // todo include external css $css_str = preg_replace('/(@import\s+["\'].+["\'];)/', "", $css_str); // strip line endings , both single , multiline comments $css_str = preg_replace('/\s*(?!<\")\/\*+[^\*]+\*+\/(?!\")\s*/', "", $css_str); $css_class = explode("}", $css_str); while(list($key, $value) = each($css_class)){ $acssobj = explode("{", $value); $cssselector = strtolower(trim($acssobj[0])); if($cssselector){ // regular class not in media query $cssprops[] = $cssselector; $a = explode(";", $acssobj[1]); while(list($key, $val0) = each($a)){ if(trim($val0)){ $acsssub = explode(":", $val0); $catt = strtol

android - How to retrive date and time from database and create notification on that particular date -

i want create reminder.i using below code generate notification @ particular time , date set user. public class mainactivity extends activity { timepicker timepicker; datepicker datepicker; button button1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button1 = (button) findviewbyid(r.id.button1); button1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { timepicker = (timepicker) findviewbyid(r.id.timepicker1); datepicker = (datepicker) findviewbyid(r.id.datepicker1); alarmmanager alarmmanager = (alarmmanager) getsystemservice(alarm_service); calendar calendar = calendar.getinstance(); calendar.set(calendar.year, datepicker.getyear()); calendar.set(calendar.month, datepicker.getmonth());