Posts

Showing posts from August, 2010

ios - How to get rid of multiple sets of parentheses in an array -

i'm using restkit object mapping json , i'm mapping array. json i'm mapping looks this: "parameters":[{"parameter_value":["smith"]}, {"parameter_value":[66211]}] the array i'm getting looks this: parameter value: ( ( smith ), ( 66211 ) ) when try convert array string via code: nsstring *nameidvalue = [[parametervaluearray valueforkey:@"description"] componentsjoinedbystring:@""]; string nameidvalue turns this: ( smith )( 66211 ) how rid of parentheses i'm left smith, 66211 you asked eliminating "sets of parentheses", given underlying structure series of nested collections (dictionaries , arrays), can achieve desired effect collapsing level or 2 structure. can kvc collection operator , @unionofarrays , used in conjunction valueforkeypath . if want string manipulation, can that, seems more logical write code renders simple arra...

grails - Grials clean command prevent deleting resources -

Image
how prevent grails clean command, not delete newly added folder in web-app folder. i use lots of custom folders in webapp, grails-clean doesn't delete of mine. plz rename folder other , check again.

html - How to make responsive table -

i have table represent data in html page. i'm trying make table responsive. how can ? here demo . basically a responsive table 100% width table. you can set table css: .table { width: 100%; } demo here you can use media queries show/hide/manipulate columns according screens dimensions adding class (or targeting using nth-child , etc): @media screen , (max-width: 320px) { .hide { display: none; } } html <td class="hide">not important</td> more advanced solutions if have table lot of data , make readable on small screen devices there many other solutions: css-tricks.com offers this article handling large data tables. zurb ran issue , solved it using javascript. footables great jquery plugin helps out issue. as posted elvin arzumanoÄŸlu great list of examples .

linux kernel - Difference between ZRAM and ZSWAP -

does know difference between feature zram , zswap in linux kernel? seems similar-- store compressed pages in ram. zram module of linux kernel, called "compcache". zram increases performance avoiding paging on disk , instead uses compressed block device in ram in paging takes place until necessary use swap space on hard disk drive. since using ram faster using disks, zram allows linux make more use of ram when swapping/paging required, on older computers less ram installed. zswap lightweight compressed cache swap pages. takes pages in process of being swapped out , attempts compress them dynamically allocated ram-based memory pool. zswap trades cpu cycles potentially reduced swap i/o. trade-off can result in significant performance improvement if reads compressed cache faster reads swap device.

html - Basic javascript isn't working - display block -

if user selects "house" want new select option box pop up. nothing happening. function showfamilies(){ if(pt.selectedindex == 1) document.getelementbyid('families').style.display = 'block'; if(pt.selectedindex != 1) document.getelementbyid('families').style.display = 'none'; } <select id="pt" value="pt" name="pt" onchange="showfamilies()"> <option value="" name="">select</option> <option value="1" name="1">house</option> <option value="2" name="2">commercial</option> </select> <div id="families" style="display:none">families: <select name="amin_families"> <option value="1" name="condo">1</option> <option value="2" name="co-op">2</option></select> </div> redefined...

Soundcloud SDK for Android -

may know, possible use soundcloud sdk android sdk ? if is, know how use soundcloud sdk android project ? sample projects or guideline links helpful. as there soundcloud java library available, seems practical use soundcloud android. it contains example code.

Php to json does not pass all arrays (or json does not display all received values) -

Image
as see first , third row fields filled, second row fields left blank. filled values with $.post("__php_file.php", { 'number_of_input_row': number_of_input_row, 'date_day': date_day, 'date_month': date_month, 'date_year': date_year, 'currency': currency }, function(data, success) { $('#currency_load1').html(data[0].finalcurrencyrate); $('#currency_load2').html(data[1].finalcurrencyrate); $('#currency_load3').html(data[2].finalcurrencyrate); }, "json"); send php file, process , such php array array ( [0] => array ( [currencyabbreviation] => aud [dateofcurrencyrate] => 2013-07-11 [numberofinputrow] => 1 [finalcurrencyrate] => 0.506 ) [2] => array ( [currencyabbreviation] => cad [dateofcurrencyrate] => 2013-07-25 [numberofinputrow] => 3 [...

php - "Cannot redeclare class" issue in FuelPHP -

working namespaces in default fuelphp installation add following welcome controller (otherwise unedited) , start getting error: errorexception [ compile error ]: cannot redeclare class fuel\controller\welcome" the code is: <?php namespace fuel\controller; use fuel\core\controller; class welcome extends controller { ... } this beginner's question can't figure out why collision occurring , have tried can think of. edit: tried putting following code in front of class , error disappeared generic looking 404 page displayed. (not 1 displayed default fuelphp black/grey one) if (class_exists("controller\welcome",false)) { // echo "here. (" . __file__ . ":" . __line__ . ")\n"; } else { //class definition... } the answer turned out have change controller prefix in config file following: 'controller_prefix' => 'controller\\', which written in documentation. (silly me)

How to get device token id of windows phone for push notification? -

i creating windows phone 8 app in phone gap + mobile jquery using visual studio 2012. want device token id device push notifications. can guide me how can device token id of windows phone 8? you can use deviceextendedproperties - byte[] mydeviceid = (byte[])microsoft.phone.info.deviceextendedproperties.getvalue("deviceuniqueid"); string idasstring = convert.tobase64string(mydeviceid);

file upload link in drop down - HTML -

i need html code drop down button, have link file-upload , open file upload box. have html code below, it's not working. whats problem ? <html> <script type='text/javascript'src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js?ver=1.4.2"></script> <link rel="stylesheet" href="ssssssss.css"> <body> <select id="uploadfile"> <option value="1"></option> <option value="2"><input type="file" name="something" id="fileuploadfield" />file</option> </select> <script type="text/javascript"> $('#fileuploadfield').click(function(e){ $('#fileuploadfield').click(); e.preventdefault(); }); </script> </body> </html> you cant add html code in option item (cf: http://www.w3schools.com/tags/tag_option.asp ). what have create drop down menu css (cf:...

c# - Click event for ItemTemplate inside asp:GridView -

i have gridview following markup: <asp:gridview id="gdvresxkeyvalue" runat="server" width="100%" > <columns> <asp:templatefield> <itemtemplate> <asp:image id="imgeditresxvalue" cssclass="sfedit" runat="server" imageurl="~/administrator/templates/default/images/imgedit.png" /> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> i need have handler image click event. there easier way so? you can use image button instead of image. try code. <asp:gridview id="gdvresxkeyvalue" runat="server" width="100%" > <columns> <asp:templatefield> <itemtemplate> <asp...

ios - How to properly position a UITableView cell subview to the right? -

Image
so i'm trying add uiswitch table cells on right. first tried adding accesoryview , when entered editing mode in table, uiswitch dissapeared. added contentview , working great, no dissapearing. adds top left corner. so i'm trying add right want stay away of absolute values in order support sizes , orientations. so i'm trying code: [[cell contentview] addsubview:switchview]; switchview.frame = cgrectmake(cell.contentview.frame.size.width - switchview.frame.size.width, 0, switchview.frame.size.width, switchview.frame.size.height); but i'm getting: any ideas how can fix this? you need set appropriate autoresizing masks or layout constraints on switch. if you're using springs , struts, want switch have flexible left margin only. keep fixed distance right hand edge of superview - content view resized between adding sw...

ruby on rails - Multiple rails_admin -

how configure rails_admin multiple admins. how create multiple admins using rails_admin gem.i created single admin rails application.i don't know how create , configure admin. please find below steps create new admin user. go terminal project folder resides run following command $rails console you following console this 1.9.3-p448 :001 > run following create statement on console admin = adminuser.create! |u| u.email = 'sample@sample.com' u.password = 'password' u.password_confirmation = 'password' end you can specify email , password here this create new admin user rails_admin

How to find a string in a text file, Python -

how number of times 2 characters used in text files, (e.g. ('hi')) , how print sum out int? i tried doing this: for line in open('test.txt'): ly = line.split() in ly: = i.count('ly') print(sum(a)) but failed, in advance! your program fails because variable a integer , cannot apply sum function integer. several examples have been presented. here mine: with open("test.txt") fp: = fp.read().count('ly') print(a)

Get custom category name or id on archive.php page Wordpress -

how can "fetch" custom category name or id on archive.php page. when i'm on page template, how can know custom category posts showing? use get_queried_object(); retrieve currently-queried object. in taxonomy term case: //custom taxonomy project_type, custom term web-design $obj = get_queried_object(); echo '<pre>'; print_r( $obj ); echo '</pre>'; displays following: stdclass object ( [term_id] => 56 [name] => web design [slug] => web-design [term_group] => 0 [term_taxonomy_id] => 56 [taxonomy] => project_type [description] => lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaec...

Echo to file with batch programing -

i want learn echo file, batch programing. my batch : @echo off echo hello world > c:\text.txt text.txt result : hello world it seccessfully but if batch file (added '"'): @echo off echo hello '"' world > c:\text.txt result : microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users>echo hello '"' world > c:\text.txt hello '"' world > c:\text.txt why text.txt not created? you should escape single double quote: echo hello '^"' world>test.txt otherwise echo parser waiting closing double quote , > redirection remains escaped quote.

java - Interface implicit mechanism -

in java example thread can created using either implementing runnable or extending thread class. understand extending class implementing interface how jvm decide attach it. such implementation purely implicit mechanism or missing here. edit: same concept while create objects map map=new hashmap() , how maintain containing hashmap object. info stored in object or reference. how jvm looks @ it? is such implementation purely implicit mechanism or missing here. a thread not implicitly created act of implementing runnable . instance of such object must explicitly passed thread constructor: new thread(myrunnable); clearly, thread instance break no sweat figuring out runnable call.

Webservices engine is not started when deploying SOAP web service in Glassfish 4 -

i learning soap web services , have written simple dynamic web app plain old java class annotated @webservice , @webmethod when application deployed glassfish 4, "web" engine showing , not "webservice". hence unable access tester page or link wsdl. have checked out this similar question , proposed answer did not me, have checked , have full glassfish profile installed. i have tried redeploying multiple times , tested on both windows , osx systems equivalent setups , still encountering same issue. using eclipse kepler. have installed latest glassfish update. hoping has found solution problem. i had same problem, in case had used jax-ws 2.2.6 inside libraries produced unstable behavior. don't use jax-ws if using jdk 7, don´t use else natives jax-ws. took me days of work find out... if not exact solution you, should try change libraries (other jar files)... 1 one... lucky!

objective c - Base64 string encoded with NSJSONSerialization is backslash escaped -

i'm trying send image server using json. data still correct until set dictionary encode nsjsonserialization: function use: - (nsdata*) gethttpbody { if ([nsjsonserialization isvalidjsonobject:jsonmessage]) { nserror * error = nil; nsdata * jsondata = [nsjsonserialization datawithjsonobject:jsonmessage options:0 error:&error]; nsstring *jsonstring = [[nsstring alloc] initwithdata:jsondata encoding:nsutf8stringencoding]; return jsondata; } return nil; } with following input: printing description of self->jsonmessage: { function = addattachment; variables = { attachment = { enddate = 1377475200000; file = "/9j/4aaqskzjrgabaqaaaqabaad/4qbyrxhpzgaatu0akgaaaagaagesaamaaaabaaeaaidpaaqaaaabaaaajgaaaaaaa6abaamaaaabaaeaakacaaqaaaabaaaaekadaaqaaaabaaaaeaaaaad/2wbdaaebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqebaqh/2wbdaqebaqebaqebaqebaq...

java - Using Ghost4j with MaxProcessCount on a tomcat causes jna error -

i'm trying develop web-service (based on jersey) converting pdf document jpeg images. choosed ghostscript because have experiences , it's results (especially embedet fonts). searched way use ghostscript java , found ghost4j. so put ghost4j jars applications lib folder (also jna.jar). in first tests encountered problem executing task more once, because jna throws error when it's launched more 1 time. put jna.jar tomcat lib folder. worked littlebit better, executed 1 task @ time. if started 1 @ same time, nothing happened. didn't seem execute other task. so tried setmaxprocesscount(2); allow application execute more 1 task @ time. here code: private static void generateimages(string inputfile, string outputpath) throws ioexception, rendererexception, org.ghost4j.document.documentexception { pdfdocument document = new pdfdocument(); document.load(new file(inputfile)); simplerenderer renderer = new simplerenderer(); renderer.setmax...

C++ network sockets, SCTP and packet size -

i'm developing server using connection-oriented sctp serve small number of clients. after finishing first prototype naive implementation, i'm profiling application optimize. turns out, 1 of 2 main consumers of cpu time networking part. there 2 questions efficiency of application-level protocol have implemented: 1) packet size currently, use maximum packet size of 64 bytes. can find many posts discussing packet sizes big, can small? sctp allows me read 1 packet @ time - upd - while guaranteeing in-order delivery - tcp - simplified implementation significantly. however, if understand correctly, cost 1 syscall each , every time send packet. amount of syscalls have significant impact on performance? able shave off lot of cpu cycles sending messages in bunches in bigger packets, i.e. 1024 - 8192 bytes? 2) reading , writing buffers i'm using memcpy move data , out of application-level network buffers. found many conflicting posts more efficient, memcpy or normal ass...

html - Can't override the opacity value? -

Image
i have fixed div overlay (whole screen) contain smaller centered div message. the big div has position:fixed , opacity. the inner div has position:fixed without opacity but in inner div , don't want have transparency.( opacity: 1 ) : problem: i still see transparent. how can fix ( inner div) ? the inner div background-color black. , color red. , (as can see) not happening. ( tried !important) full jsbin nb the overlay div , inner div should not scrolled when user scrolls. you make background color transparant using background-color: rgba(0,0,0,0.5)

Elasticsearch Prefix query not working on nested documents -

i'm using prefix query elasticsearch query. works fine when using on top-level data, once applied nested data there no results returned. data try query looks follows: here prefix query works fine: query: { "query": { "prefix" : { "duration": "7"} } } result: { "took": 25, ... }, "hits": { "total": 6, "max_score": 1, "hits": [ { "_index": "itemresults", "_type": "itemresult", "_id": "item_result_7c8649c2-6cb0-487e-bb3c-c4bf0ad28a90_8bce0a3f-f951-4a01-94b5-b55dea1a2752_7c965241-ad0a-4a83-a400-0be84daab0a9_61", "_score": 1, "_source": { "score": 1, "studentid": "61", "timestamp": 1377399320017, "groupidentifiers": {}, "asses...

java - Not able to print GC details -

i trying print gc details test program in eclipse.i want set program went run>run configurations , in vm arguments gave this: -xms1024m -xmx1024m –xx:+printgcdetails –xx:+printgctimestamps however when , run program following error: java.lang.noclassdeffounderror: –xx:+printgcdetails caused by: java.lang.classnotfoundexception: –xx:+printgcdetails @ java.net.urlclassloader$1.run(urlclassloader.java:200) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:188) @ java.lang.classloader.loadclass(classloader.java:307) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:301) @ java.lang.classloader.loadclass(classloader.java:252) @ java.lang.classloader.loadclassinternal(classloader.java:320) what doing wrong in passing arguments. what should tip off error message noclassdeffounderror: –xx:+printgcdetails - jvm isn't trying parse option class... then, @ dash...

php - Joomla 2.5 MVC Model prepareTable function -

while developing mvc component, i'm faced following problem: before saving posted data default.php, data should revised, if necessary. know far, protected function preparetable(&$table) in specific model should cover need. started simple approach, follows: protected function preparetable(&$table){ $table=$this->gettable(); $table->image="helloworld"; } my expectation is, after submitting template specific field in table has value "helloworld", isn't. perhaps, give me advice how handle preparetable() function? thank you if else setup correctly preparetable(&$table) method has table object passed it. generally preparetable() in class wouldn't gettable() , replace $table being passed in has row data bound it. replacing decouple work done. i remove line method looks like: protected function preparetable(&$table){ $table->image="helloworld"; } if @ simplest implementation of prepareta...

html - Why does bootstrap suggest do load scripts in body? -

scripts should included in <head> part learned w3c. why boostrap suggest load in <body> part seen here: http://getbootstrap.com/getting-started/#template scripts technically supposed loaded , executed @ placed in body. imagine browser reads html top bottom. if script include @ top of document, browser supposed idle while fetches script web server. a more detailed answer available at unobtrusive javascript: <script> @ top or bottom of html code?

mysql - Efficient SQL query to find overlap between lists -

let's have mysql table order_items (idorder, iditem, amount) contains items people ordered web shop. want find orders similar order x finding other orders similar items in similar amounts. here current approach: select sql_calc_found_rows sum(greatest(1, least(cown.amount, cother.amount))) hits, cother.`idorder` order_items cown left join order_items cother on ( cother.`idorder` != 1 , cown.iditem = cother.iditem ) cown.`idorder` = 1 , cother.idorder not null group cother.idorder asc order hits desc this selects items given order , left joins them items other orders. group other order id , sum amount of overlap between them. is there more efficient way this? it looks need recommendation engine. tricky implement in plain sql , not sure how reliable. starters have apache mahout project. there nice example mahout , mysql can try available on gi...

jquery - JqueryMobile radiobutton horizontal group does not render properly -

i'm trying programmatically create group of radio-buttons in jquerymobile. works fine except data-type='horizontal' property: as can see in this fiddle, "created-via-js" radio group not render properly, while other 1 (written directly html) works great. i'm following horizontal group example can find on this page this code: html <div id="container"></div> js for (var x = 0; x < 2; x++) { var rowlist1 = '<fieldset data-role="controlgroup" data-type="horizontal">' + '<legend>this not render properly..</legend>' + '<input name="radio-choice-h-2" id="radio-choice-h-2a" value="on" checked="checked" type="radio">' + '<label for="radio-choice-h-2a">one</label>' + '<input name="radio-choice-h-2" id="radio-choice-h-2b...

validation - Using jQuery validate rule twice for a field -

i'm trying validate input field holds user's date of birth, , need two checks - 1. make sure user 18 years old , 2. make sure his/her age isn't on 100. my custom validate method - $.validator.addmethod( "datediff", function(value, element, diff_years) { var curr_date = new date().getfullyear(); var element_date = date.parse($(element).val()).getfullyear(); return element_date >= curr_date - diff_years; } ); and here's how add rule. var validator = $('form').validate({ rules: { 'dob': {datediff: 18} }, messages: { dob: {datediff: 'you have 18 or more!'} } }); how reuse datediff rule twice, can both checks? tried appending datediff rule, didn't work. edit: need show 2 distinct messages - example - 1. "you have 18 or more" first condition, , "you cannot more 100" second. if need 2 unique messag...

Sencha Touch 2 App FieldSet not rendering -

Image
i developing sencha touch 2 app, using sdk version sencha-touch-gpl 2.2.1. facing peculiar issue, have navigation view, in first view list screen on itemdisclosure of individual item in list detail screen displayed. detail screen comprises of fieldset & list within panel. until yesterday app working fine. facing issue, 1) toolbar title not getting displayed, shows fraction of secs , disappears (no code change done , working fine day before). 2)the list screen displays properly, on itemdisclosure, in detail screen fieldset not getting displayed list in detail screen getting displayed fine. i populating detail screen record selected list item, use following code on itemdisclosure showdetail : function(list, record) { this.getmain().push({ xtype : 'ticketdetail', data : record, }); record holds value, have checked via printing ticketid on console. i have tried following things, cleared browser cache generated ...

twitter bootstrap - How to achieve Rails close button -

Image
i'm have close button on rails application messages. i've read integrating rails flash messages twitter bootstrap, i'm stuck. this kind of messages bootstrap alerts . check bootstrap documentation, , in rails make sure have app integrated boottrap. in order integrate flash messages bootstrap i'll suggest follow this approach : create partial _flash_messages.html.erb <% flash.each |type, message| %> <div class="alert <%= bootstrap_class_for(type) %> fade in"> <button class="close" data-dismiss="alert">×</button> <%= message %> </div> <% end %> then in application.html.erb add: <%= render partial: "shared/flash_messages", flash: flash %> in application_helper.rb : module applicationhelper def bootstrap_class_for flash_type case flash_type when :success "alert-success" when :error "alert...

forms - jQuery Submit Post Data Not Changing -

i'm checking data in form jquery. however, while incoming data in form having trouble. not refreshing data in following code $("#registerform").submit(function () { $.post("dogrula.php", $("#registerform").serialize(), function (data) { var hata = data; if (hata == "wrong number") { alert("yanlış"); return false; } }); return false; }); the full code <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function () { $("#bd_year").focusout(function () { $.post("dogrula.php", $("#registerform").serialize(), function (data) { $("#charnum").text(data).css({ "color": "green", "font-size": "120%...

node.js - How to get notifications on database column changes -

i using mysql-client library mysql on node.js server. looking library in node.js sever run continously , watch on mysql table column , send notifications when changes occour in table column; can please name libray looking for. thanks in advance use sql service broker. subscribe query, when table updated server sends notification of change you. read this great article edit: nevermind, didn't read question thoroughly enough. sorry! - leaving answer else reads wrong , thinks c# :)

android - Get web page content (with json array) -

i trying web page content (i have in page json array), , can not find way it, evry code found in google dont work , crash application.. i need help! thanks! take here: https://code.google.com/p/android-query/ this library allows (can many things) take json specific url in simple way. know quite , never had problems. i'll show example: json on page { "account":{ "username":"nirbe" } } myactivity.java public class myactivity extends activity { private aquery aquery; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.my_activity); // first of all, create new aquery object aquery = new aquery(this); // ajax call aquery.ajax("http://www.nirberko.info/android/index.php", jsonobject.class, new ajaxcallback<jsonobject>() { @override public void callback(string url, jsonobject json, ajaxstatu...

android - Get which locales have their own values folder -

i'm implementing multiple language support application. in default values folder have strings english locale. have folder swedish values-sv . want let user able choose locale manually, need display list supported languages. is there way locales supported(have own values folder)? so far have: string[] languages = getresources().getassets().getlocales(); but returns languages supported android version not make sense show long list. need languages supported application. well in can show spinner/dialog chooser user items of supported languages have , can tell app resources have select suppose if have spanish , englih language: show spinner values i.e: spanish,english upon user selected value set locale spanish or either english

java - Horizontal Scrol & different size of images in gridview of android like Windows8 App Tiles -

Image
i have tried android:scrollbars="horizontal" property not working when increse number of columns 4 10 not show scrolbar disarrange images overlap each other. there anyway slides images in horizontal instead of vertical , how can use multiple size of images in grid this when set column number 4 looks when increase column numbers column number 10 activity_main.xml code: <gridview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:columnwidth="150dp" android:numcolumns="auto_fit" android:verticalspacing="10dp" android:horizontalspacing="10dp" android:gravity="center" android:background="@drawable/background" android:scrollbars="horizontal" /> mainactivity.java package com.example.hel...

nhibernate - Ruling out NHiberate mappings causing deletion of entity -

i have nhibernate issue update entity , causes deletion of entity. set of entities , related mappings large replicate here wanted create sample data in order discuss issue. in cut out example imagine updating d results in deletion of a . q: fair impossible mapping issue given mapping files related a ie (bmappingfile & cmappingfile) have mapping a set .cascade.none() or there other nhib config/mapping related setting should aware of achieve behaviour? db tables a aid | aname b bid | bname | aid c cid | cname | aid d did | dname | cid and set of corresponding mapping files along lines of amappingfile public amap() { table("[dbo].[a]"); lazyload(); cache.readwrite().includeall(); id(x=>x.aid) .access.camelcasefield(prefix.underscore) .column("[aid]") .generatedby.identity(); hasmany(x=>x.bs) .access.camelcasefield(prefix.underscore) .cascade.alldeleteorphan() .fetch.select() ...

c# - Performance. Is it useful to define my own exception types? -

for example, have dll ( helper.dll ) contains methods working external system through provider library ( provider.dll ). provider.dll defines systemisdownexception , re-throw in helper.dll . also, have dll ( service.dll ) uses helper.dll , tons of others, must catch different types of exceptions , process them somehow. question is: affect performance if catch systemisdownexception (from provider.dll ) in service.dll ? or should define own exception types each exception provider.dll in helper.dll ? sorry long question. do must in logical terms, , don't care performance. do not design exception types based in performance considerations. create them if find them meaningful , helpful helpfulness , clarity of library.

c# - How to use different databases bewteen local and cloud execution -

i have asp.net mvc4 solution deploy on azure. solution connects sql database. i know if solution can configured that, when run on local machine (i.e. while developping/debuging) uses local database, , when it's run in cloud (i.e. on azure) uses the cloud database . i know sort of configuration possible storage account (blob, queue) connection strings, far haven't been able find equivalent databases connection string. thanks willing me that. you have configure web.config file set right connection string. local database need : <add name="defaultconnection" connectionstring="data source=(localdb)\v11.0;initial catalog=mydb;integrated security=sspi;attachdbfilename=|datadirectory|\mydbmdf" providername="system.data.sqlclient" /> then add web.release.config file use transformation statement change connection string, that. <connectionstrings> <add name="defaultconnection" connectionstring="...

sql - Error calling CREATE_JOB -

i have following error in pl/sql. not able know error is. please me. sql> begin 2 dbms_scheduler.create_job 3 ( 4 job_name => 'testingfile' 5 ,comments =>'test' 6 ); 7 end; 8 / dbms_scheduler.create_job * error @ line 2: ora-06550: line 2, column 1: pls-00306: wrong number or types of arguments in call 'create_job' ora-06550: line 2, column 1: pl/sql: statement ignored according dbms_scheduler.create_job documentation , procedure requires job_name , job_type , job_action parameters. you've specified job_name need define other two. you can find dbms_scheduler.create_job examples here , here , , elsewhere.

Jquery under png image mouse move? -

my problem link sample link one image puzzle, second image earth, i'am rotateable, dragable, , resize earth it's worked front of puzzle, sample image puzzle,front of earth i'am not touch earth, dragable or rotateable... how's solution problem want move earth, front of puzzle image... please help.. you didn't compatibility required, might you <div style="position:absolute;width:430px;min-height:320px;z-index:2;background:url(images/15b.png);pointer-events:none"> </div> check link see browsers support.

Using MATLAB to find multi-day 90th percentile temperature exceedences -

i working on project i'm trying find multi-day events temperature exceeds 90th percentile. i'm using 61 years of data , trying calculate percentiles based on each month between june-august. in other words, using prctile function, calculate 90th percentile june, july, , august , compare each month's daily temperature values based on 90th percentile value month. ultimately, want program find strings of days (2-day, 3-day, 4-day, 5-day, etc.) temperature exceeds 90th percentile value, based on month's value. below code have far: fprintf('loading data...\n') load file_name.txt year=file_name(:,1); month=file_name(:,2); day=file_name(:,3); temax=file_name(:,6); temin=file_name(:,9); molen=[30 31 31]; y=1:61 m=6:8 k=1:molen g1=find(year==y+1950&month==m&day==k&temax>-99); g2=find(year==y+1950&month==m&day==k&temin>-99); end ...

How do I tell solr where my document collection is? -

my sysadmin installed solr here: /software/packages/solr-4.3.1/ followed tutorial (using jetty) successfully. have working installation , things work expected. also, using solarium , can query example/collection1 document set website. now want create own document set live outsite of /software/packages/solr-4.3.1/ still use instance of solr lives in /software/packages/solr-4.3.1/ . copied on example directory /path/to/mydocs . tried go through tutorial again new location. no dice. how tell solr document collection is? assuming you're running in multicore mode (where single solr service can host multiple cores/indexes), assume you'd use solr.xml file store relative instancedir path. so <core> element like: <core name="mycore" instancedir="/path/to/mydocs" /> this place data , config files in specified directory

unix - filtering file from the result of find command -

i want particular pattern in directory of files , want exclude patterns while result displayed. i use following command find . -type f -exec grep -il 'foo' {} \; | find . -not -name "*.jar" -not -name "*.gz" -not -name "*.log" 2>/dev/null when result displayed, see following error message find: grep terminated signal 13 can please guide me why error message there , if there better command use getting desired result (basically excluding jar files or log files or other type of files result set)? i think you're trying use find grep in second half of pipeline; find doesn't work that. should have in 1 command: find . -type f -not -name "*.jar" -not -name "*.gz" -not -name "*.log" -exec grep -il 'foo' + 2>/dev/null or find . -type f -not -name "*.jar" -not -name "*.gz" -not -name "*.log" -exec grep -qi 'foo' \; -print 2>/dev/null ...

mysqli - Double INNER JOIN and SUM -

table pckeyword kwid | keyword table prophrase kwid | vote table contraphrase kwid | vote so vote column integer , want sum specified keyword this: examplekeyword | 12 | 47 til have doesnt work correctly: select pckeyword.kwid, pckeyword.keyword, sum( prophrase.vote ) provotes, sum( contraphrase.vote ) contravotes pckeyword inner join prophrase on prophrase.kwid = pckeyword.kwid inner join contraphrase on contraphrase.kwid = prophrase.kwid group pckeyword.keyword order pckeyword.keyword asc you try: select kwid, keyword, provotes, contravotes pckeyword inner join ( select kwid pid, sum( vote ) provotes prophrase group kwid ) p on pid = kwid inner join ( select kwid cid, sum( vote ) contravotes contraphrase group kwid ) c on cid = kwid this way grouping once in derived tables , not often! (by separating tables derived tables tidy whole syntax, since column names unique within each derived table expression.) see here: ht...

java - What color blending algorithm is used to darken a color? -

Image
i have these cards have 2 color shades on them. main color, , darker accent color: the main color given me in hex, not accent. can tell kind of blend or transformation being done argb of main color darker accent color? if matters, i'm developing against android i've got access color class , colorfilter can apply porterduff stuff... if want darker color , can: convert rgb hsv rgbtohsv() . reduce v (lightness value). it's hsv[2] , float value 0 1. convert hsv color hsvtocolor() . if want darker bitmap , porterduff.mode.darken should work. need calibrate color value: private bitmap getdarkerbitmap(bitmap src) { final int color = 0xaaffffff; final int width = src.getwidth(); final int height = src.getheight(); final bitmap result = bitmap.createbitmap(width, height, src.getconfig()); final bitmapdrawable drawable = new bitmapdrawable(src); drawable.setbounds(0, 0, width, height); drawable.setcolorfilter(color, porte...

c# - Filter users by attribute -

this gives list of userprincipals our activedirectory users in group "x": var domaincontext = new principalcontext(contexttype.domain); var groupprincipal = groupprincipal.findbyidentity(domaincontext, identitytype.samaccountname, "x"); now how filter users in list custom attribute? users have entry in custom property "building", , want list contain users building. solution stupid me ... cast members groupprincipal directoryentry, access properties .. foreach (var member in groupprincipal.members) { // maybe try-catch .. system.directoryservices.directoryentry = (system.directoryservices.directoryentry)member.getunderlyingobject(); if (i.properties["building"].value.tostring() == "nsa hq") { // stuff here } } yes, may use member.getunderlyingobject() var members = groupprincipal.members.where(member=>(member.g...

ios - Dynamic Nested or MultiDimensional Array -

i wanted implement nested nsmutablearray in xml data. array structures this, nsmutablearray *subarray = [nsmutablearray arraywithobjects: sub_name, sub_desc, sub_imagelink, nil]; nsmutablearray *myarray= [nsmutablearray arraywithobjects: [nsmutablearray arraywithobjects: (nsstring *)name, (nsstring *)desc, (nsstring *)imagelink, subarray,nil], [nsmutablearray arraywithobjects: (nsstring *)name, (nsstring *)desc, (nsstring *)imagelink, subarray,nil], [nsmutablearray arraywithobjects: (nsstring *)name, (nsstring *)desc, (nsstring *)imagelink, subarray,nil], nil]; the xml this, <category> <name>drinks</name> <description>drink description</description> <image> link here </image> <sub_cat> <sub_name>sub name of drink</sub_name> <sub_desc>sub description of drink</sub_d...

javascript - jquery ajax request success portion not working -

i having ajax request success portion not working have been working past 1 hour not able there thing missing. $.ajax({ url: "ajaxsearch", type: 'post', datatype: "jsonp", headers: { 'accept': 'application/json', 'content-type': 'application/json' }, data: json.stringify(eval({ name_startswith: request.term })), success: function (data) { alert("yoo"); //what ever write not executed thing wrong } }); i suggest first try make jquery ajax working simple code modification. can try below code snippet: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> <script type="text/javascript...

scala - How can I serialize case classes to tab delimited text files? -

i have list contains case classes of same type, looking best practice in persisting text file tab delimited case class mycase1 (x: int, y:int , name:string) val item1 = new mycase1(1,2,"item1") val item2 = new mycase1(3,4,"item2") val item3 = new mycase1(5,6,"item3") val mylist = list (item1,item2,item3) what best way write above data structure file ? there such thing : mylist.tofile(delimiter="\t") because case class product , can use productiterator method fields in order defined in iterator. can use , map list of mycase1 list of string , use write file. simplified example this: case class mycase1 (x: int, y:int , name:string) val item1 = new mycase1(1,2,"item1") val item2 = new mycase1(3,4,"item2") val item3 = new mycase1(5,6,"item3") val mylist = list (item1,item2,item3) val out = new printwriter(new filewriter(pathtomyfile)) try{ mylist.map(_.productiterator.mk...

javascript - Spring submit has double parameter -

i new spring web applications. when submit form, request mapping getting "dual" parameter. form set as: <form action="" method="post" name="myform"> ...... </form> i use javascript submit form, example, when submit form going various pages, javascript this: function gotopage(pagenumber) { document.forms['myform'].action="trx?page=" + pagenumber; document.forms['myform'].submit(); } so when have link on jsp page, <a href="javascript:gotopage('3')">page number: 3</a> on controller request mapping /trx, should getting parameter page value "3", getting value "3,3". any ideas why? noticed on page parameter, if use parameters action=search or action=sort. works out fine. dumb question. :) had <select name="page"> in form.

Array length in Javascript chrome error -

i have strange problem js console in chrome, if go in chrome console , write : var numero = new array(["/php/.svn/tmp", "/php/.svn/props"]); return me "undefined" think numero array 2 elements, if write: numero returns: [array[2]] after numero.length and return 1 ..... why? don't return 2 ??? doing wrong? can give method returns 2? in advance edit: explain problem. have function return when selected 2 items : myfolders.getselected() ["/php/.svn", "/php/upload.php"] and when selected 1 items: myfolders.getselected() "/php/upload.php" as u note second 1 isn't array. now use method activate on change selected item calculate global variable: function calcolonumeroelementi(){ var numero = new array(myfolders.getselected()); numeroelementiselezionati = numero[0].length; } but returns 1 or number of characters when selected 1 items. don't use new array, use literal not...