Posts

Showing posts from July, 2015

jquery - is it possible to use Tabs without using anchor tag and id? -

i generate dynamic tabs. anchor tags not have id div tags wont have id. this try doesn't work. <script> $(function () { $("#tabs").tabs(); $("#tabs ul.super li a").each(function (index) { $(this).click(function () { $("#tabs").tabs("select", index); }); }); }); </script> <div id="tabs"> <ul class="super"> <li><a>title 1</a></li> <li><a>title 2 </a></li> </ul> <div> content1 </div> <div> content2 </div> </div> how can make work that? it workind code. dynamicaly add tab's , a's <div id="tabs"> <ul class="super"> <li><a>titl...

sql - Seaching For Text Within Oracle Stored Procedures -

i need search through of stored procedures in oracle database using toad. looking anywhere developers used max + 1 instead of nextval on sequence next id number. i've been doing sql server years , know several ways there none helping me here. i've tried using select * user_source upper(text) '%blah%' results returned default schema , not schema need searching in. i tried below errors select * schemaname.user_source upper(text) '%blah%' can point me in right direction. doesn't seem should difficult. thanks! select * all_source upper(text) '%blah%' edit adding additional info: select * dba_source upper(text) '%blah%' the difference dba_source have text of stored objects. all_source have text of stored objects accessible user performing query. oracle database reference 11g release 2 (11.2) another difference may not have access dba_source.

web applications - java: question on filter and servlet mapping -

i have web application following structure: tomcat_home | webapps |_myapp |-html/ |-various directories |-web-inf/ |-index.html the application has various servlets registered on various paths. application can accessed via http://ip:port/myapp/ of courses causes index.html (in welcome list). question is, how register filter access of root directory not subdirectories i.e. url-mapping not /* if place url-pattern / seems not work. filter intercept request http://ip:port/myapp/ , not http://ip:port/myapp/path or http://ip:port/myapp/servlet/path . additionally filter intercept request http://ip:port/myapp/index.html equivalent 1 aim. thanks you can test / , thing, otherwise let pass through. /* url pattern. @override public void dofilter(servletrequest req,servletresponse res,filterchain chain) throws ioexception,servletexception{ httpservletrequest request=(httpservletrequest)req; string ...

c++ - What is the nicest way to close FreeGLUT? -

i'm having trouble closing console application freeglut. i know best way take every possible closing, because don't want memory leaks (i'm pretty afraid of those). so tried following, giving me exception this: first-chance exception @ 0x754e6a6f in myproject.exe: 0x40010005: control-c. int main(int argc, char **argv) { if( setconsolectrlhandler( (phandler_routine) ctrlhandler, true) ) { // more code here .... glutclosefunc(close); // set window closing function of opengl glutmainloop(); close(); // close function if coming here somehow } else { return 1; } return 0; } void close() { // keyboardmanager pointer class // want delete, no memory leak. if(keyboardmanager) // need check? delete keyboardmanager; } bool ctrlhandler(dword fdwctrltype) { switch(fdwctrltype) { // handle ctrl-c signal. case ctrl_c_event: // , close button ca...

HeadJS and jQuery Usage -

trying use http://headjs.com while haven't still because can't understand limited documentation , samples. if can give examples of headjs jquery great. currently, have: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>title</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> </head> <body> ..... ..... <script src="js/jquery.plugins.1.js"></script> <script src="js/jquery.plugins.2.js"></script> <!-- below inline , cannot separate js file because of cms , templating limitation //--> <script> jquery.noconflict(); jquery(document).ready(function($) { $('.class').someeffect(); // many more code here }); </script> <!-- end inline scripts //--> </body> </html> my questions: if i'll use headjs, should put jque...

iphone - tab bar in a view based application -

i building view based application in xcode, , new coding , stuff doing 2 weeks. went great until wanted add tab bar project. have searched interwebz long time, find people explaining how can add tabbar window based application, or how build tab bar tab bar application. can please me. , there 1 more thing, don't want add tabbar first view. have application buttons, take different views, , want add tabbar fift view, can not build in app delegate think. i hope explains problem , sure hope me. thanks. start uitabbarcontroller. when use in interface builder can add uitabbaritems (the items select). can link each tabbaritem nib. make nibs every view want show. set every tabbaritem class correct controller of nib files, these used file owner of nib. so: -make main nib -make nibs every controller , make views. -make controllers , link controllers nib. -implement code. switching uitabbaritems make automatically change controllers. here tutorial implementation: tutori...

jquery - A JavaScript frontend logging system that logs to our backend? -

we have established logging system our server-side services. specifically, our django project makes heavy use of python logging module, call calls logger.info() , logger.warn() , logger.error() picked our centralized logging system. i equivalent on our frontend, , i've got few ideas: there sort of custom logging object exposed via javascript send messages backend via xmlhttprequest. i'd have equivalent logging levels on client-side: debug , info , warning , error . when we're developing locally (debug mode), i'd logging messages logged browser/firebug console via console.log() . in production, debug messages should dropped completely. i recall seeing way capture uncaught javascript exceptions, these should logged @ error level. we're using google analytics event tracking , , it'd nice whatever system create tie somehow. is idea? how this? there existing solutions? (fwiw, we're using jquery on frontend.) update: simplified question ...

javascript - Using Node.js, how can I check whether a domain name is registered? -

i'm building simple webapp teach myself node.js, , in need check whether domain name specified user registered. i'm not sure how go , i'd appreciate if enlighten me. take @ article matt brubeck: http://limpet.net/mbrubeck/2010/01/13/si-unit-domains-node-js.html there node.js script that.

http - web server only supporting utf-8 -

i'm implementing application's api using small web server (using mongoose). i'm thinking of supporting http requests encoded using utf-8, , return error client otherwise. is kind of limitation fine? there error type appropriate server return?

Copying Database From One SQL Server to Another -

greetings. we running microsoft sql server 2008 on 1 machine single license. need create identical development instance of database held on server, including tables, triggers, default values, data, views, keys, constraints , indexes. as temporary solution, downloaded , installed sql server 2008 express r2 along sql server 2008 toolkit on separate machine. used dtswizard.exe , pointed @ remote host data source , local machine target. transfer of data @ first appeared fine tables, indexes, etc. created after little more digging, realized not transferring/setting default values of fields! many of fields have "not null" constraints , we're interfacing com api (response rck) not allow manually edit queries we're stuck how have interface database/insert entries (including use of default values circumventing not null constraints.) as second option used "generate script" option , exported tables, constraints, indexes, default values, data, etc .sql file ...

Any place to find canonical data structures and algorithms implemented in C#? -

i'm going through skiena's algorithm design manual uses c. examples (binary tree search, etc.) pretty simple, i'd see them in c# make sure i'm working through them correctly. are there sites provide basic algorithms , data structures in c#? right i've been googling particular thing i'm looking for, i'd surprised if there wasn't more definitive site out there. ngenerics seems library data structures , algorithms. i've used few of tree implementations results.

javascript - jquery .change() in firefox -

i'm using jquery change change values of select drop down whenever user changes month (so right number of days displayed). works great in browsers except firefox :( suffice code big this $(document).ready(function() { var leap; $('.dob').change(function() { var y = $('#ryear option:selected').html(); /* year selected */ var s = $('#rmonth option:selected').html(); /* month selected */ }); }); then alter data variable values in mind. there 3 selects .dob, bit this <select class="dob" id="rday"> <option id="01">01</option> .... </select> <select class="dob" id="rmonth"> <option id="1876">jan</option> .... </select> <select class="dob" id="ryear"> <option id="1876">1876</option> .... </select> in firefox when select month or year select drop down (the v...

php - Reauthorizing facebook application -

i'm developing facebook application , going fine log in , comments etc. i came across issue of 'reauthorizing' users. 1 of users 'accidentally' pressed 'don't allow' when asked them access information , cannot sign in. does know how can reauthorize them? thanks in advance. edit: turns out once officially published application users' error disappeared. i'm pretty sure aren't supposed have work-in-progress published apps solved problem. it should ask permissions automatically. try tell him this: go my account > privacy settings (i don't know exact text of option because mine in spanish). then, in footer menu, select applications , web sites next applications use , click on edit settings search app , delete it. re-enter in app , permissions dialog should appear.

android - Removing ListView after user selects item -

this 1 should pretty simple. use case have listview generated results of voice search. once user selects appropriate item list, want list disappear. list (its contents) not needed again. know can done in number of ways, not experienced enough know best (quickest, efficient mobile resources...etc.) have used clearchoices(), setvisibility(2) 'gone'. anyway thought go source proper answer. thanks help. here relevant code, if like: protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == voice_recognition_request_code && resultcode == result_ok) { mlist = (listview) findviewbyid(r.id.list); arraylist<string> matches = data.getstringarraylistextra(recognizerintent.extra_results); mlist.setadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_1, matches)); mlist.settextfilterenabled(true); mlist.setonitemclicklistener(new onitemclickliste...

Monitor data consumption in Android app? -

i'm building app relies on lot of online content. i'd monitor how being downloaded , attempt minimize as possible. these days, more , more carriers implementing data caps, users deserve application has gone through data consumption testing. well, not advanced tools. can use iptables in underlying linux system give network info. used little while ago bit of tracking. needed rooted phone. i've tried out far on g2, not sure how fare on emulator or of sort. assuming did have rooted phone, have iptables command available, can use iptables segment traffic off chain , stats out of chain: iptables -n app iptables -a output -d a.b.c.d -j app if wanted track data sending ip a.b.c.d handset. can dump stats iptables using "iptables -l -v -n" packet count , byte count rule. might not right solution given control source of program. comes in useful monitoring when don't have ability modify code.

javascript - how to add/include js file in xbl? -

i've read around , found techniques add js file inside xbl, techniques don't work. tried declare tag: <'script src='test.js''> , <'script src='chrome://content/test.js '> , none worked. the method inside test class function caller() { alert("call succeeded"); } . is there correct , simple way include js file inside xbl, calling functions file works if function written inside xbl. here's more details: http://www.w3.org/tr/xbl-primer/#scripts you're doing seems fine, here's example they're giving: <xbl xmlns="http://www.w3.org/ns/xbl"> <script src="example.js"/> note xmlns there, that's default namespace. if have defined as: xmlns:xbl="http://www.w3.org/ns/xbl" have use <xbl:script src="example.js" /> try that, never tried myself namespace thing common pitfall. edit: i'm afraid might not possible. xbl 2.0 spec, , gec...

ruby on rails - how to create a migration that will populate my menu -

how create migration populate menu. example have relationship survey has_many :question , question belongs survey question has_many :answers, , answer belongs question this relationship have , have data driven menu menu survey , under survey there questions. menu this survey1 *question1 *question2 survey2 *question1 *question2 any ideas?? i did this, so... step 1. use acts_as_tree create tree-structured menu. step 2. create tree structure in seeds.rb can rake db:seed about_us = root.children.create(:title => 'about us') {|r| r.url = '/pages/about_us'} about_us.children.create(:title => 'biography') about_us.children.create(:title => 'our clients') about_us.children.create(:title => 'office locations') about_us.children.create(:title => 'contact us') step 3. create helper in application_helper.rb (or wherever) build menu out in html.

html - How is the 'ex' unit in CSS useful? -

possible duplicate: what value of css 'ex' unit? is there proper usage of 'ex' unit in css? when should used/not used instead of other units 'px', '%', 'em'? i'd think ex should used instead of em when dealing vertical rather horizontal measurements (e.g., height instead of width).

asp.net - ListView ItemDataBound on all pages -

the itemdatabound event of asp.net listview seems deal visible page determined datapager. how able utilize data binding on pages worth of listview? this regarding using itemdatabound check checkboxes... protected void lvcfr_itemdatabound(object sender, listviewitemeventargs e) { listview lv = (listview)sender; listviewdataitem lvi = (listviewdataitem)e.item; if (lvi.itemtype == listviewitemtype.dataitem) { checkbox cb = (checkbox)lvi.findcontrol("cb1"); dropdownlist ddl = (dropdownlist)lvi.findcontrol("ddl1"); if (ddl != null) ddl.enabled = false; if (cb != null && ddl != null) { int id = convert.toint32(lv.datakeys[lvi.displayindex].value); foreach (keyvaluepair<int, string> kv in cfrids) if (kv.key == id) { cb.checked = true; ...

c++ - How to create a function which randomly jumbles a string -

my main function contains string jumble. have found piece of code passes in char* , returns 0 when complete. have followed code providers instructions pass in string have jumbled. #include <iostream> #include <string.h> #include <time.h> using namespace std; int scramblestring(char* str) { int x = strlen(str); srand(time(null)); for(int y = x; y >=0; y--) { swap(str[rand()%x],str[y-1]); } return 0; } when this, recieve error "no suitable conversion function "std::string" "char*" exists . i have tried passing in const char* won't allow me access word , change it. why mixing std::string char* ? should operate directly on string: void scramblestring(std::string& str) { int x = str.length(); for(int y = x; y > 0; y--) { int pos = rand()%x; char tmp = str[y-1]; str[y-1] = str[pos]; str[pos] = tmp; } } usage becomes: ...

What does a $ in a javascript function name mean? -

gwt outputs codes this: function com_mycompany_mywebapp_client_ctest_$$init__lcom_mycompany_mywebapp_client_ctest_2v(){ this$static} what $ mean, or character underscore? this_static mean same thing? nuthin. it's character. think of s stick stuck through it.

c# - Implementing a MySQL command progress bar -

we trying parse file , store in mysql database. commands importing large trace file several gigabytes in size, it may of interest user track progress of command. using following command: string commandtext = "set autocommit = 0; " + "start transaction; " + "load data local infile \'" + filepath + "\' " + "into table testdatabase.metadata " + @"fields terminated '\t' " + @"lines terminated '\n' " + "(position," + "timespace," + "duration," + "disk," + "request," + "sector," + "length); " + "commit;"; is there way track progress while command being executed in orde...

plist - iPhone: Problem with scope of variables -

i have used code load data plist. -(void)loadorcreatedata { nslog(@"start loadorcreatedata"); nsstring *filepath = [self datafilepath]; if ([[nsfilemanager defaultmanager] fileexistsatpath:filepath]) { nslog(@"file exists.. loading plist file"); nsarray *array = [[nsarray alloc] initwithcontentsoffile:filepath]; font = [array objectatindex:0]; background = (nsstring *)[array objectatindex:1]; animation = [array objectatindex:5]; [array release]; nslog(@"loading done!"); } else { nslog(@"file not exist.. creating new plist file"); font = @"georgia-bolditalic"; background = @"monalisa.jpeg"; animation = @"103"; [self savedata]; } nslog(@"finish loadorcreatedata"); } - (nsstring *)datafilepath { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory,...

c# - LINQ to DropDownList with Server.HtmlDecode -

i have code uses linq populate dropdownlist: var usercategories = dataaccesslayer.context.categories .where(c => c.username == httpcontext.current.user.identity.name) .select(c => new { c.id, c.category }) .orderby(c => c.category); categorydropdownlist.datasource = usercategories; categorydropdownlist.datavaluefield = "id"; categorydropdownlist.datatextfield = "category"; categorydropdownlist.databind(); where put server.htmldecode category? first, want htmlencode, not htmldecode. here's example: foreach (var category in usercategories) { categorydropdownlist.items.add(new listitem(server.htmlencode(category.category), category.id.tostring())); }

vb.net - Change the default endpoint device in vista and windows 7 -

i working in visual studio 2010, framework 3.0. i want enumerate audio recording devices on vista , windows 7 pcs. of core audio apis, completed successfully. want change default state of devices , want set state of disabled device enable. in core audio apis, not possible. can use registry enable device or change device default? on changing default device sound dialog, windows makes changes of binary values in registry role:0, role:1, role:2under hklm\software\microsoft\windows\currentversion\mmdevices\audio\capture\ {guid}. can me or suggest me, how ? thanks in advance reply.

asp.net - calling vb pagemethod from ajax -

hi have simple aspx file 2 text boxes , ajax autocomplete extender attached textbox2 <%@ page language="vb" autoeventwireup="false" codefile="test4.aspx.vb" inherits="test4" %> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <form id="form1" runat="server"> <div id="content"> <asp:scriptmanager id="scriptmanager1" runat="server"> </asp:scriptmanager> <asp:textbox id="textbox1" runat="server"> </asp:textbox><br /> <asp:textbox id="textbox2" runat="server"> </asp:textbox> ...

MySQL Enum correct use? -

`gender` enum('female','male','rather not say','alien') not null default 'rather not say', is correct way use enum? yes is. more info here http://dev.mysql.com/doc/refman/5.0/en/enum.html your use of enum takes less storage space , faster if stored actual strings since mysql internally represents each choice number. i.e. female = 0, male = 1, etc.

Android About page -

how open settings>about page programmaticlly in android. you can open using intent intent aboutphone = new intent(settings.action_device_info_settings); startactivity(aboutphone); as in android there many settings classes , here : android.provider.settings

ICEPDF Applet | Disable "Save-As" button from toolbar -

i using icepdf(open source java applet) applet viewer pdf view in web without use of adobe reader. want disable "save-as" button toolbar available @ top. have extracted jar files , dont know file customize. any1 me on file edited hide save-as option toolbar. please.. - haan you can work on swingviewbuilder . personally, did customization subclassing , returning nulls things wanted disable. edit : swingviewbuilder has many buildxyz() methods. required make such method return null each button/menu item/toolbar not needed. rest of code handling nulls gracefully , skips on it. specifically, "save-as" feature, need change/override buildsaveasfilebutton() , buildsaveasfilemenuitem() .

tsql - first attempt at a sproc transaction -

i trying write sproc transaction. can tell me if there issues code below, or if work intended? alter procedure [dbo].[deletemetricmeter] ( @sectionid int, @metricmeterid int, @result bit output ) declare @metricmetercount int declare @err int declare @rowcount int set xact_abort on begin tran select @metricmetercount = count(*) lumetricmeters fksectionid = @sectionid select @err = @@error, @rowcount = @@rowcount if (@err <> 0) or (@rowcount = 0) begin goto on_error end delete lumetricmeterlist pkmetricmeterid = @metricmeterid select @err = @@error, @rowcount = @@rowcount if (@err <> 0) or (@rowcount = 0) begin goto on_error end delete lumetricmeters pkmetricmeterid = @metricmeterid select @err = @@error, @rowcount = @@rowcount if (@err <> 0) or (@rowcount = 0) begin goto on_error end if (@metricmetercount = 1) begin delete lumetricsections pksectionid = @sectionid select @e...

.net - Why is it not possible to remove unused references in C# -

is there reason not possible visual studio remove unused references (to projects , assemblies) in c# , c++ projects while possible visual basic project ( see here )? i know can other tools resharper , wondering if there technical reason not being able in c# , c++ projects? or did microsoft choose work that. seems quite useful feature. note compiler automatically drop unused references assembly, @ assembly metadata level redundant. becomes ide/tooling issue. impossible? no (although need keep marked copy-local, ensure gets deployed). can assume, therefore, "time implement vs utility" (compared other more useful things done). i'm sure write ide extension if wanted ;p

C# call method on a member class -

i want that: public class myclass { public string vara{ get; set; } public string[] varb{ get; set; } //..... public ?? string tohtml() { //return html value } } public class run() { myclass c = new myclass(); c.vara = "toto"; c.varb = new string[] { "foo", "bar" }; string = c.vara.tohtml() // -> "<p>toto</p>"; string b = c.varb.tohtml() // -> "<ul><li>foo</li><li>bar</li></ul>"; } how can ? edit: have change run() this way implement scenario extension methods. while, others have noted, make sense keep logic turn strings html within myclass, in scenarios might make sense use approach. public class myclass { public string vara{ get; set; } public string[] varb{ get; set; } } public static class myextensions { public static string tohtml(this string input, string format) { re...

CSS is it possible to possition a table on top of another table? -

i got 2 tables 1 below other. want move covers bit of top table. can css? on second table, try: margin-top: -50px or: position: relative; top: -50px; but tables sometime tricky style (you should tests in different browsers)

user interface - android extracted mode keyboard and android:digits -

i have edittext field restricted numbers , .,- android:digits , set android:inputtype numbersigned|numberdecimal my problem when switch landscape mode, ime goes extracted mode , lost comma put (i'm testing french locale). if delete androud:inputtype , works keyboard not set numeric keypad. what i missing? just found it's android sdk bug: http://code.google.com/p/android/issues/detail?id=2626

asp.net mvc - MVC insert/update in controller -

i have following in controller (to insert/or/update news entity). i'm using ef poco public class newsviewmodel { /// <summary> /// initializes new instance of <see cref="newsviewmodel"/> class. /// </summary> public newsviewmodel() { this.news = new news(); this.categories = new list<int>(); } /// <summary> /// gets or sets news. /// </summary> public news news { get; set; } /// <summary> /// gets or sets categories. /// </summary> public ienumerable<selectlistitem> selectcategories { get; set; } /// <summary> /// gets or sets groupin. /// </summary> public ienumerable<int> categories { get; set; } } [httppost] public actionresult edit(news...

Using JQuery to remove an input and print its value -

i trying following jquery: see if text input has value if does, make read or make hidden , print value in div input if doesn't have value, behaves normal. i've tried using hide() , read-only jquery functions doesn't seem working. can refer input name (i can't edit original code add class) http://jsfiddle.net/ssw6v/1/ - there solution

asp.net - Visually Tracking / Monitoring Workflow(WF) 4.0 -

i planning build custom web application in asp.net 4.0 using wf 4.0 , user wants ability modify workflows himself, using wpf client user can use , workflow re-hosting, lots of blogs , guidance available this. but not sure how meet 1 requirement user wants see/track visual representation (diagram/image) of workflow , depicting stages over, current stage etc. needs done on web page. possibly same workflow icons depicting status. similar visual available visio workflows in sharepoint 2010. agilepoint workflows provide such view. similar question here , winforms/wpf guess. , need asp.net. any ideas? there's interesting sample might useful: appfabric reference implementation: managing lifecycle of workflow service . deals re-hosting designer, , showing state on design surface, ie. how far workflow has come. utilizes data format found in appfabric monitoring store achieve this. sample winforms app same principles apply in web based scenario.

java - JSF 2.0 How a CAPTCHA works -

can sombody recommend me captcha tool jsf pages? there captcha tool included in jee6 or have add project, external .jar? also there brief tutorial on how include in program? or steps should follow so?(i never used captcha before). here example thing can use. there no integrated support in jee6, have in provided example or have componenet has functionality. know of 1 in primefaces components here (it uses popular recaptcha componenet)

File system permission error while installing drupal modules -

when try install new modules drupal 7 via "install new module" form, following error message. the specified file temporary://filetfj015 not copied, because destination directory not configured. may caused problem file or directory permissions. more information available in system log. http://ftp.drupal.org/files/projects/date-7.x-1.0-alpha2.tar.gz not saved temporary://update-cache/date-7.x-1.0-alpha2.tar.gz. unable retrieve drupal project http://ftp.drupal.org/files/projects/date-7.x-1.0-alpha2.tar.gz . my drupal 7 installed cpanel quickinstall tool , hosted hostgator shared hosting service. ideas how solve issue? there issue shared hosts , temp folders...if want background can read this: http://drupal.org/node/1008328 in meantime try changing tmp folder relative sites file root: sites/default/files/temp

xsd validation ERROR with both minOccurs and length used simultaneously -

Image
<xsd:element name="currencycode" minoccurs="0" type="xsd:string"> <xsd:simpletype> <xsd:restriction> <xsd:length value="3"/> </xsd:restriction> </xsd:simpletype> </xsd:element> i want currencycode optional value , if @ there value should have length of 3 letters .. either currencycode can have length=0 or length=3 when use above code validator returns error when there empty field so how can deal ?? have not tried (do not have suitable env set on machine) according specification can follows: <xsd:element name="currencycode" minoccurs="0" type="xsd:string"> <xsd:simpletype> <xsd:restriction base="xsd:string"> <xsd:pattern value="(?:^$|\w{3})"/> </xsd:restriction> </xsd:simpletype> </xsd:element> regular expression (?:^$...

jquery select box help needed -

i have select box , option value has united kingdom united states when select "united kingdom" option want 2 values "uk" selected value , param value 1 any possiblity using jquery? you use .data() function. first have set data on select options. <option data-country="uk" data-value="1" selected="selected"></option> then can data doing following: $("option:selected").data("country"); $("option:selected").data("value");

java - Storing Serializable object to file with some data excluded -

i have object allows me store bufferedimage object file. in same object have bufferedimage variable use cache image after it's loaded first time raw data array. works fine when i'm creating object , storing file, since bufferedimage null. problem comes when i'm updating loaded object , variable being initialized , want save object after it's updated. is there possibility store serializable object file, excluding of variables? or maybe can reset somehow bufferedimage variable when storing file? thanks in advance, serhiy. you should mark attribute don't want serialize transient : private transient bufferedimage image;

c# - Re-writing the Hosts file does not update the next IP connection -

we have written c# application communicates 1 of group of ip in cloud. 1 of may not working. use url of address iis server expecting host header name in order route correct application interface. so set hosts file point url @ ip. send command @ url server time. tells connection working. if don't response assume connection dead. write new ip list hosts file , try again. this hit bug. application doesn't seem see hosts file has changed , uses old (bad) ip. there no caching built application assuming windows caching us. we've tried flush caches with: ipconfig /flushdns arp -d * nbtstat -r we still same problem. thoughts on how clear cache? if can't address @ server end (e.g. load balancer, etc), use ip address list in code: var req = httpwebrequest.create("http://" + ipadd.tostring() + "/path_to_query_time"); ((httpwebrequest)req).host = "yourhostheaderhere"; var resp = req.getresponse(); //if things have gone ...

java - primitive vs managed types on android - which one should i use in my app -

im trying port iphone app android. new java , android environment i see different code samples on internet, use int , boolean use integer , boolean i wanted know pros , cons of both , best way forward? since primitive types saved on stack , no garbage collection happens on them, better choice far performance goes? what real benefit of primitive v/s managed types? , suggested approach? in app performance crucial... thanks in advance the wrapper types used when need object. example : able store integers in collection (like list or set), need transform primitive object (integer). the wrapper have feature on primitive types : nullable.so, example, represent integer value stored in nullable column of database table, you'll use integer rather int able store null value. basicaly, advice : use primitive types except whan can't (for example, 1 of reasons explained).

How to checkout from HEAD revision of all svn tagged externals -

here externals tagged svn pg svn:externals . abc ht*p://svn.apache.org/src/svnrt/abc/tags/abc_3.114/abc def ht*p://svn.apache.org/src/svnrt/def/tags/def_1.97/def xyz ht*p://svn.apache.org/src/svnrt/xyz/tags/xyz_1.251/xyz can checkout head revision of externals instead of going each tagged build , doing switch? yes. update svn:externals property point trunk instead of tag. using example: abc http://svn.apache.org/src/svnrt/abc/trunk/abc def http://svn.apache.org/src/svnrt/def/trunk/def xyz http://svn.apache.org/src/svnrt/xyz/trunk/xyz

installation - Deploying .net addin application -

i have developed first .net addin. now comes part deploy , im lost. in .net setup , deployment project, have configured application folder contain dlls , add-in file itself. now comes requirement automate add-in deployment in vs2008 editor. is there way, on successful installation,the addin automatically added in addin manager (i.e after folder configured in add-in / macros security automatically ? ) pop usage document file included file in application folder on successfull installation.

sql server - MS SQL: Nested Selects - Mysterious "Invalid column name" error -

when run following query against mssql 2000 select distinct(email), (select top 1 activityid activity aa, activitytype tt aa.activitytypeid = tt.activitytypeid , aa.consumerid = c.consumerid , tt.activitytype = 'something_optin') optin, (select top 1 activityid activity aa, activitytype tt aa.activitytypeid = tt.activitytypeid , aa.consumerid = c.consumerid , tt.activitytype = 'something_optout') optout activity a, consumer c, activitytype t c.countryid = '23' , t.activitytype = 'something_create' , a.activitytypeid = t.activitytypeid , c.consumerid = a.consumerid , optin > 1 i following error server: msg 207, level 16, state 3, line 1 invalid column name 'optin'. why happen? can't see why invalid. sql server not allow refer aliases name @ same level. fix this, repeat column definition: wh...

viability of c++ logging library for asynchronous capturing of high throughput data? -

i working real time system written in c++. looking use either boost or pantheios logging. system has standard logging requirements i'm confident can met either framework, in addition want capable of logging input captured system. input captured multiple threads, including threads have real-time constraints , can not afford significant delays inefficient logging. should result in high throughput of data logged. i want know whether either framework can trusted manage such high throughput logging multiple threads without delaying time critical threads. in addition may need data scrubbing require adding sort of hook capable of identifying capture inputs have secure data, run our data scrubbing hook, , maintain buffer containing mappings of values scrubbed. i believe both logging platforms can this, it's not clear me quick glance @ api. can has used either of these logging tools give me feedback on how efficient in context, how easy implement described, or preference be...

Specify CPPFLAGS when building with CPAN -

i have cpan module attempting build. requires compiling small c program. don't have root on system, have complete parallel source tree in $home/local/src installed @ $home/local/lib , $home/local/include, etc. how pass cppflags=-i$home/local/include ldflags=-l$home/local/lib cpan module built? you can pass cppflags , ldflags cpan module build process setting these environment variables. had luck local tidy , tidyp install after setting these, in bash). steps: installed tidy , tidyp prefix $home/local export cppflags=-i$home/local/include export ldflags=-l$home/local/lib export ld_library_path=$home/lib cpan cpan> install html::tidy i added ld_library_path setting above -ltidyp picked correctly html::tidy install.

css - Highlight part of a table row -

Image
i have table has rows alternate colors, when hover on rows highlighted yellow. i of rows highlighted time too(not onhover). have discovered of rows highlighted right next each other , gives effect that part of table yellow , doesn't good. i want know if possible create small strip of highlighting through middle of row while outsides remain natural color. this have: .resulttable tbody tr:nth-child(2n+1){ background-color:white; } .resulttable tbody tr:nth-child(2n){ background-color:#e6ebec; } .resulttable tbody tr:nth-child(n):hover{ background-color: yellow; } .highlightedrow{ background-color:#f2f18d !important; } this want: update: i cant seem border method work. this closest there space between borders. .resulttable{ text-align:center; width: 100%; padding: 0px; margin: 0px; } .resulttable thead{ background-color: #000099; color: white; font-size:22px; font-weight:bold; } .resulttable caption{ backgrou...

code first - Using Entity Framework w/o Global State -

i made small test function creating entity framework code-first dbcontext instance directly connected sql ce 4.0 file don't global state approach. isn't there better way this, without using dbdatabase static properties? using system.data; using system.data.entity; using system.data.entity.database; using system.data.sqlserverce; public class sqlcedb { public static t instance<t>() t: dbcontext, new() { dbdatabase.defaultconnectionfactory = new sqlceconnectionfactory("system.data.sqlserverce.4.0"); dbdatabase.setinitializer<t>(new dropcreatedatabasealways<t>()); return new t(); } } dependency injection lot of people doing. write class has dependency on dbcontext (i.e. it's constructor argument or property decorated dependency), , ioc (inversion of control) container give instance of when class created. every ioc container i've worked has way of registering single instance (instead of creati...

mfc - Is a CString always null-terminated? -

from cstring interface, 1 should not assume cstring null-terminated. however, seems there is, in fact, null character @ end of string. possible, in windows implementation, create cstring not have null character, reading 1 character past end of string looking @ different heap object? a cstring more visual basic string or bstr . can contain embedded binary zeros in data portion of cstring. when using various operators convert between cstring , standard c type 0 terminated strings, embedded binary 0 treated end of string character. cstring lot bstr type of variable. for instance put following source lines mfc project , ran in visual studio c++ debugger. cstring mystring (_t("this\000is string.")); // mystring contain "this" 0 terminated string. cstring myjj; myjj.format (_t("this%cisaxxx"), 0); // creates string embedded binary 0 in it. int ilen = myjj.getlength(); // returns length of complete string, 11 characters cstring m...

Django - Prevent automatic related table fetch -

how can prevent django, testing purposes, automatically fetching related tables not specified in select_related() call during intial query? i have large application make significant use of select_related() bring in related model data during each original query. select_related() calls used specify specific related models, rather relying on default, e.g. select_related('foo', 'bar', 'foo__bar') as application has grown, select_related calls haven't kept up, leaving number of scenarios django happily , kindly goes running off database fetch related model rows. increases number of database hits, don't want. i've had success in tracking these down checking queries generated using django.db.connection.queries collection, remain unsolved. i've tried find suitable patch location in django code raise exception in scenario, making tracking easier, tend lost in code. thanks. after more digging, i've found place in code this. t...

soap messages over a single HTTP(S) connection -

can give me answer following question: have remote web service , requirement 100 tps. (transaction per second ). far know creation of connection ( http connection ) quite expensive operation. so, need create 1 http connection web service , being able send lot of soap messages (envelopes) through connection, not 1 soap message , 1 http connection, many soap messages , 1 http connection. of course need create http connections need, each of them must serve soap messages. may there development pattern or other issue not know. i appreciate kind of help! soap not have on http. happens implemented on http. if want use soap can use socket, or message queue http. example see: http://msdn.microsoft.com/en-us/library/51f6ye7k.aspx however, think if need 100 tps, soap not right technology use.

Android 2.3.3 (Windows) emulator doesn't show the phone desktop on startup. Getting a repeated Launcher (com.android.launcher) error -

when try run android 2.3.3 emulator, phone desktop doesn't show. instead, error message keeps popping : the application launcher (process com.android.launcher) has stopped unexpectedly. please try again. i keep force-closing keeps popping up. however, application try run (i'm using eclipse helios ide) runs fine in background. how around this? you console view in eclipse. or call platform-tools/adb catlog to display java log.

can I get .net compiler to do some optimistic caching to speed up the build without refactoring code base into assemblies? -

my dotnet code base pretty big (so don't feel undertaking refactor assemblies project) doesn't change much. build real slow, although disk speed fine - apparently takes awhile compile thing. imho have made sense compiler cache compiled versions of files haven't changed since last build in optimistic expectation no change in file broke module. if optimistic assumption proved invalid, full build undertaken. well, pretty sure things done while using java , c++ compilers. could done here in dotnet? if not, why not :-) ? visual studio doesn't rebuild assembly unless has to. "has to" when of following change: assembly properties such target cpu/framework dependencies in referenced assemblies (if object a1 in assembly requires b1 in b, , b1 changes, assemblies , b must rebuilt) source code compile assembly (obviously) also, build speed less dependent on pure code count, or class count, number of projects being built. given constant number of li...

Sort Multi Array in PHP -

does have idea how can sort array key (date) in php? array ( [2011-02-16] => array ( [date] => 2011-02-16 [num] => 2 ) [2011-02-11] => array ( [date] => 2011-02-11 [num] => 0 ) [2011-02-17] => array ( [date] => 2011-02-17 [num] => 0 ) [2011-02-18] => array ( [date] => 2011-02-18 [num] => 0 ) ) use uasort function, user customizable sorting. this: function cmp($a, $b) { if ($a['date'] == $b['date']) { return 0; } return ($a['date'] < $b['date']) ? -1 : 1; } uasort($your_array, "cmp");

linux - MongoDB gui in python -

is there web mongodb gui in python? or linux os compatible gui? https://github.com/milancermak/myngo : mongodb web front end written in python plus host of other options here : http://www.mongodb.org/display/docs/admin+uis

asp.net - Countries and their province web service -

i need webservice information of whole of countries , provinces location , area or population knows web service ? why need web service? don't think exist. what need is, can create table in db , add data, easy find sql insert queries dump data. please check these urls http://amrelgarhytech.blogspot.com/2008/08/list-of-countries-cities-languages.html country, state list sql server

delphi - Loosen "Local procedure/function assigned to procedure variable" restriction gracefully -

consider following test-case: { compilerversion = 21 } procedure global(); procedure local(); begin end; type tprocedure = procedure (); var proc: tprocedure; begin proc := local; { e2094 local procedure/function 'local' assigned procedure variable } end; at line 13 compiler emits message error level, prohibiting of cases of such local procedures usage. "official" resolution promote local symbol outer scope (ie: make sibling of global ) have negative impact on code "structuredness". i'm seeking way circumvent in graceful manner, preferably causing compiler emit warning level message. your best bet declare reference procedure using new anonymous methods feature , can keep nicely encapsulated. type tproc = reference procedure; procedure outer; var local: tproc; begin local := procedure begin dostuff; end; local; end; this gets around issues mason describes capturing variables local anonymous...

html - How to get this drop down menu to work in IE 8? -

the menu works fine in firefox, chrome , older ies not in ie8. ive been sitting hours cant work. please me out. here´s menu in question: hugoth the menu works, problem you're having menu displaying within table cell (note scroll bar on right side of cell). simple fix add z-index:1; elements.... parent element of menu (i.e. td ). a more time consuming solution rewrite code use div's instead of tables. harder since have re-write code, in doing display correctly across browsers (with exception of ie5.5). just 2 cents

php - jquery 1.5 ajax requests are erroring -

trying upgrade jquery 1.5 , ajax calls break. i'm running firefox , gives me javescript error of invalid label i'm using php's json_encode here json response { "page": "1", "total": 9651, "rows": [ { "cell": [ "story", "51438", "skin color: handy tool teaching evolution", "2011-02-20 08:30:26" ] }, { "cell": [ "story", "51435", "photosynthesis may hold key production of cheap hydrogen fuel", "2011-02-19 10:00:03" ] }, { "cell": [ "story", "51478", "dancers, supporters ready thon 2011 feb. 18-20 @ jordan center...

views2 - Drupal: Field of View is not presented on the page that was created by this View -

i have imagefield in view. not exluded output. presented in preview. when open page created view - not presented there. how can diagnose issue ? (all caches turned off, drupal v6, views v2) thanks. here few ideas come mind: switch theme, see if theme function causing problem view page source, see if html wrapping imagefield there if img url there, go url directly, see if error clear views cache, on tools tab in views

sql - Deleting records using delete/where exists problem -

my problem want delete records 2 tables, deleting records result of following query: select avg(pr.rating) rating_average products p inner join product_ratings pr on pr.product_id = p.product_id group p.product_id having avg(pr.rating) < 3 the above query shows average ratings of product less 3, want delete products , associated ratings of results above query. i looked @ delete product_ratings, products exists (//above query) , didn't work, i've been trying various delete statements no avail. i have read following, , still cannot find solution: sql: delete statement & sql: exists condition . the tables products , product_ratings , following structure: products -------- product_id [pk] | link | ... product_ratings --------------- rating_id [pk] | rating | product_id appreciate help, links reference material better understand how it's done. edit: apologies not stating rdbms i'm using, it's mysql edit2: bit confused now, @martin...

html5 - How to display a list of <article> the same cross-browser? -

Image
firefox , opera seem put articles after each other while chrome gives line break after each one. 1 correct , how them display preferred style same cross browser? <html> <body> <article> item 1 </article> <article> item 2 </article> <article> item 3 </article> <article> item 4 </article> </body> </html> opera 11.01 chrome 9.0 you should set either display: inline or display:block in css. (whichever 1 want)

java - How to get today's Date? -

in other words, want functionality provides joda-time: today = today.withtime(0, 0, 0, 0); but without joda-time, java.util.date. methods such .sethours() , etc. deprecated. there more correct way? date today = new date(); today.sethours(0); //same minutes , seconds since methods deprecated, can calendar : calendar today = calendar.getinstance(); today.set(calendar.hour_of_day, 0); // same minutes , seconds and if need date object in end, call today.gettime()

javascript - Matching urls without specific delimiters -

i'm trying match urls inside arbitrary text, no specific delimiters, , multiple items in same line: http://www.site.com/image1.jpg "http://www.site.com/image2.jpg" 'http://www.site.com/image1.jpg&a=1' please not space after fist url, , terminating &a=1 this actual regex: (https?:\/\/.*\.(?:png|jpg)) , matches correctly last url, fist , second matched 1 result. the expected result should instead this: http://www.site.com/image1.jpg http://www.site.com/image2.jpg http://www.site.com/image1.jpg thanks. if ending .jpg it's easy achieve regexp: /[a-za-z0-9:\/\.-]+\.jpg/ . i've added few more url examples test match. result array of matches. var str = "http://www.site.com/image1.jpg \"http://www.site.com/image2.jpg\" 'http://www.site.com/image1.jpg&a=1' http://www.21d1dk1kk1.org/image.jpg http://www.21d1dk1-kk1.org/image.jpg"; var matches = str.match(/[a-za-z0-9:\/\.-]+\.jpg/g); if need matc...

python - Is it a good idea to generate and store a random number as a hash value for my class? -

i have class wraps list, , lists apparently can't have hash values. idea generate random number , store hash value. not idea. general contract of hash code if object equals object b, a.hashcode() equals b.hashcode(). you're proposing wont hold. you try using list length hash code hash code of first item in list hashcode sum of hashcodes of items hashcode or else along these lines.

objective c - Neither connectionDidFinishLoading: nor didFailWithError: get invoked -

calling connectioninprogress = [[nsurlconnection alloc] initwithrequest:request delegate:self startimmediately:yes]; when disconnect , reconnect internet simulator. 1 call initwithrequest: not causing neither connectiondidfinishloading: nor didfailwitherror: invoked. i call in loop , getting following results (when disconnected). didfailwitherror: fetch failed: internet connection appears offline. next call after few seconds (as internet reconnected). didfailwitherror: fetch failed: server specified hostname not found. and next time call neither of 2 callbacks being invoked. i ran same problem iphone simulator. after 6 hours of debugging, googling , searching stackoverflow have found solution: the iphone simulator has bug ! (or @ least tests proved). when disconnect wifi/internet cable mac trying simulate network connectivity disappearing, not simulated in iphone simulator! (in fact if notice wifi connectivity icon on simulator not disap...

queue - (OCaml) How does "remove" function from OCaml's PriorityQueue look like? -

does know how "remove" function ocaml's priorityqueue library like? i know how works wanna see code. thanks! i suppose you're talking priorityqueue module holger arnold's ocaml-base library? @ source, it's this: let remove h x = try remove_index h (hashtbl.find h.indices x) not_found -> ()

c++ - What can I do with an unsigned char* when I needed a string? -

suppose have unsigned char*, let's call it: some_data unsigned char* some_data; and some_data has url-like data in it. example: "aasdasdassdfasdfasdf&foo=cow&asdfasasdfadsfdsafasd" i have function can grab value of 'foo' follows: // looks value of 'foo' bool grabfoovalue(const std::string& p_string, std::string& p_foo_value) { size_t start = p_string.find("foo="), end; if(start == std::string::npos) return false; start += 4; end = p_string.find_first_of("& ", start); p_foo_value = p_string.substr(start, end - start); return true; } the trouble need string pass function, or @ least char* (which can converted string no problem). i can solve problem casting: reinterpret_cast<char *>(some_data) and pass function okie-dokie ... until used valgrind , found out can lead subtle memory leak. conditional jump or move depends on uninitialised value(s) __gi_st...