Posts

Showing posts from January, 2014

nginx - Rails application works in development but is empty in production -

Image
my rails 4 application runs in development mode, @ production see empty page. it's running unicorn nginx in centos 7 vps. any hint need? unicorn_rails -c config/unicorn.rb -d unicorn_rails -c config/unicorn.rb -d -e production the logs of nginx, unicorn , rails don't show errors. rake routes [root@mycentos my_app]# rake routes prefix verb uri pattern controller#action blogs /blogs(.:format) blogs#index post /blogs(.:format) blogs#create new_blog /blogs/new(.:format) blogs#new edit_blog /blogs/:id/edit(.:format) blogs#edit blog /blogs/:id(.:format) blogs#show patch /blogs/:id(.:format) blogs#update put /blogs/:id(.:format) blogs#update delete /blogs/:id(.:format) blogs#destroy in development can access route, shows me error messages when route doesn't exist. in production, blank. i'm not boldly switc

java - Deltaspike and Quartz: How to set cronExpressions from a config file -

i guess title quite self-explained. have job: import org.apache.deltaspike.scheduler.api.scheduled; import org.quartz.job; @scheduled(cronexpression = "0 0/1 * * * ?") public class joba implements job { //job code } harcoded run every minute. set cron expression outside, i.e. config file. i'm using deltaspike, can't find way achieve it. thinking of class jobdispatcher maybe, create job , set cron expression it, see no clue in deltaspike documentation thanks in advance! make cron expression private final static constant deriving value config file , use in annotation.

c# - Access Generics List in ASP.NET MVC 5 View -

i getting started mvc , have following model public class formcontrols { //properties of formcontrols object public string formcname { get; set; } public string formctype { get; set; } public string formccss { get; set; } public string formcenabled { get; set; } public string formcdefaultval { get; set; } } i created following control , querying database using linq select records. each record have added list. public actionresult index() { var datacontext = new editprofileformfieldsdatacontext(); var controls = c in datacontext.controls select c; list<formcontrols> fields = new list<formcontrols>(); foreach(var fc in controls) { //create object generic list formcontrols epc = new formcontrols(); epc.formcname = fc.control_name; epc.formctype = fc.control_type; epc.formccss = fc.control_css; epc

shopify - How do I shorten this liquid code? -

i want update "new order notification" mail shopify store custom html code, while pasting code doesn't paste 100% of it. i've contacted shopify , they've told me there no character limit file size limit of 64 or 128 kb. the store has 18 main categories (collections). i'm trying make sure products sorted based on category name. the following piece of code appears 18 times (for every category) in custom template: {% if verse_kantenklaar_maaltijden_salades != blank %} <tr> <td colspan="2"> <h2 style="margin-bottom:15px;margin-top:5px!important;font-weight:bold;">verse kant-en-klaar maaltijden - salades</h2> </td> </tr> {% line_item_id in verse_kantenklaar_maaltijden_salades %} {% line_item in line_items %} {% capture line_item_string %}{{line_item.id}}{% endcapture %} {% if line_item_id == line_item_string %} {% assign bonus = 'no'

aggregation - Netty 4.0.26-FINAL client to send multiple small messages and sync -

i have client needs send alot of small messages server (< 8k each messages), single thread can push 1.2 million of messages 1 after other without delay in between reception of messages. how configure netty client "buffer" write flushes automatically @ given buffer size , doesn't create me oom errors ? as simple example, let's want send content of file, line line simulate reception of such messages. eventloopgroup group = new nioeventloopgroup(); try { bootstrap b = new bootstrap(); b.group(group).channel(niosocketchannel.class).handler(new channelinitializer<channel>() { @override protected void initchannel(channel ch) throws exception { ch.pipeline().addlast(new stringencoder()); } }); // start connection attempt. channel ch = b.connect("localhost", 6000).sync().channel(); channelfuture

config - Why do we need the <Directory> in Apache .conf file? -

simple question: <virtualhost *:80> servername notes.example.com documentroot /var/www/notes <directory "/var/www/notes"> require granted options +indexes </directory> </virtualhost> on first sight works putting: <virtualhost *:80> servername notes.example.com documentroot /var/www/notes </virtualhost> so why need <directory> statement anyway? i've found several examples on web of using <directory> or <proxy> thing , others putting settings under <virtualhost> branch. because can define particular parameters particular directories. you <directory "/var/www/notes/private"> options -indexes <directory> or similar. documentroot work itself, if want add directory options, you'll need use directory tag.

html - How to make iframe use all height available to it -

i have code: <!doctype html> <html lang="en"> <head> <title>example</title> <style> html, body, iframe { height: 100%; width: 100%; border: none; margin: 0 0 0 0; padding: 0 0 0 0; } header { height: 34px; background-color: red; } footer { height: 17px; background-color: green; } </style> </head> <body> <header></header> <iframe src="https://freebsd.org"></iframe> <footer></footer> </body> </html> how can make header , footer stay fixed, visible when resizing , iframe take remaining space? a.i. want layout stay fixed, scrollbar showing iframe. i think tried everything, googling stomach, nothing has worked achieve goal. either iframe not visible, overflows on footer or header or else goes wrong. so far tried css solutions, because refuse believe not possible css al

android - Why Chrome Developer Tools set such a big viewport size when emulating mobile? -

i have test document follows: <html> <head></head> <body></body> </html> so it's empty document. in normal browser mode, nice empty page, no scrolls. but when open devtools , turn on mobile emulation (for example, sony xperia z, z1), see scroll bars (both horizontal , vertical), , html element size 980x1742. come from? shouldn't @ least 0 height? to make page exact size of screen (no zooming or otherwise), place in header: <meta name="viewport" content="width=device-width, initial-scale=1"> there's more info it, additional parameters may find useful, on mozilla's developer site here .

for loop - SSIS variable Excel sheet name error with and without dollar sign $ -

i in catch 22 situation trying code each loop dynamically create list of excel files. in each loop have execute sql task runs create table statement name of sheet/tab. precedes data flow task runs query based on parm set in loop , attempts write results excel. problem either in excel destination object or sql task creates table. the name of sheet set via variable. in examples online not include dollar sign ($) in sheet name, "report". when excel destination cannot find sheet/tab means cannot edit object map/remap columns. but, when change variable include dollar sign "report$", excel destination object works when running package create table step throws error saying "opening rowset 'report' failed. check object exists in database". any ideas? "create table `" + @[user::excel_tab_name] + "` (

asp classic - asp page will not render on 2012 web server -

i moving old applications on new server , receiving 500 error, iis log having below: 2015-03-20 20:24:28 192.168.28.131 /test.asp |33|asp_0177_:_800401f3|server.createobject_failed 80 - ip address mozilla/5.0+(windows+nt+6.3;+wow64;+trident/7.0;+rv:11.0)+like+gecko - 500 0 0 0 here environment: the test server windows 2012 r2 iis - version 8.5 i have asp.net web site running. (this rules out turn windows features on or off). the new web site pointing default app pool (for now). i tested see if code, not case: i created file called test.html says "hello". if browse url page comes fine. if rename test.html file test.asp, error occurs. i tried below basic .asp script, same error <!doctype html> <html> <body> <% response.write("hello world!") %> </body> </html> thanks in advance. are sure you've enabled classic asp on iis? server role has installed, because on default isn't on iis 8.5.

c# - Using Where and ForEach to modify specific elements in a list -

if have list of objects have properties fruitname , numfruits , want pluralize fruitname numfruits greater 1, possible in single statement chaining where , foreach ? something like: fruitlist.where(fl => fl.numfruits > 1).foreach(fl => fl.fruitname = fl.fruitname + "s"); i tried above , doesn't work. complains system.collections.generic.ienumerable doesn't contain definition foreach. if want one-liner (it harder maintain) , want keep original list intact modify of elements, you'll have use full anonymous function. if need multiple statements (a block of code), you'll need include braces , statement-terminating semicolons below: fruitlist.foreach(fl => { fl.fruitname = fl.numfruits > 1 ? fl.fruitname + "s" : fl.fruitname; }); this works on original list (no subset) , exact same thing structured foreach do.

model view controller - Krajee bootstrap-fileinput with Mvc razor -

i want use krajee bootstrap-fileinput ( http://plugins.krajee.com/file-input ) mvc razor, please me out process to upload images server , json result actionresult. i have included required js , css files in view page , added line <input id="input-702" name="kartik-input-702[]" type="file" multiple="true" class="file-loading"> and script $("#input-702").fileinput({ uploadurl:"@url.action("upload","home")", uploadasync: true, minfilecount: 1, maxfilecount: 5, overwriteinitial: false, initialpreview: "", initialpreviewconfig:"", uploadextradata: "" }); this line getting formatted , showing drag , drop effect , select file button.the file selection , thumbnail creation working on upload action there (fileinput,js) function "ajaxsubmit" use post content homecontroller actionresult "upload". ajaxs

ios - AutoLayout set height of UITableViewCell based on children -

i trying set height of uitableviewcell based on children's constraints. basically, here's layout: uitableview > uitableviewcell > nesteduiview (with computable height) i started setting top, bottom, left, , right constraints of nesteduiview 10px off uitableviewcell . then, tried adding height constraint (which in head force uitableviewcell expand fit content. of course though, causes constraint conflict , fails. this seems should trivial, doing wrong? add viewdidload method self.tableview.rowheight = uitableviewautomaticdimension; self.tableview.estimatedrowheight = 42; this tell table use cell constraint's determine height.

javascript - Fade in arbitrary number of text lines sequentially with jquery queue -

this gets pretty specific i'd able fade in arbitrary number of children sequentially , delayed timing using jquery queue (though i'm open other methods). here have working already. this basic html block i'm working with <header> <p class="copy">thing one</p> <p class="copy">thing two</p> <p class="copy">cat in hat</p> </header> this current jquery works, feels hacky me in need know in advance how many nodes expect. var $screenheader = $('header'); $screenheader.queue(function () { $screenheader.find('.copy:nth-child(1)').addclass('visible'); $(this).dequeue(); }) .delay(1500) .queue(function () { $screenheader.find('.copy:nth-child(2)').addclass('visible'); $(this).dequeue(); }) .delay(1500) .queue(function () { $screenheader.find('.copy:nth-child(3)').addclass('visible'); $(this).dequeue(); }) .delay(1500); i

android - Accessing a RadioButton and selecting it in Espresso -

i using espresso test android application. having trouble trying find way access , select radiobutton (which belongs radiogroup) of current activity. have suggestions? you -andrew given following layout: <radiogroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/radiogroup" > <radiobutton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/first_radio_button" android:id="@+id/firstradiobutton" /> <radiobutton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/second_radio_button" android:id="@+id/secondradiobutton" /> <radiobutton

How to create a 'Table' in my Android app -

so i'm trying create 2-column table in android app , looking advice on best way approach it. this table have header above each column , table might extend off bottom of screen. (will need scrolling). 1 of columns filled text. second column filled dropdown spinners. i've tried multiple different ways not sure what's canonical way this...should using relative layout? should wrapping in scrollview? should use tableview tablerows? or should using combination of multiple of these? note: i'd able have "borders" in table. maybe @ bottom of each row. read somewhere put textviews fill screen width-wise , have height of 2dp background color set. approach work suggesting? thanks in advance advice! seems job captain listview ! can addheader scrolls or wrap in relativelayout fixed header. can have divider between rows created automatically. rows generated adapter. row layout should like <linearlayout xmlns:android="http://schemas.android.c

Laravel 5 trouble using Eager Loading -

so have problem getting user data through staff table using eager loading. controller: public function staff() { $salon = salon::find(session::get('salon')); $staff = staff::where('salon', $salon->id)->with('user')->get(); return view('dashboard.salon.staff', compact('staff')); } view: @foreach ($staff $staff) {{ $staff->user->photo }} @endforeach model: class staff extends model { protected $table = 'salonstaff'; public function user() { return $this->belongsto('app\user'); } } i have tried troubleshooting using dd($staff) , user relation appears null controller, , doing dd($staff->user) inside foreach results in "1", nothing else. if primary key in user column = 'user', should specify in user model with protected $primarykey = 'user'; if not, when using relation, eloquent expects conventional foreign key '

How to get unique string from variable in bash -

hello ask how can unique string variable. while read -r line route=$(echo $line | awk -f'[:]' '{print $2}') #get path log file if [ "`dirname "$route"`" == "`xrealpath "$pwd"`" ]; #compare path log file $pwd name=$(echo $line | awk -f'[:]' '{print $1}') #take name 1st column in log file fi if ! [ "$name" == "$help_name" ]; echo $name help_name=$name pom=$pom:$name fi done < $wedi_rc sample logfile: proj.sh:/users/tom/documents/proj.sh:2015-03-21:1 proj1.sh:/users/tom/documents/proj.sh:2015-03-21:1 proj.sh:/users/tom/documents/proj.sh:2015-03-21:2 proj1.sh:/users/tom/documents/proj.sh:2015-03-21:2 proj.sh:/users/tom/documents/proj.sh:2015-03-21:3 proj1.sh:/users/tom/documents/proj.sh:2015-03-21:3 how can echo each unique 1 time? my output looks this: proj.sh proj1.sh proj.sh pr

jquery - Javascript click event on a dynamically created button inside a loop -

i had @ topics related javascript click event problems inside loop before post here: javascript - dynamically assign onclick event in loop how pass object onclick event setting onclick use current value of variable in loop javascript infamous loop issue? i tested suggestions using closures or jquery function on , bind code still doesn't work. here current state of code: (var key in hotels) { if (hotels.hasownproperty(key)) { (var = 0; < hotels.hotellistresponse.hotellist.hotelsummary.length; i++) { hotelglobal.push('<li style="font-size:18px;font-weight:bold;">' + '<button id="book-infos" class="btn btn-default" style="background-color:#ffc100;font-weight:bold;float:right;display:inline-block;">more</button><br/><hr/>'); $(document).on( 'click', '#book-infos', function () { console.log(hotels.hotellistresponse

ios - Inappropriate Expected declaration error -

why getting error in code, seems normal me. declare 'hills' variable still getting error "expected declaration" both 'hills' , 'bg'. var bg = skspritenode(imagenamed: "sky") bg.position = cgpointmake(bg.size.width / 2, bg.size.height / 2) self.addchild(bg) var hills = skspritenode(imagenamed: "hills") hills.position = cgpointmake(hills.size.width / 2, 300) self.addchild(hills) i suspect reason expected declaration message have placed code inside of class without putting inside of method. example below compiles, gives same error seeing if not included inside of setup method: class mynode: skspritenode { func setup() { var bg = skspritenode(imagenamed: "sky") bg.position = cgpointmake(bg.size.width / 2, bg.size.height / 2) self.addchild(bg) var hills = skspritenode(imagenamed: "hills") hills.position = cgpointmake(hills.size.width / 2, 300)

python - Access to value of variable with dynamic name -

i found several topics discussed dynamical creating of single variables in loops bad practice , better use dictionary. in case don't need create them dynamically, want access them in loop. i don't want use dictionary them, because these variables used in lot of places in code, , in 1 place need such dynamic access. idea example: car_pos = 1; man_pos = 10 car_vel = 100; man_vel = 5 elm in ['car', 'man']: elm_pos = elm + '_pos' elm_vel = elm + '_vel' # want values of elements such names here print(elm_pos, elm_vel) # desired output: # (1, 100) # (10, 5) variable names terrible way relate pieces of information. there nothing linking man_pos , man_vel except both happen start man . other totally separate. python has better ways of bundling elements these together. in case, man , car should objects attributes pos , vel . class thing: def __init__(self, pos, vel): self.pos = pos self

java - Mapping a complex Map in JPA -

i can't obtain persistence entity has field this: private map<string, list<string>> filtervaluerange; i've tried far: @elementcollection @jointable(name="attribute_value_range", joincolumns=@joincolumn(name="id")) @mapkeycolumn (name="filter_id") @column(name="filter") private map<string, list<string>> filtervaluerange; but seems there still missing. can point me right direction? i'm using jpa interface, there's hibernate under hood. thanks! mapping nested collection relationship not supported jpa can overcome changing object model little, example: @onetomany(mappedby = "parent") @mapkeycolumn (name="filter_id") private map<string, valuerange> filtervaluerange; and in corresponding valuerange entity: @manytoone private parent parent; alternatively may take @ following post: jpa map<string,string[]> mapping

javascript - Liquid Fire Modal Odd Effect or Open/Close/Open? -

i'm using liquid-fire open modal window in ember.js. have 2 identical sections – route, controller , template extremely similar, reason have not been able debug, 1 section producing peculiar visual effect, though modal opening, closing , re-opening. http://staging.ckdu.ca/shows http://staging.ckdu.ca/schedule wondering if has seen similar , might have advice. this code looks like: router.js: router.map(function() { this.modal('show-modal', {withparams: ['show_id'], otherparams: 'show'}); this.resource('schedule', function () {}); }); application controller.js: import ember "ember"; export default ember.controller.extend({ queryparams: ['show_id'], show_id: null }); schedule/index/controller.js: import ember "ember"; export default ember.controller.extend({ needs: ['application'], filteringbycategory: null, init: function() { var show_id = this.get('controllers.applicat

gradle - Why is this finalizer running even when the finalized task is up-to-date? -

i want run transformations on code quality reports can have them in both human- , machine-readable formats. thought finalizedby ideal tool use because, according the documentation : finalizer tasks executed if finalized task fails. … … finalizer tasks not executed if finalized task didn't work, example if considered date however, i'm seeing transform tasks running when tasks finalize up-to-date. here's build.gradle : apply plugin: "findbugs" apply plugin: "java" repositories { mavencentral() } def findbugsjar = project.configurations.findbugs.find { it.name.startswith("findbugs") } tasks.withtype(findbugs) { reports { xml.destination "$builddir/reports/${task.name}.xml" xml.setwithmessages(true) } def taskname = it.name def transformer = tasks.create(name: "transform" + gutil.tocamelcase(taskname)) it.finalizedby transformer transformer.description "t

sockets - 'str' does not support the buffer interface - Python 3 -

this question has answer here: typeerror: str not support buffer interface [duplicate] 1 answer import socket servername = "hostname" serverport = 12000 clientsocket = socket.socket(socket.af_inet, socket.sock_dgram) message = input('input lowercase sentence:') clientsocket.sendto(message, (servername, serverport)) modifiedmessage, serveraddress = clientsocket.recvfrom(2048) print (modifiedmessage) clientsocket.close() gives error traceback (most recent call last): file "c:/python34/server1.py", line 11, in <module> clientsocket.sendto(message, (servername, serverport)) typeerror: 'str' not support buffer interface what do? i've encode code import socket servername = "hostname" serverport = 12000 clientsocket = socket.socket(socket.af_inet,socket.sock_dgram) message = input('input low

Using the Scanner delimiter in Java, how do I keep the String that I am using as the delimiter? -

my program reads story file sentence sentence, using punctuation delimiter. stores sentences in arraylist , shuffles arraylist , prints creating different story every time run program. problem using delimiter gets rid of punctuation new story, there way can still use delimiter keep string part of reading? you can use scanner's default white-space delimiter scan through file's content, use pattern/matcher find position of punctuation delimiter within each scanner token. here's example: final list<string> sentences = new arraylist(); final scanner scanner = new scanner(new file("story.txt")); final pattern pattern = pattern.compile("[.!?]"); stringbuilder sb = new stringbuilder(); // default white space delimiter while (scanner.hasnext()) { string token = scanner.next().trim(); // pattern in current token matcher matcher = pattern.matcher(token); if (matcher.find()) { // end position of match int i

android - OnLocationChanged Won't Work Anymore, on many devices -

disclaimer: know there other questions similar want try , create super simpler case others recreate problem i've been using similar code below request location updates using google play services past few months , worked fine. reason onlocationchanged no longer called. happens across whole range of test devices. i'm using play services 7.0.0. request updates , nothing happens. suspect related recent code update made (albeit 1 had nothing location system) i'm clueless find fix. when revert commit, still have problem -- on old code worked fine! i've set code totally new sample application , played options locationrequest object fun nothing... stops after log, "onconnected, requestlocationupdates" after onconnected called. thanks help! similar: android gps onlocationchanged never called android onlocationchanged never called onlocationchanged() never called relevant manifest entries: <application <meta-data android:name

Are GET queries slow in google cloud datastore? -

number of entries little more 337k, queries fetch single entry taking anywhere 600-1500ms. seems high me. normal or doing wrong? the queries made gae instance in central using simple go script. here's dashboard's telling me: http://take.ms/gpsoz code at: http://play.golang.org/p/ofjmbkfxga as greg pointed out, if you're on app engine, using cloud datastore api might not way go. rather, use appengine datasto re directly

MongoDB PHP Failed to connect to: Timed out after 0 ms -

i use mongodb shardings. normally, works well, sometimes, failed connect, , message shows error timed out after 0ms . failed connect to: 192.168.1.10:35050: timed out after 0 ms php : 5.3.25 mongodb: 2.4.7

html - How to access DOM from previous sibling in JavaScript? -

i trying id(id 1) name of div div(class 2) in next line. when use previoussibling, worked on google chrome not on safari since safari catches area between divs "#text". in code, id name unique , there many different id name not want find id name. there way access previous sibling?? <div id="parent"> <div id="1"> <div class="1-1"></div> <div class="1-2"></div> </div> <div class="2"></div> </div> when use previoussibling, worked on google chrome not on safari since safari catches area between divs "#text". it works. doesn't want do. returns sibling node s . in case textnode . what looking element , specific subclass of node. there's .previouselementsibling property. inspecting dom node debugger , looking documentation on available properties way find such things.

ruby on rails - Sign in with Yammer is using 'http' instead of 'https' so fails with 'Invalid Redirect URI' error -

yammer login works correctly when logging in using own yammer account our network. whenever use else in our network 'invalid redirect uri' error. there reason why work when logging in , not other people? redirect uri error purely yammer server side related? i had set correctly in yammer created apps visiting production url using http instead of https . overriding redirect uri. fix changing url on invalid redirect_uri page include s , redirect correctly. seems bug source url override http part of yammer created apps redirect uri .

javascript - Ipad scroll reached bottom condition not met -

i have requirement change footer if scroll reached bottom of page. used if($(window).scrolltop() + $(window).height() == $(document).height()) condition check whether scroll has reached bottom or not. condition not getting met in ipad, works on desktop. is there different check find if scroll has reached bottom? how fix this? this because of bug ios7. can check answer if helps ios 7 - css - html height - 100% = 692px

weka - what is the cause of Accuracy difference? -

i have dataset of 2001 attribute , 63 instances while doing classification using weka can see j48 have higher accuracy compared naive bayes.but after doing pca can see j48 accuracy decrease compared first 1 first got 82% , after pca got 72.5%.what reason? decision trees select features. pca mixes features components. this makes feature selection work less - every input feature influences (almost) every derived feature. don't assume pca magic tool solves problems. can work - can make things worse.

jquery - ActiveRecord::ImmutableRelation in rails 4 -

in controller: def update @dtmrealshow= datetime.parse(params[:showtime][:dtmrealshow].to_s).strftime("%d/%m/%y %i:%m %p") @showtime.update(:dtmrealshow=> @dtmrealshow,:theatre_id=>params[:showtime][:theatre_id],:city_id=>params[:showtime][:city_id],:movie_id=>params[:showtime][:movie_id]) @showtimes = showtime.all.order(:created_at).paginate(:page => params[:page], :per_page => 8) end in _index.html.erb : <% @showtimes.each |showtime| %> ------------------------- <% end %> <%= will_paginate @showtimes%> in update.js.erb : $(document).ready(function(){ $('#divshow').html("<%= j (render 'showtimes/index') %>"); $('#mymodal').modal('hide'); $('#notice').html("showtime updated.").show(); }); in application using will_paginate gem.after update record getting http://localhost:3000/showtimes/45?page=4 url when clicked on pagination. want remove id=

c++ - Qt include header file from above directory -

at first, don't think become problem, after few day working it, still can't find solution source | |--- model | | | | - a.h |-b.h i can't include b.h a.h, compiler complain "cannot open include 'b.' : no such file or directory and .pro file template = app qt += qml quick widgets sql qt += declarative resources += qml.qrc include(deployment.pri) headers += \ sources/b.h \ sources/model/a.h a.h #ifndef a_h #define a_h #include "source/b.h" class { }; #endif b.h #ifndef b_h #define b_h class b { }; #endif how can fix this? , thank dropping by the path include file relative source file including it. here in a.h should have : #include "../b.h" or add path include directories adding .pro : includepath += $$pwd/source and include header file like: #include "b.h"

vb.net - It is taking too much time to logout from my webapplication -

in vb.net web application when user tries logout takes around 10-20 seconds logout. in between process @ bottom-left of browser displays uploading , after uploading 100% user able logout application. i want fast logout web application. unable solve problem . my application had deployed on webserver. have problem on webserver. on local machine ok. after looking @ har file posted, can see when post server, sending 2.75mb of data logout. 1 of major downsides of using webforms. need reducing size of viewstate in .net 2.0 (which looks using). you can disable viewstate particular control doesn't need using enableviewstate="false" . research viewstate is, , when safe disable it, , as can on page, big table if possible. alternative: logout using webmethod if cannot reduce viewstate size correctly without breaking things, may want having webmethod can call browser using jquery. dave ward has number of excellent posts on how on website encosia, such this on

C, Getting segmentation fault -

i have file called islands.txt contents: islandone islandtwo islandthree and code: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct island{ char *name; struct island *previous; } island; void printisland(island is){ printf("%s", is.name); if(is.previous && is.previous->name[0] != '\0'){ printf("%s", is.previous->name); } } int main(){ // file read. file *islandsfile = fopen("islands.txt","r"); // temporary location store name read file. char name[40]; // temporary pointer island has been read linking. island *previousisland; while(fscanf(islandsfile,"%s",name) != eof){ // allocate space new island , point (*newisland) pointer island *newisland =malloc(sizeof(island)); // assign name newisland->name = name; // if previousisland pointer not null // me

How many maximum markers add in Google map in android? -

i working on project include google map & routes. in app 2 or more markers & routes between them. how many markers add on google map & how many way points? i found solution. is there limit on how many markers can put on google maps route? but want information google maps api v2.is information same google map api v3? if limited waypoints provided google how upgrade? google has provided marker clustering techniques [google clustering technique marker on map][1] [1]: https://developers.google.com/maps/documentation/android/utility/marker-clustering using page, can cluster markers in application easily

sql - How can multiple rows into a single line? -

Image
i have query 1 table returns multiple rows. combine these 1 row each person. is there way this? example data query , result need: use grouping , aggregates: select max(seq) seq, id, sum(red1) red1, sum(red2) red2, sum(red3) red3, sum(green1) green1, sum(green2) green2, sum(green3) green3 table 1 group id demo: http://sqlfiddle.com/#!4/ad36e/3 note: use different aggregates values depending on result want if field has more 1 non-null value in group. using sum gives sum of values in group, using max gives highest value in group.

Cannot ZOOM text in Eclipse 4.4.2 LUNA -

i trying make mousewheel + ctrl work zoom shortcut. stopped working. i noticed (ctrl + =) , (ctrl + -) shortcuts no longer work either. does have idea on how fix this? i reinstalled eclipse, installed tarlog plugin etc.. haven't been able fix it. this might help. press ctrl + shift + l twice "keys" preferences type "zoom" in textbox on top you "zoom in" , "zoom out" commands check binding (in case, shows ctrl + = "zoom in" , ctrl + - "zoom out" options)

pipe - c execute external program multiple times -

i'm trying call external program code arguments. i'm trying see how different parameters change it's output have run multiple times (about 1000 times). every time external program runs i'm interested in 1 line of output although printing lot of (for purpose) useless stuff. line i'm interested in right above special identifier("some_signal") in output. thought i'll wait till line appears , read line above. i tried following: pid_t pid = 0; int pipefd[2]; file* output; char line[256]; // pipe read buffer char prev_line[256]; // prev. line pipe buffer char signal[] = "some_signal\n"; int status = 0; double obj_val; pipe (pipefd); //create pipe pid = fork (); //span child process if (pid == 0) { // redirect child's output pipe close (pipefd[0]); dup2 (pipefd[1], stdout_fileno); dup2 (pipefd[1], stderr_fileno); execl ("/some/path", "s

javascript - Anguarjs Directive at Form Level, accessing all fields and checking for validation -

in form (itemselectionform), rendering multiple tables ng-repeat. , in each table have radio buttons have names appended index. now, want write angular js directive (selectatleastoneitemtoreturn) put on form (with select-atleast-one-item) form validation based on children tables radio button. now, don't know how access children tables radio buttons , values in directive can write validation code. and, if radio buttons value changes want validation again , again. , if form invalid , next button disabled. html below. <div class="panel-group" data-ng-form="itemselectionform" select-atleast-one-item> <div class="panel panel-default" data-ng-repeat="item in items"> <div class="panel"> <div class="panel-body"> <table class="table table-bordered"> <thead> <tr> <th>action</th>

php - incorrect filename iOS8 File Upload -

hello trying create simple multiple file uploader works on mobile devices. right testing on ios 8. when upload file iphone 6 plus finding script not getting filename form when submitted. defaults image.jpg when uploading png. have been looking file api can't find i'm looking for. able change filename files upload without replacing each other @ least keep filename. help? heres have code. index.php <html lang="en"> <head> <meta charset="utf-8" /> <title>multiple file upload php</title> </head> <body> <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" id="file" name="files[]" accept="image/*"> <input type="submit" value="upload!" /> </form> </body> </html> upload.php <?php $valid_formats = array("jpg&qu

debugging - Viewing Swift optional values in debugger -

trying feet wet in writing , debugging swift code, wrote following. on os x 10.10.2, xcode 6.2. let text : string? = "this text.\njust fun." let lines : [string]? = text?.componentsseparatedbycharactersinset( nscharacterset.newlinecharacterset()) println("\(lines)") breaking on println ... line, debugger's variable view shows some value of lines . in understanding, indicates lines of optional type , contains value wrapped in some , opposed being none . knowing that, how can use debugger inspect value is? tried: clicking small "i" button, produces output "some" in debugger console. entering po lines , po lines! in debugger console, yields exc_bad_access . update: following fresh installation of xcode, po lines seems have no effect, i.e. no output. the final line prints optional(["this text.", "just fun."]) , i'd debugger show. how can @ unwrapped string array value of lines , , di

c - How to create matrix, by reading the length in an input file -

i trying create matrix, int matrix1[size][size] , have read length first line of file. i can read read file no problem, when try declare matrix variable given me file there's compiling error. how can around this? sorry english edited code: int num; file *fp; fp = argc > 1 ? fopen(argv[1], "r") : stdin; if( fp == null) { perror(argv[1]); return -1; } fscanf(fp,"%d", &num); int matriz[num][num]; error message warning: iso c90 forbids variable length array ‘matriz’

bash - Pass shell parameters to awk regex -

i have following script #!/bin/bash file="path/to/file" /usr/bin/awk '/chapter:/ {f=0} /chapter: 25/ {f=1} f' $file how can use variable's value instead of 25 ? something this: #!/bin/bash file="path/to/file" num=25 /usr/bin/awk '/chapter:/ {f=0} /chapter: <num>/ {f=1} f' $file p.s. /usr/bin/awk -v n="$num" '/chapter:/ {f=0} /chapter: n/ {f=1} f' $file is not working i cannot use other tool that, because awk fastest 1 want o do any ideas? you're on right track here 2nd part of building regex. can use: awk -v n="$num" '/chapter:/{f=0} $0 ~ "chapter: " n {f=1} f' file you need build regex using variable n , use ~ operator regex matching.

regex - C regular expressions, regcomp -

i'm trying make way around regular expressions check if string integer. figured pattern should ^\d$ , wrote function print error if argument not fit: regex_t regex; void check_int(char *c) { check=regcomp(&regex,"^\d$",0); if (check!=0) { perror("4th element on line not integer!"); exit(5); } else printf("4th arg number."); } i'm not sure how regcomp works, used thought should after checking examples on internet. trouble says string number, can't figure out why... added this, returns no match: status = regexec(&regex, c, (size_t) 0, null, 0); refree(&regex); if(status!=0) { perror(".."); exit(5); } regcomp used compile regular expression pattern, not match against input string. match against string, need use regexec . in case, return value of regcomp 0 because pattern seems compiled without error. see this link synopsis each of differen

angularjs - Nested JSON in one ng-repeat -

i'm new angular, , i'm having problems ng-repeats. have 1 ng-repeat have show nested objects in each repeat. know mean? this html: <li ng-repeat="rm in rooms"> <a href=""> <span id="room">{{rm.room}}</span> <span id="rack_num">rack {{rm.rack}}</span> <span id="slot_type">{{rm.type}}</span> <span id="slot_id">slot {{rm.id}}</span> </a> </li> i have list of "rooms" , "racks" , "slots": [ { "room": 1, "rackroom": [ { "rack": 8, "rackslots": [ { "slot": 1, "id": "ez345t1r", "type": "single" } ] }, { "rack": 12, "rackslots": [ { "slot": 3,

c# - how to extract form tag using htmlagility pack? -

i'm using htmlagilitypack in 1 of c# projects scraping. need scrap <form> tag web page. i've searched how extract form tag using htmlagilitypack couldn't find answer. can tell me how extract <form> tag using htmlagilitypack ? private void testing() { var gethtmlweb = new htmlweb(); var document = gethtmlweb.load(@"http://localhost/final_project/index.php"); htmlnode.elementsflags.remove("form"); var atags = document.documentnode.selectnodes("//form"); int counter = 1; stringbuilder buffer = new stringbuilder(); if (atags != null) { foreach (var atag in atags) { buffer.append(counter + ". " + atag.innerhtml + " - " + "\t" + "<br />"); counter++; } } } here code sample.

asp.net mvc - HTTPPOST method not being called while using html.beginform -

i hope can me simple issue i'm having, can't figure out. i using ajax calls in javascript submit forms no problem. i'm trying use html.beginform helper, not hitting post method inside same controller using ajax call. what need in order post method hit? here controller code: [httppost] //[validateantiforgerytoken] public async task<actionresult> create(category category) { if (modelstate.isvalid) { try { await db.addcategoryasync(category); } catch (system.exception ex) { throw ex; } } return view(category); } here html: @using (html.beginform()) { @*@html.antiforgerytoken()*@ @html.validationsummary() <div class="body-content"> <h4>category</h4> <hr /> <div class=

php - Wordpress plugin: a safe way to store mySQL query contitions -

lets want create wordpress plugin, data plugins custom table in wordpress database , add content each post. woul propably someting this: select * $my_table time between $prevoius_post_time , $current_post_time order time limit 5000 there should way modify query posts editor add additional filters this, end like: select * $my_table time between $prevoius_post_time , $current_post_time && $filter order time limit 5000 , where $filer filterrow1 != 300 && filterrow2 >=7 , created using form ($_post) in backend before publishing new post. now not sure store $filer variable, little bit afraid of sql injections etc. safe enough store $filer in posts meta via update_post_meta() , receive get_post_meta() function before actual query? or missing other , better way? since filters may complex, dont see way of storing $filter array $key => $value , generate whole filter on each request. hei. can use $filter = mysql_real_escape_string($filter); or c

java - Different size for the cells -

i making application fine until worked on 5 -inch screen. when wanted check how application looks @ screen 3 inch. terribly enlarged. wish same on both screens. can system automatically detect size of device , have perform ? please help. you layout folder should this. res/layout/my_layout.xml // layout normal screen size ("default") res/layout-small/my_layout.xml // layout small screen size res/layout-large/my_layout.xml // layout large screen size res/layout-xlarge/my_layout.xml // layout large screen size res/layout-xlarge-land/my_layout.xml // layout large in landscape orientation in manifest add support-screens <supports-screens android:resizeable=["true"| "false"] android:smallscreens=["true" | "false"] android:normalscreens=["true" | "false"] android:largescreens=["true" | "false"] andr

jquery - Get substring between 2 certain characters -

for example have string: via_route_1;via_route_2;via_route_4;via_route_7; and supply function number (eg. 4), how can substring ;via_route_4 ? my aim delete substring, depending on number supply. i know how index of 4, example, how go backwards until find first ; , take whole substring thing? what that? using no custom functions manipulating string. /* string */ var s = "via_route_1;via_route_2;via_route_4;via_route_7;"; /* index of 4 */ var i1 = s.indexof("4"); /* substring first character 4 (including number) */ var sub1 = s.substring(1, i1 + 1); /* last index of ; in substring */ var i2 = sub1.lastindexof(";"); /* new substring starting ; */ var sub2 = sub1.substring(i2, sub1.length); console.log(sub2); logs ;via_route_4 .