Posts

Showing posts from May, 2013

php - Delete row by row or a bulk -

i like delete bulk of data. table have approximately 11207333 now however have several method delete it. the data deleted approximately 300k. have 2 method unsure 1 perform faster. my first option: $start_date = "2011-05-01 00:00:00"; $end_date = "2011-05-31 23:59:59"; $sql = "delete table date>='$start_date' , date <='$end_date'"; $mysqli->query($sql); printf("affected rows (delete): %d\n", $mysqli->affected_rows); second option: $query = "select count(*) count table date>='$start_date' , date <='$end_date'"; $result = $mysqli->query($query); $row = $result->fetch_array(mysqli_assoc); $total = $row['count']; if ($total > 0) { $query = "select * table date>='$start_date' , date <='$end_date' limit 0,$total"; $result = $mysqli->query($query); while ($row = $result->fetch_array(mysqli_assoc)) {

Android BLE Scan in Background Service -

i'm trying make android app scan bluetooth device background service. once phone within range of bluetooth device, measured reading rssi, background service start activity displayed user. if phone moved out of range of bluetooth device, (after rssi value beyond threshold,) activity should killed. here code background service: public class beaconscanservice extends service implements bluetoothadapter.lescancallback { private service self = this; public static final string unlock = "unlock"; public static final string status = "status"; public static final string signal = "signal"; public static final string get_signal = "get_signal"; //desired device find private static final string targetmac = "e1:be:a8:1a:8b:a0"; //class handle saving rssi values , detecting bluetooth proximity private proxdetector proxy; //boolean determine if phone in bt range static boolean inprox = fals

IIS -> PHP -> Wordpress - ERR_CONNECTION_REFUSED -

Image
i'm trying install wordpress on iis, annoying problem has been getting on nerves. the wp installed on windows server 2012 iis installed (other asp.net sites work on it). there no firewall enabled on windows server. the login screen disappears if set user in iis, still giving problem err_connection_refused tries access blog externally server. i have tried: give folder access permission user anonimous, had no effect. activate ssl, had no effect either. disable ssl on wordpress: define(‘force_ssl_admin’, false); define(‘force_ssl_login’, false); on wp_config.php disable php_openssl.dll on php extensions follows print (left screen of external user , right navigation screen server): how solve it? i found solution here: http://blog.pluralsight.com/installing-wordpress-on-iis7 i removed mysql , installed current version. i changed permissions full control of phpsessions folder users: iusr; iis_iusrs; network service

jsp - using cookies for single sign on with sso server -

is possible implement single sign on using authentication server(idp) using cookies ? here scenario : we have multiple web applications (esp's) . each esp may request idp authenticate user . now idp authenticates user via desired authentication protocol , stores cookie in user's browser time stamp maybe . now next time when esp requests user authentication , first of idp checks if there exists cookie in browser , if exists authenticates user otherwise again goes through authentication process user . please guide me if on going right track . what suggesting referred "persistent login cookie authentication" or "remember me authentication" , it's standard practice. can find article on how implement such mechanism securely @ http://jaspan.com/improved_persistent_login_cookie_best_practice some frameworks spring security have concept implemented in stack. might ready-made single sign-on frameworks jasig cas tend have these features

ios - replace source of predictive texts in custom keyboard -

is there way replace source of predictive texts in ios 8 custom keyboard extension , show in predictive text bar? class predictive text bar? thanks lot. i've read docs not find answers. please help. 1) can use uilexicon, technically dictionary of key-value pairs of strings wrapped in uilexiconentry object apple give example of "iphone" turning "iphone" , "nur" turning "nur n. eytan" (from address book) etc.. but can make smarter things. one smart thing example create open source project takes in json of strings , converts uilexicon :) i'd use it! 2) apple give 320 pixels width , ±215 pixels height keyboard. you prohibited , technically can't draw outside of these boundaries. companies releasing custom keyboards did reduce size of keys in 20%-25% in order add candidate view (predictive text bar) edit: can adjust height of keyboard on ios8.0 - here's pointer: ios 8 custom keyboard: changin

c# - How to onfigure Log4Net to rolling everyday? -

i want configure log4net rolling every day, mean want take log everyday in new file, config log4net in app.config : <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler, log4net" /> </configsections> <log4net> <root> <level value="debug" /> <appender-ref ref="fileappender" /> </root> <appender name="fileappender" type="log4net.appender.rollingfileappender"> <file type="log4net.util.patternstring" value="e:/mylog_" /> <staticlogfilename value="false" /> <appendtofile value="true" /> <rollingstyle value="date" /> <datepattern value="yyyy.mm.dd'.log'" /> <lockingmodel type="log4net.appender.fileappe

fputs - Writing a file using c program in the format of table -

i want write file in format of table using c program. using fputs write file. file looks : [sl] [name] [school] [add] 1 abc def dav india 2 xyz lll usa but, want output file : [sl] [name] [school] [add] 1 abc def dav india 2 xyz lll usa i want know there length specifier in fputs in printf can change format of file. i think looking fprintf . find out more fprintf here . used same way printf , except writes file. edit if string stored in different variables, use fprintf follows : fprintf(fp,"%-15s %-15s %-15s %-15s", "string 1", "string 2", "string 3", "string 4"); the number 15 fixed length string use (you can change based on maximum string length have or other preference). minus sign left justified string.

What are the alternatives to Spring's Hibernate template? -

since no longer recommended use spring's hibernate template, using plain hibernate based daos. but spring's hibernate template used provide lots of convenient finders methods etc. if don't use spring's hibernate template, lose features. is there alternatives spring's hibernate template? spring+jpa+hibernate (jpa specification hibernate , others frameworks implements) great alternative old hibernate template, should give try of course, have others options, considering know hibernate, jpa seems natural choice.

ubuntu 12.04 - Foreman : Failed to run preseeded command exit code 8 -

i install ubuntu 12.04 foreman provision. when finish installation, error occur : failed run preseeded command excution of preseeded command "wget http://foreman.example.com:80/unattened/finish?token=bae86996-5230-433b-84e7-896a5280df75 -o /target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target/tmp/finish.sh" failed exit code 8 log apache : get /unattended/finish?token=bae86996-5230-433b-84e7-896a5280df75 http/1.1" 200 1003 "-" "wget" /unattended/built?token=bae86996-5230-433b-84e7-896a5280df75 http/1.1" 409 1 "-" "wget/1.13.4 (linux-gnu)" how fix error?please guide me correct way achieve objective. this normaly happens if host in 'build mode'. simplest solutions should delete bare metal host in foreman , create new one.

xml - nxlog parse_xml() with attributes -

i'm learning nxlog there aren't may examples of parsing xml input in current docs. my input lines this: <msg time='2014-06-27t00:27:38' type='error' code='5000' target='some.target' machine='dev-machine' process='2408' thread='160' elapsed='0.00000'>the message.</msg> i have <input my_input> module im_file file 'c:\logs\\*.dat' exec parse_xml(); to_json(); </input> which produces only: {"eventreceivedtime":"2014-06-27 01:13:28","sourcemodulename":"my_input","sourcemoduletype":"im_file"} how attributes json fields? unfortunately there no support parsing xml attributes or nested xml via xm_xml extension module. there xm_perl use kind of complex xml parsing (available linux only).

java - how to format a string value to double decimal format -

number format nf = numberformat.getnumberinstance(locale.us); decimalformat df = (decimalformat)nf; df.applypattern("$###,###.###"); string format_val=df.format(4596.37); num = new jxl.write.number(i, j,double.parsedouble(format_val),arial10format); here i'm getting numberformatexception : java.lang.numberformatexception: input string: "$4,596.37" how solve one? what "think" want (i've not tried this) let cell take care of formatting, example... numberformat decimalno = new numberformat("$###,###.###"); writablecellformat numberformat = new writablecellformat(decimalno); //write datasheet number numbercell = new number(i, j, 4596.37, numberformat); excelsheet.addcell(numbercell); take @ writablecellformat more details what you've tried is... convert double value 4596.37 string , format of $###,###.### try , convert $4,596.37 double ...which fails string you've passed not conform requirements

java - Storing multiple values with same key in HashMap -

i had interview today , interviewer asked me how can store multiple values having same key in hashmap? gave me example-->if given list of string , suppose store length of string key , string value. i gave following solution in how using hashmap: map<integer, arraylist<string>> map = new hashmap<integer, arraylist<string>>(); integer being length of string , arraylist store strings of particular length. the interviewer said 1 way of using hashmap there way in won't requiring arraylist or other data structure. during interview, couldn't come solution , after enough googling, still have nothing. can tell me how can achieve solution question? thanks! one way without using data structure concatenating strings in values. for e.g. map.put(2,"rr*tt*yy"); map.put(3,"nnn*ggg*sss"); map.put(4,"ffff*dddd*jjjj");

c# - Pass Value to BeforeSendRequest in WCF -

i want pass additional value( guid, different each request) beforesendrequest in wcf iclientmessageinspector interface. value not include in request object. how can pass value beforesendrequest method? public class wcfmessageinterceptor : idispatchmessageinspector, iclientmessageinspector { [threadstatic] private static string service1guid; public object afterreceiverequest(ref message request, iclientchannel channel, instancecontext instancecontext) { service1guid = request.headers.getheader("service1-guid-header", "s"); } public object beforesendrequest(ref message request, iclientchannel channel) { var servicename=""; if (channel != null && channel.remoteaddress != null) { var tmp = request.headers.action.substring(0, request.headers.action.lastindexof('/')); servicename = tmp.substring(tmp.lastindexof('/') + 1); }

asp.net mvc 4 - google is not defined in mvc4 -

i trying render google geochart inside partial view in mvc4 it's showing reference error: "google not defined" but in simple view it's rendering fine.below step render geochat.i don't know doing wrong or should fellow other step render google geochat. my partial view( _mymap.cshtml ) <script type='text/javascript' src='http://www.google.com/jsapi'></script> <div id='visualization'></div> <script type='text/javascript'> function initialize() { google.load('visualization', '1', { 'packages': ['geochart'] }); google.setonloadcallback(drawvisualization); } function drawvisualization() { var data = new google.visualization.datatable(); data.addcolumn('string', 'country');

Excel vba how to divide? -

i trying divide value taked cells dim sk integer, p integer 'cells(5, 4) = 9 'cells(5, 14) = 2 sk = cells(5, 4) - cells(5, 14) ' sk= 7 p = sk / cells(5, "d") ' sk = 7 ' cells(5, "d") = 15 ' p = 0 but excel give me p = 0 if change divide / multiple * everithing ok excel want p variant why hapens? instead of declaring sk integer declare double

javascript - Beginner: Extension of file -

i realize basic question i've started need this. i've written code in notepad using php , javascript , need know extension should be? should save .html or .php or what? you must save these files .php extension . why? well, server can configured parse html or other files php, you must able know content of file without opening it , , adding .php extension easy way accomplish this.

java - Excluding a CDI Bean based on a PropertyFileConfig (DeltaSpike, WebSphere 8.5.5) -

i trying exclude bean implementation using deltaspike 1.0 @exclude -annotation. exclusion should based on property value this: @exclude(onexpression = "providerimplementation!=mock") i created propertyfileconfig returning .properties file name let deltaspike pick configured value , used @exclude in 2 different implementing beans, each of them being excluded above. the configuration included in ear .jar file , both implementations sit in different .jar files inside ear. i trying deploy whole archive onto websphere 8.5.5 server , on startup javax.enterprise.inject.ambiguousresolutionexception injection point. it seems me propertyfileconfig not picked before expression resolution, although found references kind of pattern ( http://deltaspike.apache.org/core.html#exclude , https://groups.google.com/forum/#!topic/java-config/xslemkst3ru ), wonder what's wrong setup. first answer : unfortunately, properties defined via propertyfileconfig facilit

objective c - iOS 7.1 - How to call a selector without knowing name at compile time? -

when code gets point in execution, needs call selector. problem is, selector call, along object passed in performselector, changes each time. candidate selectors functions written ahead of time, how can convert variable (e.g.: nsstring* or enum telling program selector call) name of selector, without using gigantic switch statement? sel selector = nsselectorfromstring(aselectorname); if ([self respondstoselector: selector]) { [self performselector: selector]; }

How to retrieve auto incremented id in rails 4.1? -

currently working on rails 4.1, i have model called accounts.rb , account = account.create :name => 'test' :info => 'test' so statement saving database, using "account.id" auto increment id in accounts table. but not working , showing following error, undefined method `id' "":string but worked in rails 1.9 version . please me. object your method seems correct; syntax seems have issue undefined method `id' "":string this means you're calling id method on object string, empty 1 @ that. i therefore problem not auto increment number, it's how you're calling id of new object -- create the standard way use following: #controller account = account.create({name: "test", info: "test"}) return account.id according create documentation, should work you. if doesn't, may wish use .new .save methods, this: #controller account = account.new({name:

php - Update Mysql value from an <a href> link uncaught referenceError -

i new php , mysql , having problems understanding why specific function update value within databse isnt working. i want able change "0" int "1" when user clicks link. (i using value 0 / 1 track if user account active or not). the link in question reads: <?php $user = query("select * users id = ?", $_session["id"]); //check see if user active or not if ($user [0]['active'] == 0) { printf("your account not active "); printf('<a href="#" onclick="activate();">click me</a>'); printf(" reactivate"); } //assuming have logged in want make active ?> when click link console reports: uncaught referenceerror: activate not defined i have defined activate in separate functions.php file being loaded , has correct permissions. (i sure being loaded code above when define activate manually in code above error telling me cannot define

javascript - CoffeeScript - How do I retrieve a static array property in class -

i started learning coffeescript , i'd know best practice retrieving static property in class child instance. class mutant mutantarray: [] constructor: (@name, @strength = 1, @agility = 1) -> @mutantarray.push(@name) attack: (opponent) -> if opponent in @mutantarray console.log @name + " attacking " + opponent else console.log "no mutant name of '" + opponent + "' found." @getmutants: () -> # right? console.log @.prototype.mutantarray wolverine = new mutant("wolverine", 1, 2) rogue = new mutant("rogue", 5, 6) rogue.attack("wolverine") mutant.getmutants() i getmutants() method static (no instantiation needed) , return list of mutant names have been instantiated. @.prototype.mutantarray seems work fine, there better way this? tried @mutantarray doesn't work. thanks! i think should define mutantarray static field. then, non-static me

node.js - Mongoose - pushing object into nested array -

i trying push student object inside 'students' object of team object. below details. i got solution niel. have noted @ end. team.js var teamschema = new schema({ // team name. name: string, lead: string, students :type: [{ block : number, status : string, student : { type: schema.objectid, ref: 'student' }] }); student.js var studentschema = new schema({ name: string, rollno : number, class : number }); expected output team { "__v": 1, "_id": "5252875356f64d6d28000001", "students": [ { "__v": 1, "_id": "5252875a56f64d6d28000002", block : 1, status : invited, student: { "name": sumeeth "rollno" : 2 "class" : 5 } }, { "__v&

c++ - What is an undefined reference/unresolved external symbol error and how do I fix it? -

what undefined reference/unresolved external symbol errors? common causes , how fix/prevent them? feel free edit/add own. compiling c++ program takes place in several steps, specified 2.2 (credits keith thompson reference) : the precedence among syntax rules of translation specified following phases [see footnote] . physical source file characters mapped, in implementation-defined manner, basic source character set (introducing new-line characters end-of-line indicators) if necessary. [snip] each instance of backslash character (\) followed new-line character deleted, splicing physical source lines form logical source lines. [snip] the source file decomposed preprocessing tokens (2.5) , sequences of white-space characters (including comments). [snip] preprocessing directives executed, macro invocations expanded, , _pragma unary operator expressions executed. [snip] each source character set member in character literal or string literal, e

Is it possible to check if -Verbose argument was given in Powershell? -

i have written own powershell logging function log parameters stream (on stream write message) , message (the message write). the idea can write outputs both console , log-file. in function determine on stream publish message (with switch statement) , write message stream , log-file: switch ($stream) { verbose { write-output "$logdate [verbose] $message" | out-file -filepath $sglogfilename -append write-verbose $message break } } the question now, possible check if -verbose argument given? the goal write message log-file if -verbose given. i looked in following docs didn't find helpful: - about_parameters - about_commonparameters also, -whatif parameter not work write-verbose. thanks lot answers! inside script check this: $pscmdlet.myinvocation.boundparameters["verbose"].ispresent

ios - Adjusting background color and spacing of a collection view background and cell spacing -

i have following code testing: in viewdidload() uicollectionviewflowlayout *layout = [[uicollectionviewflowlayout alloc] init]; self.collectionview = [[uicollectionview alloc] initwithframe:scrollview.frame collectionviewlayout:layout]; // these required [self.collectionview setdatasource:self]; [self.collectionview setdelegate:self]; //[self.collectionview.layer addbluegradient]; [self.collectionview registerclass:[uicollectionviewcell class] forcellwithreuseidentifier:@"cellidentifier"]; [self.view addsubview:self.collectionview]; } - (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section { return 50; } - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { uicollectionviewcell *cell=[collectionview dequeuereusablecellwithreuseidentifier:@"cellidentifier" forindexpath:indexpath]; cell.backgroundcolor = [uicolor redcolor];

for loop - EmberJS: how to use nested objects attributes in computed properties? -

i have trouble understanding proper way call attributes of child in nested object model, , use them compute new property. here i'm trying far: monitor.processcontroller = ember.objectcontroller.extend({ nbusers: function() { var total = 0; this.get('containers').then(function(containers) { containers.foreach(function(container, index){ total += container.get('nbusers'); }); }); return total; }.property('containers.@each.nbusers') }); monitor.containercontroller = ember.objectcontroller.extend(); monitor.process = ds.model.extend({ containers: ds.hasmany('container', {async : true}), name: ds.attr('string') }); monitor.container = ds.model.extend({ process: ds.belongsto('process'), name: ds.attr('string'), nbusers: ds.attr('integer') }); // test data monitor.process.fixtures = [ { id: 1, name: 'mumble', containers: [1,2]

ruby on rails - Using Sidekiq with Unicorn on non-managed server -

i have setup custom environment rails application on linux vm server, using nginx, unicorn, , capistrano. have stage based customized capistrano scripts installing unicorn service , reloading on each deployment. now, using sidekiq background jobs. i'm using capistrano-sidekiq gem automatic worker restarting. problem is; doesn't work (i.e. not starts automatically unicorn) if server/vm restarted. i'm considering make service did unicorn, check running worker , re-spawn new one. complex if want spawn multiple worker processes because i'll have track pids of them (capistrano-sidekiq takes care of this). so, need guidance how accomplish smartest solution, , if there other way or gem that. googling results many results mentioning solutions heroku , other managed rails servers. i'm amazed why less people using sidekiq on custom servers. usually monitoring tool used purpose. 1 such tool god . the basic idea run god system service, , configure sidekiq w

javascript - How can I destroy a fragment (or a view)? -

i have created fragment: var dialogfrafment = sap.ui.xmlfragment( "appintra.fragment.dialog", this.getview().getcontroller() // associate controller fragment ); this.getview().adddependent(dialogfrafment); sap.ui.getcore().byid("idmailreport").setvalue(sap.ui.getcore().getmodel("mailuser")); dialogfrafment. dialogfrafment.open(); how can delete after complete? store dialogfrafment in controller. if(!this.dialogfrafment) { this.dialogfrafment = sap.ui.xmlfragment( "appintra.fragment.dialog", this.getview().getcontroller() // associate controller fragment ); this.getview().adddependent(dialogfrafment); sap.ui.getcore().byid("idmailreport").setvalue(sap.ui.getcore().getmodel("mailuser")); } this.dialogfrafment.open(); destroy fragment in onexit function of controller. onexit: function() { if (this.dialogfrafment) { this.dialo

docusignapi - Hiding Documents Section For Recipient View -

we using embedded signing display recipient view. there configuration setting in docusign hide documents section (which contains number of documents in envelope) displayed in right side of screen. no, it's not possible hide "documents" section (displayed down right side of screen when viewing envelope) recipient. amongst other things, section can useful navigation aid signer, thumbnail images contain visual indicators of pages require signer's input, , signer can navigate specific page clicking on page's thumbnail image.

ExtJS Repositioning/resizing toolbar on window resize -

i have toolbar inside simple container. rendered on window's div. when resize window toolbar remains stationary. if window gets smaller toolbar starts disappearing (overflowing outside). if window gets bigger toolbar stays in position instead of trying remain far right started. i've tried resize , enable overflow configs nothing seems work. i'm thinking positioning through div might problem i'm not sure how test or fix that. ideas? some sample code: var toolbar = ext.create('mytoolbar'); var toolbarcontainer = ext.create('widget.contaienr', {renderto: 'mydiv', items: [toolbar]}); . . . <div id='mydiv'></div> check function in extjs docs onwindowresize( fn, scope, [options] ) adds listener notified when browser window resized , provides resize event buffering (100 milliseconds), passes new viewport width , height handlers. example code looks below(i guess have write in afterrender .(you have add event , f

sparql - Is there a way to convert the data format of an RDF vocabulary to SKOS -

the rdfs file i'm want use cv.rdfs , want convert skos, can use in maui indexer i complete noob in subject. please help. skos organizing concepts, , doesn't deal properties, seems, there's lot of information in cv rdfs doesn't have skos version. however, it's easy enough define mapping rdfs classes , generate data using sparql. here's possible mapping: rdfs:class maps skos:concept. rdfs:comments map skos:notes. rdfs:labels map skos:preflabels. rdfs:subclassof maps skos:broader. using mapping, can write following sparql produces resulting "skos document" (it's rdf document using lots of skos vocabulary): prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix skos: <http://www.w3.org/2004/02/skos/core#> construct { ?x skos:concept ; ?skosp ?y } { values (?rdfsp ?skosp) { (rdfs:subclassof skos:broader) (rdfs:label skos:preflabel) (rdfs:comment skos:note) } ?x rdfs:class ; ?rdfsp ?y }

c# - Highlight Some Part of PDF -

this strange client's requirement. wanted highlight part of pdf . pdf contains only image , want highlight selected area of image inside pdf . know highlighting text. don't know highlighting part of pdf. please help. don't know how this. i doing project in asp.net mvc 5(c#) . try itextsharp. there no direct method highlight image, instead can specifying co-ordinates want highlight. please take @ following link, highlighting text ( colors ) of existing pdf using itextsharp using c#

php - Paste password into composer -

it may trivial question, not knowing answer make things harder. i'm using composer through windows cmd. i've got private git repository composer access through ssh username/password. problem ctrl+v , ppm not working when composer asking password. there way paste password? use ssh key authentication provider pageant (included putty) , use ssh keys authenticate. make life way easier. no need ever paste passwords shells.

ExtJS: grids data linking -

i have 2 ext.panel.grid (let's call "a" , "b") when select line in grid "a", data loads grid "b. main problem grid "b" editable, , when select record in "a", changes in "b" record lost :( there next logic in controller "grid id[a]": { selectionchange: function(grid, record) { this.getgridb.getstore().loaddata( record.get('options'), false ); } } and sample record is: { name: "item1", owner: "user1", options: [ { value: "345", name: "option1" }, { value: "100500", name: "option2" } ] } where should store changed values? or there another, more "straight" solution? loaddata() loads array of data straight store.if data in correct format respect model of other store can use method directly loading mo

Error while printing in octave -

when trying print variables or 'help < topic >' commands, getting error in octave. octave-3.6.4.exe:66> minimize 0 [main] 0 init_cheap: virtualalloc pointer null, win32 error 487 allocationbase 0x0, baseaddress 0x60e90000, regionsize 0x170000, state 0x10000 c:\software\octave-3.6.4\bin\less.exe: *** couldn't reserve space cygwin's heap, win32 error 0 i not sure causing error. removed cygwin windows registry. reason? in case, how rid of error? i had exact same problem. uninstall octave, reboot, reinstall it. did trick me.

java ee - Remote EJB testing with JUnit and glassfish 4 -

i working on automated testing of ejb3 beans. have managed create sample application, following code: (the test enviroment based on 4 modules: ejb client, ejb, ear - containing ejb client & ejb - , junit tester project). interface: package remote.test; import javax.ejb.remote; @remote public interface testbeanremote { public void method1(); public int method2(); } ejb: package remote.test import javax.ejb.remote; import javax.ejb.stateless; @remote @stateless public class testbean implements testbeanremote { public testbean() { } @override public void method1() { } @override public int method2() { return 42; } } for helping junit testing, use glassfish4 orb/iiop port default settings. i have utility class setting up: import java.util.properties; public class util { public static properties getinitproperties() { properties result = new properties(); result.setproperty("java.naming.factory.initial", "com.sun.enterprise.naming

c# - How to force EF migrations to not apply WillCascadeOnDelete to database? -

i have next models: public class company { public int id { get; set; } public string name { get; set; } public virtual icollection<statement> statements { get; set; } public virtual icollection<criterion> criteria { get; set; } } public class statement { public int id { get; set; } public string name { get; set; } public virtual company company { get; set; } public virtual icollection<criterion> criteria { get; set; } } public class criterion { public int id { get; set; } public string name { get; set; } } and next cascade settings: modelbuilder.entity<company>() .hasmany(x => x.criteria) .withoptional() .willcascadeondelete(); modelbuilder.entity<company>() .hasmany(x => x.statements) .withrequired(x => x.company) .willcascadeondelete(); modelbuilder.entity<statement>() .hasmany(x => x.criteria) .withoptional() .willcascadeondelete(); i use ef mig

java - executor service. how to await while all threads will terminate -

Image
please understand concurrency problem. i have following code thread execution: public void startpool(final processor processor, configuration config) { executorservice pool = executors.newfixedthreadpool(config.getthreadpoolsize()); (final string source : config.getsourcepaths()) { pool.submit(new runnable() { @override public void run() { processor.process(source); } }); } pool.shutdown(); } when use 1 thread( config.getthreadpoolsize() returns 1) expecetd result. when use thread count - every time different results. in case result - output console. understand if use lot of threads can different order of output different content!!! sometimes, contents absent. looks 1 thread terminated , other died @ moment. where can search error? @ code or somewhere deeper? i see situation on picture: update

Using android.support.v7.widget.CardView in my project (Eclipse) -

i'd use new cardview widget introduced new android l developer preview support library (as mentioned here ), seems part of new revision of v7 support library. i have updated sdk version, downloaded newest support library package, still cannot find new cardview widget. i searched web , official docs, not hints on can new support library. any highly appreciated! edit: i'm using adt/eclipse using gradle or android studio, try adding dependency on com.android.support:cardview-v7:21.+ . there not seem regular android library project @ time cardview-v7 , leanback-v17 , palette-v7 , or recyclerview-v7 . have no idea if/when google ship such library projects.

c# - Asp.Net/Javascript Avoid postback on click on button inside bulleted list, meanwhile call a function from code behind on click event -

i have asp bulleted list link buttons list items. need avoid postback action called on click on button; meanwhile, on click event, have call function code behind. knows how can it? thank you to access code behind either need post on ajax query. to stop post onclick set control autopostback false: <asp:listcontrol autopostback="false" /> listcontrol.autopostback property not sure want achieve here.

ruby on rails - link_to => undefined method path -

i have created object events , have refactored controller. have : the view : <td><%= link_to 'show', event %></td> the route : scope 'admin', :module => 'back', :as => 'back' root :to => 'events#index' resources :events end the controller : class back::eventscontroller < backcontroller but have error undefined method event_path. have changed link : <td><%= link_to 'show', back_event %></td> because when make rake routes see : back_event /admin/events/:id(.:format) back/events#show patch /admin/events/:id(.:format) back/events#update put /admin/events/:id(.:format) back/events#update delete /admin/events/:id(.:format) back/events#destroy but now, have error : undefined local variable or method `back_event how can create link ? thanks. eric <td>

object - Python recursive proxy -

hopefully should explain i'm trying achieve class a(object): def hello(self): print "hello" = a() a.b = a() a.b.c = a() a.b.d = [] a.b.d.append(a()) p = proxy(a) print p.b "b accessed" <__main__.a object @ 0xb73f3bec> print p.b.c "b accessed" "c accessed" <__main__.a object @ 0xb73f3dec> print p.b.d "b accessed" "d accessed" [<__main__.a object @ 0xb73f3bcc>] print p.b.d[0] "b accessed" "d accessed" <__main__.a object @ 0xb73e766c> print p.b.d[0].hello() "b accessed" "d accessed" "hello called" "hello" basically far walk down structure keeps returning proxy objects. best if created these proxy objects when attribute accessed first time , stored on 'parent'. goal of can logic before method called on (nested) object i had at: http://code.activestate.com/recipes/496741-object-proxying/ first layer, , cou

c++ - Converting a 8 bit PCM to 16 bit PCM -

starting this question made understand how deinterleave left , right channel of 16 bit pcm data. my question is, how 8 bit pcm deinterleaved , "stretched" 16 bit value 16-bit pcm has same data bits , additional bits on least significant bit side specify value , add accuracy , detail. 8-bit pcm typically unsigned value centerpoint of 0x80 , , 16-bit (also applicable higher bitnesses) pcm signed integer, conversion formula is: uint8 sample8 = ...; int16 sample16 = (int16) (sample8 - 0x80) << 8;

php - Load *LIBL (library list) defined in CRTJOBD when connecting to db2 with PDO -

it seems nobody had problem yet.... db2_connect found docs decrible how load default library list ( *libl ) on connection pdo nothing! i'd perform statements without specifing library name in front of file name. created job description load libraries, , when log in pc5250 emulator library online. but if run query pdo without specifying library name following returned: error executing sth in testget as400 sqlstate[42s02]: base table or view not found: 0 [ibm][system access odbc driver][db2 i5/os]sql0204 - testfile in web type *file not found. (sqlprepare[0] @ ext\pdo_odbc\odbc_driver.c:206) to use library list, need make sure connection attributes specify system naming, , avoid setting current schema. without knowledge of php + pdo, stackoveflow tag wiki gives introduction. check pdo configured proper settings db2 i, not luw or z. likewise check db2_connect settings. (why using that, instead of straight odbc?)

facebook - Like button css issue on website -

in internal pages of website, example: http://www.primapaginaonline.it/2014/06/27/gare-degli-sbandieratori-ritrovano-santemidio/ if click button in bottom @ page, in colored box, popup cropped , can't figure out why. any help? thanks the popup field cropped because iframe css have line crops 100% of span. embed, object, #content iframe{max-width:100%;} in style.css 441-row

Replace CKEditor toolbar images with font awesome icons -

is there way replace default toolbar images (e.g. bold, italic, etc.) font awesome icons? i know old issue, on plugin plugin basis i've been able add font-awesome icons ckeditor buttons following code inside plugin's init function. in case plugin called trim : //set button name , fontawesome icon var button_name = 'trim'; var icon = 'fa-scissors'; //when ckeditor plugin in created, find button //in current instance , add fontawesome icon ckeditor.on("instanceready", function(event) { var this_instance = document.getelementbyid(event.editor.id + '_toolbox'); var this_button = this_instance.queryselector('.cke_button__' + button_name + '_icon'); if(typeof this_button != 'undefined') { this_button.innerhtml = '<i class="fa ' + icon + '" style="font: normal normal normal 14px/1 fontawesome !important;"></i>'; } }); it hinges on knowing class of s

c# - Giving application elevated UAC -

i have application needs uac elevation. i have code lets me give application opens twice.. issue.. so here code in form1: public form1() { initializecomponent(); windowsprincipal pricipal = new windowsprincipal(windowsidentity.getcurrent()); bool hasadministrativeright = pricipal.isinrole(windowsbuiltinrole.administrator); if (!hasadministrativeright) { processstartinfo startinfo = new processstartinfo(); startinfo.useshellexecute = true; startinfo.workingdirectory = environment.currentdirectory; startinfo.filename = application.executablepath; startinfo.verb = "runas"; try { process p = process.start(startinfo); } catch (system.componentmodel.win32exception ex) { return; } } } and code programs.cs static void main() {

android - Get fragment layout from its id -

i'm trying change fragments inside activity in android application. i want code method which, based on button 's id changes fragment inside view , problem in myfragment class public static class myfragment extends fragment { public registerfragment(int id){ this.id = id; } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { xmlresourceparser layout = getresources().getlayout(r.id.this.id); view rootview = inflater.inflate(layout, container, false); return rootview; } } my problem getresources().getlayout(r.id.some-random-id); givin error resource id type not valid i'm using method because want make dynamic choose of fragment layout , based, indeed, on id . i use android:id retrieve di layout <framelayout xmlns:android="http://schemas.android.com/apk/res/android&quo

java - How to print out a negative number represented by an array -

i'm starting learn java, , want try represent big negative numbers using arrays. let's have array [-2, 0, -5] , represents number -502 i've tried using stringbuilder, prints out -50-2 this code of right now. there way make can append first negative, , skip rest of negatives when building new string? stringbuilder sb = new stringbuilder(); for(int x = arr.length-1; x>=0; x--){ sb.append(arr[x]); } string check = sb.tostring(); system.out.println(check); initialize string buffer last character (with appropriate sign) , ignore signs rest. stringbuilder sb = new stringbuilder(); sb.append(arr[length-1]); (int x = arr.length-2; x>=0; x--) { sb.append(math.abs(arr[x])); } string check = sb.tostring(); system.out.println(check);

android - ViewPager animatin in fragmentTransaction -

i'm trying obtain viewpager animation using fragmentmanager. can see animation here: http://developer.android.com/training/animation/screen-slide.html i tryed apply customanimation transaction using animation that: <objectanimator xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" android:valuefrom="-100" android:valueto="0" android:propertyname="x" android:duration="@integer/slide_in_left_animation_duration" /> but animation different i'm looking for. there way that? or have use viewpager? (i don't think viewpager right solution.. in fact app have change fragment depending on user input, can't fill arraylist priori) this library provides easy way set viewpager page change animations , has quite many types implemented. it's easy use, see it's example application , documentation. https://gi

git - Ruby Gem won't build: Gem::InvalidSpecificationException [...] are not files -

i trying build gem, keep getting: warning: see http://guides.rubygems.org/specification-reference/ error: while executing gem ... (gem::invalidspecificationexception) [*list of 300 file paths*] not files i know files must added git, , have done so. date. what strikes me file paths in list of subdirectory, path missing several folders. example: in list: bin/some_file.jar actual file: bin/some_library/lib/some_file.jar i suspected has how git set up, because gem in "mother git folder" has several projects, including couple of gems, so: mother folder -> .git -> gemfolder1 -> gemfolder2 -> someotherproject it appears amble both build , install gem1, gem2 gives me these errors. initially had folder . in folder name, thought problem. renamed folder, added changes git, , retried. however, still had same exact issue. i think strange, , makes me suspect there strange bug in gem itself. furthermore, when manually run `git ls-files -z

How to use the new android 4.4 emulator? -

it seens stuck on final part of tutorial, asks me command. wont display home screen usual shortcuts, available apps. shows clock , card final instruction. also, wont ask me unlock screen , cant figure how add shortcuts on home screen. you can try alternative emulator android - genymotion . works faster native android emulator.