Posts

Showing posts from September, 2013

uinavigationcontroller - iOS Programatically Drill Down Navigation Stack -

uinavigationcontroller - iOS Programatically Drill Down Navigation Stack - i posted question before today regarding reacting receipt of force notification, whereby needed drill downwards 1 view another. question answered, have moved on requirement reacting force notifications, whereby need drill downwards 3rd level in navigation stack. below mockup of view hierarchy, on receipt of force notification want drill downwards view titles "third view". from reply previous question, able drill downwards "second view", when seek perform segue force "third view" on stack, same type of error per previous question: terminating app due uncaught exception 'nsgenericexception', reason: 'could not find navigation controller segue 'admin'. force segues can used when source controller managed instance of uinavigationcontroller.' in appdelegate, when receive notification select required tab then: uinavigationcontrol...

Wordpress: Separate meta fields vs single array field -

Wordpress: Separate meta fields vs single array field - i have 200 fields in single post. wondering if set them 1 single field array or multiple fields. single array has lot of work done getting value unlike separate fields. advisable big site? it depend on management requirements too. if person editing custom field huge array in they'd need technical knowledge. if management isn't of import you're improve off storing info in 1 field cut down number of times you'll firing get_post_meta() function. code much faster if parse value array , work it. alternatively, if you'll need little number of these values improve run get_post_meta() couple times retrieve , work entire array. you can test both scenarios using this method. arrays wordpress multidimensional-array field metadata

python - Trying to find follower count in Instagram API -

python - Trying to find follower count in Instagram API - i looking find follower count particular user much if using instagram api console: from instagram.client import instagramapi access_token = "access token" api = instagramapi(access_token=access_token) user_info = api.user(user_id) print user_info what getting api console when search user_id { "meta": { "code": 200 }, "data": { "username": "igname", "bio": "comments, "website": "http://instagram, "profile_picture": "picture", "full_name": "igrealname", "counts": { "media": number1, "followed_by": number2, "follows": number3 }, "id": "iguserid" } i looking username, follows, , followed fields output python. all getting username , it. ...

f# - WPF window will not open after adding namespace -

f# - WPF window will not open after adding namespace - so have simple f# wpf application. working fine without declaring namespace , using multiple modules. now, still compiles, nothing. nil in debug show either. this current code not work. namespace flow module mainapp = open scheme open system.windows allow app1 = new application() [<stathread>] app1.run(new main.mainwindow()) |>ignore before worked when this module mainapp open scheme open system.windows allow app1 = new application() [<stathread>] app1.run(new main.mainwindow()) |>ignore i can show definition of mainwindow, long, class inherits window. allow me know if help. or if there other info give help issue. your original code relies on implicit entry point: "when programme has no entrypoint attribute explicitly indicates entry point, top level bindings in lastly file compiled used entry point." you can either define function...

php - preparing ZF2 query for a particular mysql query -

php - preparing ZF2 query for a particular mysql query - how can prepare zf2 query bellow mysql query select (select category_name categories category_id = c.parent_id) category_name ebook e bring together ebook_categories ec on ec.ebook_id = e.ebook_id bring together categories c on c.category_id = ec.category_id e.is_active = 1 grouping category_name you can using tablegateway in zf2. example: public function fetchallwithlikes( $user_id ) { $adapter = $this->getadapter(); $resultset = $this->select( function( select $select ) utilize ( $user_id, $adapter ) { $sub1 = new select( 'likes' ); $sub1->columns( array( 'total' => new expression('count(*)') ) ) ->where( array( 'id' => new expression( 'song_id' ) ) ); $sub2 = new select( 'likes' ); $sub2->columns( array( 'total' => new expression('count(*)') ) ) ->where( array( 'id' => n...

java - How to print text messages on jtextarea from a different class -

java - How to print text messages on jtextarea from a different class - i created console based programme allowed users take math quiz. programme generated random numbers , determined if reply right or wrong. now, i'm trying create gui version of programme , i'm stuck. i want print text messages in jtextarea different class. i've used , set methods, reason doesn't output text messages. i've done research on swing workers have no thought how work i'm trying avoid using if possible. this not homework assignment. started learning java 4 months ago may not understand advance concepts. i guess want know... have utilize swing workers? want generate random numbers , output result in jtextarea... shouldn't freeze gui, right? anyway, in advance. class="snippet-code-js lang-js prettyprint-override"> package algorithmsprogramgui.view; import java.awt.eventqueue; import javax.swing.jframe; import javax.swing.jpanel; impo...

java - generic array with wildcard cause error -

java - generic array with wildcard cause error - i wanted create jcombobox´s type string, having in array, used wildcard array , string single elements: jcombobox<?>[] combos=new jcombobox<?>[10]; ... combos[i]=new jcombobox<string>(); same defaultcomboboxmodels: defaultcomboboxmodel<?>[] combomodels=new defaultcomboboxmodel<?>[10]; ... combomodels[i]=new defaultcomboboxmodel<string>(); assigning them each other: ... combos[i].setmodel(combomodels[i]); now gives compiler error (capture#13-of ? not applicable capture#14-of ?). have expected single elements set string , everything´s fine. what´s about, how deal it? (except of doing raw) java needs ensure, model , combo of same type. on given example, 1 time types gone after erasure, there no way this. set model<integer> combo<string> such way. java arrays generics

sql - Indexed view's indexes are disabling when I rebuild ALL indexes in one of the view's parent tables? -

sql - Indexed view's indexes are disabling when I rebuild ALL indexes in one of the view's parent tables? - i have indexed view ends it's primary key , other indexes disabled after rebuild indexes in 1 of view's parent tables ? the table rebuild on main table in indexed view ?? any suggestions please - has me baffled. i have increased disk space of actual storage space not problem ? sql sql-server

junit4 - JUnit - invoke a test method without testing it -

junit4 - JUnit - invoke a test method without testing it - soft ball here. short question you. suppose have 2 methods @test public void methoda() {//do something} @test public void methodb() {//do something} is possible invoke methoda methodb without execute 1 time again test on method a ? if not, how can factorize code should tested @ to the lowest degree 1 time (ie methoda shold tested once)? if possible, assertx evaluated again? extract parts of methoda that should used methodb . @test public void methoda() { commoncode(); //do } @test public void methodb() { commoncode(); //do } private void commoncode() { //do } junit junit4

php - mysql query yii not getting value -

php - mysql query yii not getting value - i have issue gettin' value query: public static function sa() { $resul = yii::app()->db->createcommand()->select('max(id)')->from('yii_availability')->execute(); $got = mysql_query($result); $res = $got['max(id)'] + 1; $rs='sa'.$res; homecoming "{$rs}"; } it homecoming sa1, want lastly id , after plus 1 in case have next autoincremental id id column. for example: creating new registry field sa0000005. number calculated getting lastly autoincremental value plus 1. thanks valuable help $resul = yii::app()->db->createcommand()->select('max(id)')->from('yii_availability')->execute(); $got = mysql_query($result); // doing here apart typos, that's not how supposed utilize query builder. have read the documentation on query builder? the probable reason why sa1, because $got['max(id)'] look null. add togethe...

java - How does SwingUtilies.invokeLater(new Runnable()) really work? -

java - How does SwingUtilies.invokeLater(new Runnable()) really work? - as far know method swingutilies.invokelater(new runnable()) used forcefulness edt jobs defined in runnable - object , how 1 can imagine this? run() method in runnable - object used execute java stuff in new thread, not here, because here runnable - object invokes edt? runnable interface single method run(). having access runnable object can phone call method. threads this. edt this. executors this. programme can so. convention. other software can utilize different convention, say, executorservice can phone call callable objects. internally, edt has own run method which, in loop, extracts runnable objects queue , calls run() method. java multithreading

php - View single post from list of posts in certain category Wordpress -

php - View single post from list of posts in certain category Wordpress - i've got script generates posts have particular category tag (see below). <?php function create_slug($string){ $slug=preg_replace('/[^a-za-z0-9-]+/', '-', $string); homecoming $slug; } $category = strtolower(create_slug(single_cat_title('', false))); $args = array( 'post_type' => 'research-case', 'orderby' => 'date', 'order' => 'desc', 'posts_per_page' => 6, 'category_name' => $category ); query_posts($args); ?> <?php while ( have_posts() ) : the_post(); ?> <hr /> <article c...

php - xCode can't connect to localhost after xcode 6.1 update -

php - xCode can't connect to localhost after xcode 6.1 update - my app makes utilize of php backend api (in laravel) (and app uses standard php, not framework). i had xcode 6.0 , apps connected server fine, upgraded 6.1, , no app have connect server. error gives is: the requested url not found on server. this frustrating. the next url: var url: string = "http://localhost/laravel/myproject/public/" and in browser: so can see, works fine in browser. here connection script: var post:nsstring = "username=\(globalvars.sharedinstance.getusername())&&lat=\(lat)&&long=\(lng)" var url:nsurl = nsurl(fileurlwithpath: "\(globalvars.sharedinstance.geturl())login")! var postdata:nsdata = post.datausingencoding(nsasciistringencoding)! if want communicate http server should utilize nsurl(string:) instead of nsurl(fileurlwithpath:) . create file url unusual name. e.g.: var url:nsurl = nsurl(string:...

java - Please help me understand why my code doesn't work -

java - Please help me understand why my code doesn't work - this question has reply here: how compare strings in java? 23 answers this class test see if 2 methods (the "endfinder"s) working (unfortunately not). endfinder() meant homecoming index of next non space character in provided string; endfinder2() meant homecoming endpoint of word starting index found endfinder. they're meant used pull out words string multiple words separated spaces. i've gone on few hours , there must obvious reply sense i'm going insane. i've removed of outputs used test code in many attempts figure out wrong create cleaner. basically, i've found endfinder() returns 0 reason , endfinder2() runs until reaches break (i assume that's happens used loop infinitely before added in). the result want start = 3, end = 6 create output "[one]"...

runtime - generate web.config at run time - sitecore -

runtime - generate web.config at run time - sitecore - i integrated active directory sitecore , works perfect, trying write patches config changes. sections <membership defaultprovider="sitecore" hashalgorithmtype="sha1"> , <rolemanager defaultprovider="sitecore" enabled="true"> changed connection setting ad. when seek write config patch section, section not built @ run time. domains section works, mean patch created section works , writes web.config @ runtime. observed difference here domains section under <sitecore>, <membership> , <rolemanager > in <system.web> section. reason these not included in web.config? can write patches sections under <sitecore>? any ideas appreciated. thanks. you can patch elements within /configuration/sitecore element. refer post: http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2011/05/all-about-web-config-include-fil...

java - Finding Substring from a String -

java - Finding Substring from a String - i have next string : test: testid #123123 - updated i want find substring 123123 string. i tried : <msg>.substring(15, 21); gives me right result. but want find substring in way should find id between # , next space without giving origin , ending index. thanks. try this: s.substring(s.indexof("#")+1, s.indexof(" ", s.indexof("#")+1)) this gives string starting char after # until next blank. java string substring

xcode6 - Strange messages from gems after switching to Xcode 6 and Yosemite -

xcode6 - Strange messages from gems after switching to Xcode 6 and Yosemite - i switched xcode 6 , yosemite. now, when run gems next messages. i've seen other questions on here same error message, none of them seem match this. is due known alter in dev environment? need reinstall gems? $ mygem start ignoring bigdecimal-1.2.5 because extensions not built. try: gem pristine bigdecimal-1.2.5 ignoring debase-0.0.9 because extensions not built. try: gem pristine debase-0.0.9 ignoring ffi-1.9.3 because extensions not built. try: gem pristine ffi-1.9.3 ignoring redcarpet-3.1.1 because extensions not built. try: gem pristine redcarpet-3.1.1 ignoring xcodeproj-0.17.0 because extensions not built. try: gem pristine xcodeproj-0.17.0 ignoring bigdecimal-1.2.5 because extensions not built. try: gem pristine bigdecimal-1.2.5 ignoring debase-0.0.9 because extensions not built. try: gem pristine debase-0.0.9 ignoring ffi-1.9.3 because extensions not built. try: gem pristine f...

frequency - Not counting spaces as words in c -

frequency - Not counting spaces as words in c - #include <stdlib.h> #include <stdio.h> int main() { unsigned long c; unsigned long line; unsigned long word; char ch; c = 0; line = 0; word = 0; while((ch = getchar()) != eof) { c ++; if (ch == '\n') { line ++; } if (ch == ' ' || ch == '\n' || ch =='\'') { word ++; } } printf( "%lu %lu %lu\n", c, word, line ); homecoming 0; } my programme works fine part, when add together spaces, counts spaces words. example, how you? counted 10 words, want count 3 words instead. how modify code work? this 1 possible solution: #include <stdlib.h> #include <stdio.h> int main() { unsigned long c; unsigned long line; unsigned long word; char ch; char lastch = -1; c = 0; line = 0; word = 0; ...

how to install magento using amazon web server -

how to install magento using amazon web server - i installed magento using cpanel. now have install magento using "amazon web server" there no cpanel in amazon web server. i not much familiar install magento using commands. please help me install magento using "amazon web server" thanks in advance. i assume have apache2 in amazon aws. when define vhosts in apache2 define root directory web applications. define root directory nginx server in nginx conf file. download required version of magento , unzip in web root directory. create virtual hosts , point magento directory. download magento sample database , restore in mysql. open in web browser , guide through installation. magento amazon-web-services installation

activerecord - after_find callback does not work properly -

activerecord - after_find callback does not work properly - i have rails 4.1.6 installed. model report : after_find :convert_decimal_to_float def convert_decimal_to_float self.mag = self.mag.to_f end in rails console: 2.1.2 :001 > r = report.last ... 2.1.2 :002 > r.mag => #<bigdecimal:5032730,'0.31e1',18(36)> but if utilize r.mag.to_f , works fine: 2.1.2 :003 > r.mag.to_f => 3.1 the question is, why doesn't after_find callback work here? your after_find callback working because database column of type decimal save bigdecimal. if column of type float if tried save bigdecimal number it, convert , save floating point number. without knowing why require conversion upon "finding" object, hard give advice appropriate workaround here couple of options: first option: you can create 2 columns in database. decimal column , float column. migration add_column('report','mag', :decimal,:...

sql server - SQL change DATEADD data type -

sql server - SQL change DATEADD data type - i trying round time column quarters, searched forum , found nice code: select dateadd(minute, datediff(minute, 0, getdate()) / 15 * 15, 0) the problem gives me time timestamp column, date 1900-01-01, while want time. can't find how this. you didn't specify version of sql server using. since sql server 2008 have had time info type (http://msdn.microsoft.com/en-us/library/bb677243(v=sql.100).aspx). select dateadd(mi, datediff(mi, 0, getdate()) / 15 * 15, 0) original_value , convert(time, dateadd(mi, datediff(mi, 0, getdate()) / 15 * 15, 0)) sql_2008_onwards , convert(char(10), dateadd(mi, datediff(mi, 0, getdate()) / 15 * 15, 0), 108) pre_sql_2008 with lastly option, final value still piece of text. ideally should convert in datetime value ( convert(datetime, <rest of code>) ) sql sql-server

jquery - Using DataTable FixedColumns and JEditable together -

jquery - Using DataTable FixedColumns and JEditable together - i'm posting question have never found solution while searching on internet, know others had had problem , wanted share solution. the problem beingness whenever utilize datatable's fixedcolumns plugin new $.fn.datatable.fixedcolumns(grid, { leftcolumns: 2, }); in conjunction jeditable find cannot edit frozen columns(ie here). sought provide solution explain in answer the solution can found here, explain below the problem exists because utilize of fixedcolumns creates 2 tables; 1 table, clone table(denoted class name dtfc_cloned , consists of columns wanted frozen. other table original table created. whenever seek edit, illustration uses inline editing, you're doing edit on original field not field created clone table. the solution came allowed editing on clone table, force updated results original table. achieved adding fndawcallback fixedcolumns initialization. ...

How do I print out something different at the last item of a loop, C programming -

How do I print out something different at the last item of a loop, C programming - please come in integer: 1234 digit: 4 digit: 3 digit: 2 digit: 1 i have programme right prints out integer's digits in reverse. instead of output above, i'd have: please come in integer: 1234 digit: 4 digit: 3 digit: 2 lastly digit: 1 how create happen? here's code way: #include <stdio.h> int main() { int input; printf("please come in integer: "); scanf("%d", &input); int num = input; int = 0; while(num > 0) { int remainder = num % 10; num = num /10; i++; printf("digit: %d\n", remainder ); } homecoming 0; } how print else @ lastly item of loop? testing see if while status fail 1 way. while (num > 0) { int remainder = num % 10; num = num / 10; i++; if (num > 0) { printf("digit: %d\n", remainder); } else { printf("last digit: %d\n...

.net - Simple Property Binding Not Working in XAML -

.net - Simple Property Binding Not Working in XAML - a simple info binding not working, not able figure went wrong although did mistakes: usercontrol xaml: <usercontrol x:class="purchasestockcontrol" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="300" d:designwidth="300"> <grid> <textbox text="{binding path=namee}" datacontext="me"/> </grid> </usercontrol> i want bind property namee: result "system.windows.data error: 40 : bindingexpression path error: 'namee' property not found on 'object' ...

javascript - Select all text on focus in numbers fields -

javascript - Select all text on focus in numbers fields - i have aspx text box class num_input . should allow numbers , automatically add together comma separator: $('.num_input').live("keyup", function () { $(this).numeric(); var num = $(this).val().replace(/(,)/g, ''); $(this).val(num.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")); }); we have new requirement select text when user navigates through others textbox using tab or placing cursor in text. i tried utilize $(this).select(); but didn't work!! jquery's select function isn't @ dedicated selecting text. if need that, this.selectionstart = 0; this.selectionend = this.value.length; you can define function letting select text of jquery element : $.fn.selecttext = function(){ this.each(function(){ this.selectionstart = 0; this.selectionend = this.value.length; }); } demonstration javascript jquery

android - Java code fix fast -

android - Java code fix fast - i'm making app webpage. code shows class enum or interface expected errors on many lines. please prepare code me - package ba.gamers.www.gamers; import android.content.context; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.display; import android.view.keyevent; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.windowmanager; import android.webkit.webview; import android.webkit.webviewclient; import android.widget.button; import android.app.activity; import android.app.notification; import android.app.notificationmanager; import android.app.pendingintent; import android.content.intent; import android.os.bundle; import android.view.view; public class myactivity extends actionbaractivity { @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu items utilize in action ba...

How to Add Hours to Selected Time in javascript -

How to Add Hours to Selected Time in javascript - i'm pretty new javascript , jquery, have 3 fields fromtime, working hrs , time. if select time 10:00 , working hrs 03:00 expected result 02:00 time. <select name="timestart"> <option value="00:00">00:00 am</option> <option value="00:30">00:30 am</option> <option value="01:00">01:00 am</option> </select> only add together hrs selected time. you don't need third-party js library accomplish want. since not giving farther information, assume that: times internally represented in armed forces time (i.e 10:00 pm = 22:00). example, there item like: <option value="22:00">10:00 pm</option> . maximum representable time 23:59. the value of "working hours" cannot exceed 24 hours. the next code returns armed forces time of adding given time amount (in hours) given armed forces time: function...

php - List all rows from mysql table in a list -

php - List all rows from mysql table in a list - this question has reply here: mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 32 answers why shouldn't utilize mysql_* functions in php? 10 answers i wanna list rows specific mysql table in table . error. search google can't find nil . please help me ! warning: mysql_num_rows() expects parameter 1 resource, boolean given in c:\xampp\htdocs\toate.php on line 38 there rows in table warning: mysql_fetch_row() expects parameter 1 resource, boolean given in c:\xampp\htdocs\toate.php on line 42 this php code : $user = "boss"; $pass = "123"; $db = "test"; $link = mysql_connect("localhost", $user, $pass ); if...

c# - Windows phone 8.1 Make AutosuggestBox Push content downwards -

c# - Windows phone 8.1 Make AutosuggestBox Push content downwards - i want listview within autosuggestbox force content in grid. can't remove "popup" item in base of operations style because command stops working. how can accomplish without rolling own control? c# windows xaml windows-phone-8.1

Repeat a menu and prompt if the user entered invalid choice in C -

Repeat a menu and prompt if the user entered invalid choice in C - void menu(){ printf("\n"); printf("1. convert integers in decimal number scheme binary numbers \n"); printf("2. compute consecutive square root look \n"); printf("3. solve quadratic equation \n"); printf("4. print fun \n"); printf("q. quit\n \n"); printf(" come in choice: "); } main () { char choice; { menu(); scanf("%c", &choice); switch (choice){ case '1': ... case '2': .... case '3': ... case '4': .... default: printf("wrong choice. please come in again: "); break; } } while (choice != 'q'); } here general idea, can't prompt wrong selection , repeat menu. when come in wrong choice, output follows: example, entered 5: ...

google app engine - How to display the selected value in dropdown from datastore using java GAE? -

google app engine - How to display the selected value in dropdown from datastore using java GAE? - am using below code in jsp retrieve selected value datastore. lastly option> value displaying default. whats wrong in syntax? option> value="monthly" selected="<%=order.getperiod()%> =='monthly'? true:false">monthly option> value="quaterly" selected="<%=order.getperiod()%> =='quaterly'?true:false">quaterly someone kindly help me findout. in advance. it looks close jsp tag in wrong place. should be: <option value="monthly" <%=order.getperiod().equals("quaterly")? selected : "" %>>quaterly</option> java google-app-engine drop-down-menu selected selectedvalue

How to test android Goldfish Kernel 3.10 on Versatilepb Suported QEMU? -

How to test android Goldfish Kernel 3.10 on Versatilepb Suported QEMU? - i'm trying port android on versatilepb using [android goldfish 3.10 kernel](https://android.googlesource.com/kernel/goldfish/+/android-goldfish-3.10). first, configured kernel versatile_defconfig , built it. got .config file, renamed versatile_config , added android base of operations configuration using next command arch=arm scripts/kconfig/merge_config.sh versatile_config android/configs/android-base.cfg again, built kernel successfully. after that, built android google source code , have taken ramdisk.img google_src_v4.4/out/target/product/generic . after that, tested using next command, qemu-system-arm -m versatilepb -kernel ./arch/arm/boot/zimage -initrd ramdisk.img -append "console=ttyama0 root=/dev/ram0 rw" -serial stdio but i'm getting next error. kernel panic - not syncing: attempted kill init! exitcode=0x00000004 cpu: 0 pid: 1 comm: init not tainted 3.10.0 ...

jQuery not reading or counting nodes of XML file correctly -

jQuery not reading or counting nodes of XML file correctly - this question has reply here: how homecoming response asynchronous call? 11 answers i have xml document: <?xml version='1.0' ?> <root> <row> <title>homeward bound</title> </row> <row> <title>escape witch mountain</title> </row> .... .... </root> my jquery read xml is: $(document).ready(function () { var data; $.ajax({ type: "get", url: "titles.xml", datatype: "xml", success: function (e) { info = e; }, error: function () { alert("the xml file not processed correctly."); } }); alert($(data).find("root row").length); ... .. . the alert shows 0 - despite there beingness several records. is there wrong way i'm reading xml...

sitecore7 - Sitecore "webedit:sortcontent" command -

sitecore7 - Sitecore "webedit:sortcontent" command - i wondering if it possible phone call command "webedit:sortcontent" id or datasource. have utilize editframe or can pass parameter id? i tried calling straight javascript, this: sitecore.pagemodes.chromemanager.postrequest('webedit:sortcontent(' + myid + ')'); , no luck. sitecore.pagemodes.chromemanager.postrequest('webedit:sortcontent(itemid=' + id + ')'); this seems work. sitecore sitecore7

sql - SELECT TOP 2 * table ORDER BY country -

sql - SELECT TOP 2 * table ORDER BY country - why getting more 2 results, when utilize statement? select top 2 * customers order country desc you can seek here: http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_top&ss=-1 if using mysql, you're not using proper syntax. don't utilize top ... that's sql server (and other "microsoftish" dialects ;-) ). must utilize limit : select * customers order country desc limit 2 sql sql-order-by

android - apply padding to only the first view in an adapter -

android - apply padding to only the first view in an adapter - i trying add together padding single view in array adapter. in getview() method say: if(position==0){ rowview.setpadding(60,0,0,0); } but position isn't right because convertview recycled. has tried this? position 0 first item. however, will need set padding normal other items: if (position == 0) { rowview.setpadding(60, 0, 0, 0); } else { rowview.setpadding(pad, pad, pad, pad); } alternately, utilize multiple view types homecoming different layout first item: @override public int getviewtypecount() { homecoming 2; } @override public int getitemviewtype(int position) { homecoming (position == 0) ? 0 : 1; } @override public view getview(view convertview, viewgroup parent, int position) { if (convertview == null) { if (getitemviewtype(position) == 0) { // inflate padded layout } else { // inflate standard layout ...

java - How to get path parameters and matrix parameters from the following uri string? Uri is /flights/flightid;numberofseats=2/date -

java - How to get path parameters and matrix parameters from the following uri string? Uri is /flights/flightid;numberofseats=2/date - am trying separate path param , matrix param next uri string in jersey. /flights/flightid;numberofseats=2/date. things wanna separate next parameters using jersey flightid numberofseats date i tried code separate failing miserably. @get @path(value = "/flight/{flightid}/{date}") @produces(mediatype.text_plain) public response bookflight(@matrixparam("numberofseats") int numberofseats, @pathparam(value = "flightid") int flightid, @pathparam(value = "date") string date) { //logic } all matrix param examples know carry them @ , of uri. in case regex derived path eat uri parts , leave nil @pathparam capture. see section 3.7.3 of jax-rs 2.0 spec. if possible, move theses parameters end. or parse flightid (which contain matrix params, think) in own code. java ...

c# - Enum deserialization for none .NET application consuming WCF service -

c# - Enum deserialization for none .NET application consuming WCF service - so question pretty simple- have wcf contract datacontract includes enum. goal is: 1. .net application desrialize datamember suitable enum 2. none .net application desrialize datamember int is there chance default behaviour? if not how accomplish goal? thanks! in .net can cast int enum , viceversa, while having int int others c# wcf

Why can't chef resolve my cookbooks? -

Why can't chef resolve my cookbooks? - intro learning chef automate server management @ work. downloaded chefdk 3.0 here , trying build first cookbook using chef. important using in windows environment testing purpose, expect fail since windows not have iptables, not expect fail saying can't find cookbook. i've tried using windows cookbook , works. the problem able create cookbook , run it, not able reference dependencies supermarket. i have tried 2 alternatives: alternative 1 i used next command create cookbook chef generate cookbook learn_chef_httpd (from this tutorial) i able finish tutorial , test referencing cookbook, chose simple_iptables i added line cookbook 'simple_iptables', '~> 0.7.0' to berksfile, described in supermarket. then added these lines default.rb file: include_recipe 'simple_iptables' # allow http, https simple_iptables_rule "http" rule [ "--proto tcp --dport 80", ...

string - Getting character position in c# -

string - Getting character position in c# - this question has reply here: how particular character position string using c# 1 reply i using next code position of "e" string = "abcdefghijklm"; int position = 0; (int = 0; < a.length; i++) { if (a.substring(i, 1) == "e") { position = +1; break; } } above code homecoming position = 5 , i new c# question is fast way without loop this, single/first occurrence by using indexof homecoming index of position. using system; class programme { static void main() { // a. // input string. const string s = "abcdefghijklm"; // b. // test indexof. if (int = s.indexof("e") != -1) { console.write("string contains 'e' @ position of "+i); } console.readline(); ...

Date insert from python to mysql "out of range" issue -

Date insert from python to mysql "out of range" issue - i've created mysql db l column "date": +--------+---------+------+-----+---------+-------+ | field | type | null | key | default | | +--------+---------+------+-----+---------+-------+ | datum | date | yes | | null | | | stroom | int(15) | yes | | null | | | gas | int(15) | yes | | null | | | water | int(15) | yes | | null | | +--------+---------+------+-----+---------+-------+ yet, when seek insert date python script returns: warning: out of range value column 'datum' @ row 1 my script looks this: #!/usr/bin/python import datetime import mysqldb # define strings = datetime.datetime.now() mydatum = ("%s-%s-%s" % (i.day, i.month, i.year)) #mydatum = time.strftime("%y-%m-%d") mystroom = open('/home/pi/textfiles/stroomverbruik.txt', 'r').read(4) mygas = open('/home/pi/textfile...

JQuery: How to distinguish 404 from other types of error on image load -

JQuery: How to distinguish 404 from other types of error on image load - i need test if remote text file nowadays or not , wrapping in jsonp not option. ie ignores effort allow cross-domain ajax access default. 1 way around have read on set source of image object , see if generates error. img = $('<img />',{ src: '/myfile.txt'}).bind('error', function(returned) {console.dir(returned);}) this doesn't work because text file not valid image. in case message displayed in console is... resource interpreted image transferred mime type text/xml if there no file error displayed in console is... get http://example.com/myfile.txt 404 (not found) both trigger error function if bind can't see way distinguish error of 2 beingness trapped. if drill "returned" object can see loads of stuff no mention of actual error message or 404 code looking for. how information? jquery image cross-domain http-status-code-404

jms - Spring/HornetQ: HQ154002: Could not create session: Only allowed one session per connection -

jms - Spring/HornetQ: HQ154002: Could not create session: Only allowed one session per connection - context: spring 4.0.6 app running within jboss eap 6.2. part of application jms queue , on receiving side, messages need processed in parallel, otherwise many messages take long. spring's jms listener configured concurrency of 10 , delegates executor pool 10 threads (first question: relationship correct?) <bean id="executor" class="org.springframework.scheduling.concurrent.threadpooltaskexecutor"> <property name="corepoolsize" value="10" /> <property name="maxpoolsize" value="10" /> <property name="queuecapacity" value="20" /> </bean> <jms:listener-container destination-resolver="jndidestinationresolver" destination-type="queue" acknowledge="auto" connection-factory="jmsconnectionfactory" c...

c# - Remove job from quartz-jobs.xml file -

c# - Remove job from quartz-jobs.xml file - i have been using deletejob() method remove job has expired scheduler. want job , associated triggers removed quartz-jobs.xml file. how can create happen? c# xml quartz.net job-scheduling

node.js - Testing NodeJs with Mocha/Sinon - Sails -

node.js - Testing NodeJs with Mocha/Sinon - Sails - i'm relatively new nodejs , sailsjs framework, , enjoy write code it, coming php background found testing nodejs bit weird. i'm trying test mocha , sinon method login of authservice , beingness not expert need illustration on how accomplish successful test , unfortunately documentation online still bit poor illustration lots useful thanks! login: function(username,password,callback) { user.findonebyusername(username, function(err,user){ // if has error if (err) { homecoming callback(err) } // if user not found username if (!user) { homecoming callback(err,false); } // if found match password bcrypt.compare(password, user.password, function (err, res) { if (!res || err) homecoming callback(err,false); homecoming callback(err,true,user); }); }); } if can create li...

angularjs - Rejected request to participate in Google AdSense (Phase 1) -

angularjs - Rejected request to participate in Google AdSense (Phase 1) - i trying register web app service of google adsense . after 5 attempts still stuck in first phase error: content insufficient. my web app search engine youtube, developed angularj s , nodejs angularjs embraces asynchronous model , creates problems google's crawlers . implemented library prerender.io , have set meta tag prepare problems # of angular.   <meta name = "fragment" content = ""> i prepared sitemap.xml within site, , index pages through portal of google webmasters. the site beingness search engine, does not have static content , reach, added texts , descriptions in page principle, houses other partial files. despite these changes, not pass first stage, how can fix? i'm not making necessary steps web app angular? to approved in google adsense need 10 topics of 400 words. content should unique. according google adsense tos not allowed...

webserver - Has any body have any ideas on C++ memory management for apps in TNTWEB web server? -

webserver - Has any body have any ideas on C++ memory management for apps in TNTWEB web server? - if body uses tntnet web server develop web applications using c++, please share how handle memory management? naive , started exploring it. in advance. normally, add together objects (no pointers) <%session> tag in component, in examples of ecpp manpage. if need able replace these objects throughout 1 session, can utilize std::unique_ptr<class> or std::shared_ptr<class> instead, available if compiler supports c++11. c++ webserver tntnet

vb.net - jquery doesn't recognize dynamically created elements -

vb.net - jquery doesn't recognize dynamically created elements - i able generate list of products checkboxes through vb , adding <ul> tag <input type="text" id="searchtext" /> <input type="button" value="search" id="wesearch" /> <div> <ul runat="server" id="ulval" style="list-style-type:none"/></ul> </div> dim brandname string dim brandid integer dim build new stringbuilder() dim msql new mysqlconnection() msql.connectionstring = "server=192.168.1.230;database=cable_tv_reporting1;uid=root;pwd=master!!@" msql.open() select case msql.state case system.data.connectionstate.open exit select case system.data.connectionstate.closed respo...

c++ - CMake: default flags depending on build type -

c++ - CMake: default flags depending on build type - i'm using cmake 2.8.12.2 in project , noticed depending on build type, adds flags compiler. in case of release build type, adds -o3 , -ndebug . the thing since project going used in different platforms don't know cmake version they're using (above 2.8 of course) , i'd know if there default flags each build type, or if feature depends on version of cmake. i know add together flags variables cmake_cxx_flags_* , want maintain compilation "clean" adding flags 1 time , not overriding done. this add together "-wall" release flags set(cmake_cxx_flags_release "${cmake_cxx_flags_release} -wall") c++ compilation cmake

move uploaded file to non-webroot php : permission denied -

move uploaded file to non-webroot php : permission denied - so want move file after upload local path (say /proj/xxx/sharing) i have given permission of 777 directory, , owner/group dir www/www (php user) sudo chmod -r 777 sharing/ [user@localhost]$ sudo -u www mkdir /proj/xxx/sharing/dd mkdir: /proj/xxx/sharing/dd: permission denied output of ls -l : drwxrwxrwx 2 www www 512 oct 22 15:48 sharing still php complains beingness denied permission when seek either mkdir, rename or cp /tmp folder. any ideas might cuplrit? how this? sudo chmod -r 777 /proj/xxx please ref this link php file-upload copy

javascript - copy select element in a table -

javascript - copy select element in a table - i have dynamic table add together rows dynamically when user clicks button. my button phone call next function : <input type="button" value="add" onclick="addrowtuy($('#amonttabletuy tbody'), 'amonttuy');" /> my function adds new rows table. include text fields, inputs , select. i have no problem creation of new inputs , text, select, want re-create existing select , alter id. that's problem. this function create new rows in table: function addrowtuy(table, value) { var nbrow = table.children().size(); table.append( "<tr>"+ "<td>"+(nbrow+1)+"</td>"+ "<td><input id='"+value+(nbrow+1)+"diam"+"'/></td>"+ "<td><input id='"+value+(nbrow+1)+"long"+"'/></td>"+ "<td>"+$("...

jsf 2 - why action in doesn't work inside a composite component -

jsf 2 - why action in <h:commandLink> doesn't work inside a composite component - i have simple jsf 2/facelets page looks this: <ui:repeat value="#{mybean.names}" var="_name"> <h:commandlink value="#{_name}" action="#{mybean.sayhello(_name)}"> <f:ajax execute="@this"/> </h:commandlink> <br/> </ui:repeat> the backing bean provides java.util.list<string> names , action-method prints "hello <name>" message standard output. this works fine. list of names in browser , click fires action-method says hello specified name. the problem arises, when want set code in composite component iteration , renders actual link via facet: <ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:cc=...

html - Making container of overlapping content fit height of largest child -

html - Making container of overlapping content fit height of largest child - i'm building carousel/slideshow-type widget rotates between 3 quotes. let's markup looks this: <div class="carousel"> <blockquote>...</blockquote> <blockquote>...</blockquote> <blockquote>...</blockquote> </div> i want 3 quotes overlap in place, , i'll transition opacity property create fade in/out transitions. css looks this: .carousel{ position: relative; } .carousel blockquote{ position: absolute; top: 0px; left: 0px; } now if leave @ this, .carousel div default height of 0px , , not force rest of page's content down. so need specify height, problem each quote can of different length, , result each blockquote can have different heights. so question this: how can create sure .carousel div stretches fit blockquote biggest height? i'd prefer pure-css solution, if doesn't exist, elegant...

php - Codeigniter pagination create this prev and next links -

php - Codeigniter pagination create this prev and next links - i seek create pagination in ci i have html <!--div class="pagination"> <a href="#" class="page-prev">previous</a> <ul> <li class="active"><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> </ul> <a href="#" class="page-next">next</a> in controller seek $config['full_tag_open'] = '<div class="pagination"><ul>'; $config['full_tag_close'] = '</ul></div>'; $config['cur_tag_open'] = '<li class="active">'; $config['cur_tag_close'] = '</li>'; $config[...

c - OpenGL Projection, View and World matrices -

c - OpenGL Projection, View and World matrices - i have question opengl projection, view , model matrices. in directx 9 can manipulate matrix content , apply using settransform function. i saw in msdn opengl glloadmatrixf function, changes current matrix can alter glmatrixmode function. this function gets 1 argument 3 options: gl_modelview , gl_projection , gl_texture . that's problem. how can modify world matrix? in directx 9 can utilize settransform , 1 of state types: d3dts_world (macro), d3dts_view , d3dts_projection , set matrices them. the gl_modelview matrix name is; combination of model , view matrices. usually, apply view transformations first, each model, force matrix, apply model transforms, draw model, pop matrix. if utilize shaders, though, (and have in opengl 3.1+ without compatibility profile), can utilize uniforms pass matrices shader want, including splitting model , view matrices if desire. c opengl matrix directx-9

Change blank spaces with underscores in Bash -

Change blank spaces with underscores in Bash - i'd write script in bash that: takes file input. if file name has blank space changes underscore. my first question is: can bash script take arguments input or input has provided 1 time script running means of read command? other question how utilize mv command perform point 2. your script simply: #!/bin/bash mv "$1" "$(sed 's/ \{1,\}/_/g' <<<"$1")" use script.sh file\ name . file file name renamed file_name . as gniourf_gniourf has pointed out in comments (thanks), if using bash possible utilize built-in character substitution: mv "$1" "${1// /_}" the behaviour of different, replace every individual space underscore, whereas approach using sed squashes groups of spaces single underscore. if enable extended globbing, can create version behave same 1 using sed: shopt -s extglob mv "$1" "${1//+( )/_}" depen...

java - Invoking a method with generic parms using reflection -

java - Invoking a method with generic parms using reflection - i trying pass 2 generics known types ( accumulationfunction , resultbindings ) reflective invoke routine below, i'm having trouble. can help me understand how can achieved? package com.amir.method.compiler; //hidden imports import java.util.set; public class compiledreferencedattributemethod implements compiledmethod { final class<?> generatedclazz; //how pass arguments below invoke routine?? final knownworkdata<accumulationfunction> accumulationfunction; final knownworkdata<set<executable<instancesetvalue>>> resultbindings; public compiledreferencedattributemethod(final int hash, final knownworkdata<accumulationfunction> accumulationfunction, final knownworkdata<set<executable<instancesetvalue>>> resultbindings) { this.generatedclazz = ...

css - Moving search menu top right of page to left (Wordpress) -

css - Moving search menu top right of page to left (Wordpress) - i working on wp site trying move search menu in top bar top right of page way left. search bar enclosed in grid , can move left far grid extends. moved left of grid max can move. grid enclosed in container. how can move out of grid? or anyway left? website is: http://museiam.ca/ search bar css: .gbtr_tools_search_trigger, .gbtr_tools_search_trigger_mobile, .gbtr_tools_search_inputbutton { padding: 0 !important; background: none !important; margin-top: 0px; width: 40px; height: 30px; border: 0; border-left: 1px solid rgba(255,255,255,.2) !important; border-right: 1px solid rgba(255,255,255,.2) !important; cursor: pointer; color: #fff; float: right; } container & grid: .container_12 .grid_6 { text-align: left; float: left; } .container_12 .grid_6 { width: 460px; } .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9, .grid_10, .grid_11, .grid_12 { display: inline; float: ...