title
stringlengths
15
150
body
stringlengths
38
32.9k
label
int64
0
3
Add animated jquery fade or slide effect to backgroundimage slider
<p>I would like to change this jQuery background image script so that the images will fade-in and fade-out smooth or by sliding one in or out.</p> <p>Right now the new image just pops-in what doesn't look good. Also can't figure out how to make the images load random.</p> <pre><code>(function ($) { var count = 0; var milliseconds = 4000; var transitionTime = 1500; var selector = "#target"; setInterval(function () { var images = ["images/pic1.png", "images/pic2.jpg"]; var tempImage = new Image(); tempImage.src = images[count]; $(tempImage).on("load", function () { $(selector).css("opacity", "0") .animate({ opacity: 1 }, { duration: transitionTime }); $(selector).css("background-image", "url(" + tempImage.src + ")"); }); if (count &lt; images.length - 1) { count++; } else { count = 0; } }, milliseconds); })(jQuery); </code></pre>
3
Adding punctuation in nested templates
<p>I am trying to add elements with a comma and a space in <code>&lt;album&gt;</code> if it is not the last <code>&lt;album&gt;</code> within a parent <code>&lt;recording&gt;</code>.</p> <p>I have a similar template for <code>&lt;recording&gt;</code>s, which works as expected. However, I cannot get the second template for the <code>&lt;album&gt;</code> punctuation to work correctly.</p> <p>I believe it has something do to with the first template existing...</p> <p><strong>Input XML</strong></p> <pre><code>&lt;sample&gt; &lt;collection&gt; &lt;recording&gt; &lt;artist&gt;Radiohead&lt;/artist&gt; &lt;album&gt;OK Computer&lt;/album&gt; &lt;/recording&gt; &lt;recording&gt; &lt;artist&gt;Tori Amos&lt;/artist&gt; &lt;album&gt;Boys For Pele&lt;/album&gt; &lt;album&gt;To Venus And Back&lt;/album&gt; &lt;/recording&gt; &lt;/collection&gt; </code></pre> <p></p> <p><strong>Sample XSLT</strong></p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"&gt; &lt;xsl:template match="node()|@*"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="node()|@*"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="collection"&gt; &lt;xsl:copy&gt; &lt;xsl:for-each select="recording"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="node() | @*"/&gt; &lt;/xsl:copy&gt; &lt;xsl:if test="position()!=last()"&gt; &lt;xsl:element name="x"&gt;, &lt;/xsl:element&gt; &lt;/xsl:if&gt; &lt;/xsl:for-each&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="recording"&gt; &lt;xsl:copy&gt; &lt;xsl:for-each select="album"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="node() | @*"/&gt; &lt;/xsl:copy&gt; &lt;xsl:if test="position()!=last()"&gt; &lt;comma&gt;, &lt;/comma&gt; &lt;/xsl:if&gt; &lt;/xsl:for-each&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; </code></pre> <p></p> <p><strong>But my output is</strong> </p> <pre><code>&lt;sample&gt; &lt;collection&gt; &lt;recording&gt; &lt;artist&gt;Radiohead&lt;/artist&gt; &lt;album&gt;OK Computer&lt;/album&gt; &lt;/recording&gt;&lt;x&gt;, &lt;/x&gt; &lt;recording&gt; &lt;artist&gt;Tori Amos&lt;/artist&gt; &lt;album&gt;Boys For Pele&lt;/album&gt; &lt;album&gt;To Venus And Back&lt;/album&gt; &lt;/recording&gt; &lt;/collection&gt; </code></pre> <p></p> <p><strong>Instead of what I want</strong> (note the <code>&lt;x&gt;</code>, after the first <code>&lt;album&gt;</code> in the second <code>&lt;recording&gt;</code>)</p> <pre><code>&lt;sample&gt; &lt;collection&gt; &lt;recording&gt; &lt;artist&gt;Radiohead&lt;/artist&gt; &lt;album&gt;OK Computer&lt;/album&gt; &lt;/recording&gt;&lt;x&gt;, &lt;/x&gt; &lt;recording&gt; &lt;artist&gt;Tori Amos&lt;/artist&gt; &lt;album&gt;Boys For Pele&lt;/album&gt;&lt;x&gt;, &lt;/x&gt; &lt;album&gt;To Venus And Back&lt;/album&gt; &lt;/recording&gt; &lt;/collection&gt; &lt;/sample&gt; </code></pre>
3
Import from execution path
<p>I have a setup like this:</p> <pre><code>projectpath/__main__.py projectpath/backend/__init__.py projectpath/backend/backend1.py projectpath/backend/backend2.py </code></pre> <p>The <code>__main__.py</code> imports and uses both backend files and <code>backend2.py</code> also imports and uses <code>backend1.py</code>. I used to do it like so:</p> <p><code>__main__.py:</code></p> <pre><code>import backend.backend1 import backend.backend2 </code></pre> <p><code>backend2.py:</code></p> <pre><code>import backend1 </code></pre> <p>And that worked, but now I am using mypy (Python static type checker), and that one requires all import paths to be relative to the <code>__main__.py</code>, so my backend2.py now looks like this:</p> <pre><code>import backend.backend1 as backend1 </code></pre> <p>mypy now says this is fine, but when I try to execute it, I get the following error:</p> <pre><code>Traceback (most recent call last): [...] File "./backend/backend2.py", line 1, in &lt;module&gt; import backend.backend1 as backend1 </code></pre> <p>Is there any way to allow imports in that style, so allowing imports from the execution path of <code>__main__.py</code>?</p>
3
cant run SELECT HAVING query in HIVEQL
<p>I have 2 columns in a table. Let's call them column A and B. I want to find A where the distinct count of B is more than 1. In SQL</p> <pre><code>select column_a from table1 group by column_a having count(distinct column_b) &gt; 1; </code></pre> <p>For some reason, this does not run in HIVE. the error keep on saying</p> <pre><code>error while compiling statement: failed: semanticexception [error 10002]: line 4:22 invalid column reference 'column_b' </code></pre>
3
Get list of apps using data
<p>How do I get a list of apps that can use data a display them on my screen . I have tried using intent.Action_Main . I saw some code on Internet but i could only find the list of all apps installed . </p>
3
Aurelia repeat.for for - some questions
<p>I am attempting to generate a form like this:</p> <pre><code>&lt;div class="col-xs-6" for.repeat="field in ${config.formMain}"&gt; &lt;div class="form-group"&gt; &lt;label&gt;${field.label &amp; oneTime}&lt;/label&gt; &lt;select if.one-time="field.controlType == 'select'" class="form-control"&gt; &lt;option value=""&gt;&lt;- Select -&gt;&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>where config is a variable in my view-model. </p> <p>A couple questions:</p> <p>1) I have tried both <code>for.repeat="field in ${config.formMain}"</code> and <code>for.repeat="field in config.formMain"</code> and neither syntax seems to work. How am I meant to access the array from the object?</p> <p>2) Is there any support for something like <code>for.repeat.one-time="field in ${config.formMain}"</code> where this would cause Aurelia to only execute the loop compilation once (which is useful in my case because the form is not going to chage) but keep the bindings inside the loop as default bindings (i.e. if I have a for.repeat inside of the outer one, it should update itself if the array it is iterating over changes)?</p> <p>Thanks in advance.</p>
3
Push holidays in users' calendar
<p>In our current environment, our employees book holidays in an SAP portal. There's a separate script that will send these holidays to the users' email calendar (currently Zimbra), so it's already filled in.</p> <p>Now we're currently migrating to Office 365, and we need to change our script. First glance was good, there's a pretty solid REST API available with methods that will do the job just fine.</p> <p>Unfortunately, the whole thing requires OAuth2. In our scenario, we won't be having any user interaction, we'd really want to use static credentials.</p> <p>I've been doing some googling, but to no avail. Is there a proper solution to our use case, without having to do anything dirty?</p> <p>Side-note: we'd like to use Java to get this done. But I find even less documentation about that. The EWS API looks like a potential solution, but it looks pretty deprecated.</p>
3
is there any method to check if both of the label text interupt together?
<p>Now current i am placing the text into the table cell, however, i wish to detect that if two label , if one of the label text hit another one, (do something)</p> <p>May i ask if the ios is able to achieve this with any method?</p>
3
Migrating specific SQL query to Spark's UDF
<p>I'm migrating the following function to a function to sql udf spark.</p> <pre class="lang-sql prettyprint-override"><code>DROP FUNCTION IF EXISTS anyarray_enumerate(anyarray); CREATE FUNCTION anyarray_enumerate(anyarray) RETURNS TABLE (index bigint, value anyelement) AS $$ SELECT row_number() OVER (), value FROM ( SELECT unnest($1) AS value ) AS unnested $$ LANGUAGE sql IMMUTABLE; </code></pre> <p>I do not get that spark sql output is similar to that obtained in SQL. Any help or idea?</p> <pre><code>demo=# select anyarray_enumerate(array[599,322,119,537]); anyarray_enumerate -------------------- (1,599) (2,322) (3,119) (4,537) (4 rows) </code></pre> <p>My current code is:</p> <pre><code>def anyarray_enumerate[T](anyarray: WrappedArray[T]) = anyarray.zipWithIndex // Registers a function as a UDF so it can be used in SQL statements. sqlContext.udf.register("anyarray_enumerate", anyarray_enumerate(_:WrappedArray[Int])) </code></pre> <p>Thank you</p>
3
AWS : monitoring if service is running
<p>We are using zabbix to monitor our instance, during the the instance creation chef-recipes install and register zabbix. We have modified the zabbix recipe to by-pass registration if it fails, so that the rest of the services are deployed and are functional. Is it possible to set up alarms in AWS to check if zabbix registration is successful ? In other word, how to setup custom monitors for a instance ?</p>
3
Twitter Intregration not working in fragment?
<p>I am using twitter4j lib,but it is not working in fragment.I have created a twitterShare java class but the fragment class is not migrating to the twitter class.I also added the twitter class but its not working. Here is my code of fragment class. <code>@Override public void onClick(View v) { switch (v.getId()) { case R.id.button8: try{ Intent intent=new Intent(getActivity(),TwitterView.class); startActivity(intent); } catch (NullPointerException e){ AlertDialog alert=new AlertDialog.Builder(context).create(); alert.setMessage(e.getMessage()); } break; </code><br> Here is my code of TwitterView.java. `</p> <pre><code>public class TwitterView extends AppCompatActivity implements View.OnClickListener { private static final String PREF_NAME = "twitter_oauth"; private static final String PREF_KEY_OAUTH_TOKEN = "oauth_token"; private static final String PREF_KEY_OAUTH_SECRET = "oauth_token_secret"; private static final String PREF_KEY_TWITTER_LOGIN = "isTwitterLogedIn"; private static final String PREF_USER_NAME = "befriendtest"; /* Any number for uniquely distinguish your request */ public static final int WEBVIEW_REQUEST_CODE = 100; private ProgressDialog pDialog; private static Twitter twitter; private static RequestToken requestToken; private static SharedPreferences mSharedPreferences; private EditText mShareEditText; private TextView userName; private View loginLayout; private View shareLayout; private String consumerKey = null; private String consumerSecret = null; private String callbackUrl = null; private String oAuthVerifier = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_twitter_view); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); initTwitterConfigs(); StrictMode.ThreadPolicy policy=new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); /* Check if required twitter keys are set */ if (TextUtils.isEmpty(consumerKey) || TextUtils.isEmpty(consumerSecret)) { Toast.makeText(this, "Twitter key and secret not configured", LENGTH_LONG).show(); return ; } loginLayout= findViewById(R.id.login_layout); shareLayout= findViewById(R.id.share_layout); mShareEditText=(EditText)findViewById(R.id.share_text); userName=(TextView)findViewById(R.id.user_name); loginLayout.setOnClickListener(this); shareLayout.setOnClickListener(this); /* Initialize application preferences */ mSharedPreferences = getSharedPreferences(PREF_NAME, 0); boolean isLoggedIn = mSharedPreferences.getBoolean(PREF_KEY_TWITTER_LOGIN, false); /* if already logged in, then hide login layout and show share layout */ if (isLoggedIn) { loginLayout.setVisibility(View.GONE); shareLayout.setVisibility(View.VISIBLE); String username = mSharedPreferences.getString(PREF_USER_NAME, ""); userName.setText(getResources ().getString(R.string.hello) + username); } else { loginLayout.setVisibility(View.VISIBLE); shareLayout.setVisibility(View.GONE); Uri uri = getIntent().getData(); if (uri != null &amp;&amp; uri.toString().startsWith(callbackUrl)) { String verifier = uri.getQueryParameter(oAuthVerifier); try { /* Getting oAuth authentication token */ AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier); /* Getting user id form access token */ long userID = accessToken.getUserId(); final User user = twitter.showUser(userID); final String username = user.getName(); /* save updated token */ saveTwitterInfo(accessToken); loginLayout.setVisibility(View.GONE); shareLayout.setVisibility(View.VISIBLE); userName.setText(getString(R.string.hello) + username); } catch (Exception e) { Log.e("Failed to login Twitter!!", e.getMessage()); } } } } @Override public void onClick(View v) { switch (v.getId()){ case R.id.login_layout: loginToTwitter(); break; case R.id.share_layout: final String status = mShareEditText.getText().toString(); if (status.trim().length() &gt; 0) { new updateTwitterStatus().execute(status); } else { Toast.makeText(this, "Message is empty!!", Toast.LENGTH_SHORT).show(); } } } private void saveTwitterInfo(AccessToken accessToken) { long userID = accessToken.getUserId(); User user; try { user = twitter.showUser(userID); String username = user.getName(); /* Storing oAuth tokens to shared preferences */ SharedPreferences.Editor e = mSharedPreferences.edit(); e.putString(PREF_KEY_OAUTH_TOKEN, accessToken.getToken()); e.putString(PREF_KEY_OAUTH_SECRET, accessToken.getTokenSecret()); e.putBoolean(PREF_KEY_TWITTER_LOGIN, true); e.putString(PREF_USER_NAME, username); e.apply(); } catch (TwitterException e1) { e1.printStackTrace(); } } /* Reading twitter essential configuration parameters from strings.xml */ private void initTwitterConfigs() { consumerKey = BuildConfig.CONSUMER_KEY; consumerSecret = BuildConfig.CONSUMER_SECRET; callbackUrl = getString(R.string.twitter_callback); oAuthVerifier = BuildConfig.OUTH_VERIFIER; } private void loginToTwitter() { boolean isLoggedIn = mSharedPreferences.getBoolean(PREF_KEY_TWITTER_LOGIN, false); if (!isLoggedIn) { final ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthConsumerKey(consumerKey); builder.setOAuthConsumerSecret(consumerSecret); final Configuration configuration = builder.build(); final TwitterFactory factory = new TwitterFactory(configuration); twitter = factory.getInstance(); try { requestToken = twitter.getOAuthRequestToken(oAuthVerifier); /** * Loading twitter login page on webview for authorization * Once authorized, results are received at onActivityResult * */ final Intent intent = new Intent(this, WebActivity.class); intent.putExtra(WebActivity.EXTRA_URL, requestToken.getAuthenticationURL()); startActivityForResult(intent, WEBVIEW_REQUEST_CODE); } catch (TwitterException e) { e.printStackTrace(); } } else { loginLayout.setVisibility(View.GONE); shareLayout.setVisibility(View.VISIBLE); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { String verifier = data.getExtras().getString(oAuthVerifier); try { AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier); long userID = accessToken.getUserId(); final User user = twitter.showUser(userID); String username = user.getName(); saveTwitterInfo(accessToken); loginLayout.setVisibility(View.GONE); shareLayout.setVisibility(View.VISIBLE); userName.setText(TwitterView.this.getResources().getString( R.string.hello) + username); } catch (Exception e) { Log.e("Twitter Login Failed", e.getMessage()); } } super.onActivityResult(requestCode, resultCode, data); } class updateTwitterStatus extends AsyncTask&lt;String,String,Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(TwitterView.this); pDialog.setMessage("Posting to twitter..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } @Override protected Void doInBackground(String... params) { String status = params[0]; try { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthConsumerKey(consumerKey); builder.setOAuthConsumerSecret(consumerSecret); // Access Token String access_token = mSharedPreferences.getString(PREF_KEY_OAUTH_TOKEN, ""); // Access Token Secret String access_token_secret = mSharedPreferences.getString(PREF_KEY_OAUTH_SECRET, ""); AccessToken accessToken = new AccessToken(access_token, access_token_secret); Twitter twitter = new TwitterFactory(builder.build()).getInstance(accessToken); // Update status StatusUpdate statusUpdate = new StatusUpdate(status); twitter4j.Status response = twitter.updateStatus(statusUpdate); Log.d("Status", response.getText()); } catch (TwitterException e) { Log.d("Failed to post!", e.getMessage()); } return null; } @Override protected void onPostExecute(Void aVoid) { /* Dismiss the progress dialog after sharing */ pDialog.dismiss(); Toast.makeText(TwitterView.this, "Posted to Twitter!", LENGTH_SHORT).show(); // Clearing EditText field mShareEditText.setText(""); } } </code></pre> <p>}</p>
3
MDB concurrent instances not starting
<p>I have a requirement where i need 40 threads to do a certain task (merging) and around 20 threads to do another task(persistence). Merging takes about 5X more time than persistence. I am using message driven beans to accomplish this concurrency.</p> <p>I created one MDB RecordMerger with the following configuration</p> <pre><code>@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "testing/RecordMerger"), @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "40") }) </code></pre> <p>and I did similar thing for persistence</p> <pre><code>@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "testing/RecordPersistor"), @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "20") }) </code></pre> <p>My configuration in tomee.xml is as follows</p> <pre><code> &lt;Container id="MyJmsMdbContainer" ctype="MESSAGE"&gt; ResourceAdapter = MyJmsResourceAdapter InstanceLimit = 40 &lt;/Container&gt; </code></pre> <p>The recordmerging queue has a very fast production, so there are always new elements in record merging queue. Record merging queue puts the data in Record Persistence queue.</p> <p>The problem that i am facing is that when record merger has been configured to use 40 threads, my tomee server does not instantiates record persistence MDB, which results in records being piled up in that queue. If i reduce the maxSession property of record merger to 20, both the MDB's start getting instantiated.</p> <p>Can any one please guide me what i need to do to ensure that both MDB's are running and record merger is having 40 threads.</p>
3
How can I edit firewall rules inside of a GPO using powershell?
<p>I know how to edit firewall rules via powershell on a local machine. How can I go about editing firewall rules that are specified in an group policy?</p> <p>I know I can just edit them via GPMC, but I am looking to change some remote addresses in bulk on a particular firewall rule</p> <p>This is for 2012R2.</p> <p>I am trying to use the open-netgpo command, but get this....</p> <pre><code>PS C:\Users\admin\Desktop&gt; $gpoSession = Open-NetGPO –PolicyStore lab.domain.edu\WindowsNetSysBaseFirewallPolicy Open-NetGPO : The parameter is incorrect. At line:1 char:15 + $gpoSession = Open-NetGPO –PolicyStore lab.brandeis.edu\WindowsNetSysBaseFirewal ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (MSFT_NetGPO:root/standardcimv2/MSFT_NetGPO) [Open-NetGPO], CimExceptio n + FullyQualifiedErrorId : Windows System Error 87,Open-NetGPO </code></pre> <p>What is going on here? Am I missing something? This should be pretty straight forward. This is an elevated powershell session on the domain controller itself.</p> <p>Other GPO's throw the same error. </p>
3
VBA: Excel evaluating incorrectly
<p>I have been hitting my head against the wall on why excel is evaluating something like 4 > 0 to be false...</p> <p>In vba I am applying the following R1C1 forumla:</p> <pre><code>=IF(AND(RC[-5]&gt;R1C15,RC[-4]&gt;2*R1C15,RC[-3]&gt;3*R1C15),""CORE"",""-"") </code></pre> <p>which when the macro is run, turns into:</p> <pre><code>=IF(AND(I2&gt;$O$1,J2&gt;2*$O$1,K2&gt;3*$O$1),"CORE","-") </code></pre> <p>However, if we look at the screenshot of at row 2 I2, J2, K2, are all set to the value of 4 which is greater than O1 value of 0, but excel evaluates it as false.</p> <p><a href="https://i.stack.imgur.com/gf0p0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gf0p0.png" alt="enter image description here"></a></p> <p>Why? Both the fields are formatted as numbers?</p> <p>full vba snippet:</p> <pre><code>Public Sub FormatCore() Rows("1:1").Select With ActiveWindow Range("B2").Select ActiveWindow.FreezePanes = False ActiveWindow.FreezePanes = True End With Range("N2").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=IF(AND(RC[-5]&gt;R1C15,RC[-4]&gt;2*R1C15,RC[-3]&gt;3*R1C15),""CORE"",""-"")" Range("N3").Select Range("N2").Select Dim total_rows As Double total_rows = Worksheets("Report").Cells(Worksheets("Report").Rows.Count, "A").End(xlUp).Row Selection.AutoFill Destination:=Range("N2: N" &amp; total_rows) End Sub </code></pre>
3
Adding a variable to applescript within obj-c
<p>Not sure if this one is possible in objective-c without having the script as a file and running it that way.</p> <pre><code> NSAppleScript *appleScriptGetHH = [[NSAppleScript alloc] initWithSource:@\ "tell application \"System Events\"\n \ tell process \"Grabee\"\n \ with timeout of 0 seconds\n \ get value of attribute \"AXValue\" of text area 1 of scroll area 1 of window \"Demo Window 1" \n \ end timeout \n \ end tell \n \ end tell"]; </code></pre> <p>This works perfectly, but what I would like to do is replace "Demo Window 1" with a string (as it will be changed dynamically in the program)</p> <p>When I use something like this</p> <pre><code>NSString *windowName = @"Green Window4"; </code></pre> <p>And then replace this line:</p> <pre><code>get value of attribute \"AXValue\" of text area 1 of scroll area 1 of window \"Demo Window 1" \n \ </code></pre> <p>With:</p> <pre><code>get value of attribute \"AXValue\" of text area 1 of scroll area 1 of window \"%@" \n \ </code></pre> <p>And </p> <pre><code>end tell", windowName]; </code></pre> <p>I receive an error that there are too many arguments, is there a way to do this without having the script separate?</p>
3
$interpolate an array instead of an object
<p>Is there any way I can use Angular's <code>$interpolate</code> with an array instead of an object?</p> <p>Example code:</p> <pre><code>var exp = $interpolate('Hello {{name}}!'); var res = exp({name: "foo"}); var exp2 = $interpolate('Hello {{0}}!'); var res2 = exp2(["foo"]); console.log(res); // Hello foo console.log(res2); // Hello 0 &lt;--- Should be "Hello foo" </code></pre>
3
Use ChainMapper with TableMapReduceUtil
<p>Is it possible to chain multiple mappers when the first mapper in the chain reads from a HBase table? That is, to use ChainMapper with TableMapReduceUtil?</p> <p>I'm trying to perform some transformations on each record retrieved from the HBase, but I'm not able to make it work.</p> <p>Here's a code snipped where are try to use the two:</p> <pre><code> Job job = new Job(hBaseConfig, "Retrieving data from HBase"); job.setJarByClass(DataRetrievalDriver.class); Scan scan = scanCreator.getScan(); TableMapReduceUtil.initTableMapperJob( table, scan, DataRetrievalMapper.class, Text.class, ElementWritable.class, job, true, SaltTableInputFormat.class ); ChainMapper.addMapper(job, TransformMapper.class, Text.class, ElementWritable.class, Text.class, ElementWritable.class, new Configuration()); SequenceFileOutputFormat.setOutputPath(job, new Path("out")); job.setReducerClass(Reducer.class); job.setNumReduceTasks(1); job.waitForCompletion(true); </code></pre>
3
dynamic Input generator for web applications
<p>I'm going to analyse web applications by using dynamic analysis. Now I need an input generator that could generate the input.</p> <p>Is there any open sourced tool achieve this?</p> <p>I've read lots of papers, such as Apollo, but it seems that they didn't publish their tool.</p> <p>Thank you</p>
3
Can't confirm sale orders after applying record rule
<p>In odoo 9, I have added a record rule on the model mrp.production as:</p> <pre><code>['|', ('user_id', '=', user.id), ('user_id', '=', False)] </code></pre> <p>This will show users only the MOs that belongs to them. Now when I am trying to confirm the sale order which will then create a MO for the lines in that sale order I am getting an access error as: </p> <pre><code>The requested operation cannot be completed due to security restrictions. Please contact your system administrator. (Document type: mrp.production, Operation: read) </code></pre> <p>Diagnosing more I found that it is causing due to the missing_ids. Take a look at <a href="https://github.com/odoo/odoo/blob/2d77941844b8eeb00514d401bad26704dce25a83/openerp/models.py#L3510" rel="nofollow">this</a>. </p> <p>Before that I have used the same solution in openerp 7 and it is still working perfect without any access error while confirming SO. </p>
3
I need example code for C++ connector to set "mysql_options"
<p>How to set timeout with mySQL C++ connector ? I tried this.. but it is compile error. </p> <pre><code>error: ‘class sql::Driver’ has no member named ‘mysql_options’ error: ‘MYSQL_READ_DEFAULT_FILE’ was not declared in this scope </code></pre> <p>code is here.</p> <pre><code>driver = get_driver_instance(); driver-&gt;mysql_options(MYSQL_READ_DEFAULT_FILE, "/my.cnf"); con = driver-&gt;connect(host, user, password); </code></pre> <p>I read this page ( <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html</a> ) but This page has no C++ "Example"... </p> <p>I need help !</p>
3
whats the difference between cache & http cache "reverse proxy"
<p>am having a bit of difficulty understanding the difference between the normal cache "memory,file,db,etc.." and the http caching "reverse proxy".</p> <p><strong>Example.</strong></p> <p>lets say i have a page divided into 3 parts.</p> <ul> <li>movies</li> <li>games</li> <li>apps</li> </ul> <p>and when i retrieve those parts from the db, i cache each part in its own key &amp; when a new data is entered to any of those parts i flush the cache and remake it including the new data, so now each part will only update if there is something new was added.</p> <p>on the other hand the http caching have something call <code>ESI</code> which u can include page partials that have a different cache life span from the main page which is perfect but </p> <p>why would i need to use it ? or what is the advantage over the first method ?</p> <p><strong>Edit</strong> </p> <blockquote> <ul> <li>this is slimier to what i was after but still, why would u use/continue to use the reverse proxy over the below ?</li> </ul> <p><a href="https://laracasts.com/series/russian-doll-caching-in-laravel" rel="nofollow">https://laracasts.com/series/russian-doll-caching-in-laravel</a> <a href="https://www.reddit.com/r/laravel/comments/3b16wr/caching_final_html_from_view/" rel="nofollow">https://www.reddit.com/r/laravel/comments/3b16wr/caching_final_html_from_view/</a> <a href="https://github.com/laracasts/matryoshka" rel="nofollow">https://github.com/laracasts/matryoshka</a></p> </blockquote>
3
Will tarantool helps in OpenVZ?
<p>I have a small OpenVZ container. 2 cores and 4096MB RAM.</p> <p>I have mysql database (overal size is 80MB InnoDb)</p> <p>When i do 100 queries like INSERT ON DUPLICATE KEY UPDATE, few of them executes longer than 1 seconds, always</p> <pre><code>mysql&gt; SHOW PROFILE; +----------------------+----------+ | Status | Duration | +----------------------+----------+ | checking permissions | 0.000040 | | creating table | 0.000056 | | After create | 0.011363 | | query end | 1.231525 | | freeing items | 0.000089 | | logging slow query | 0.000019 | | cleaning up | 0.000005 | +----------------------+----------+ 7 rows in set (0.00 sec) </code></pre> <p>When i turned off binary logging, it helped. So the problem maybe in hard drive. And occurs when binary log is writing during the query executing.</p> <p>Will it help, if i replace mysql with the tarantool? As i know tarantool also writes binlogs.</p> <p>I have percona mysql</p> <pre><code>mysql&gt; select version(); +-----------------+ | version() | +-----------------+ | 5.6.25-73.1-log | +-----------------+ 1 row in set (0.01 sec) </code></pre> <p>Here is the my.cnf</p> <pre><code>[client] default-character-set = utf8mb4 [mysql] # CLIENT # port = 3306 socket = /var/lib/mysql/mysql.sock default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci # GENERAL # user = mysql default-storage-engine = InnoDB socket = /var/lib/mysql/mysql.sock pid-file = /var/lib/mysql/mysql.pid # MyISAM # key-buffer-size = 32M myisam-recover = FORCE,BACKUP # SAFETY # max-allowed-packet = 16M max-connect-errors = 1000000 # DATA STORAGE # datadir = /var/lib/mysql/ # BINARY LOGGING # #log-bin = /var/lib/mysql/mysql-bin #expire-logs-days = 14 #sync-binlog = 1 # CACHES AND LIMITS # tmp-table-size = 128M max-heap-table-size = 128M query-cache-type = 1 query-cache-size = 32M max-connections = 1000 thread-cache-size = 128 open-files-limit = 65535 table-definition-cache = 1024 table-open-cache = 2048 # INNODB # innodb-flush-method = O_DIRECT innodb-log-files-in-group = 2 innodb-log-file-size = 256M innodb_log_buffer_size = 32M innodb-flush-log-at-trx-commit = 0 innodb-file-per-table = 1 innodb-buffer-pool-size = 1G innodb_buffer_pool_instances = 1 # LOGGING # log-error = /var/lib/mysql/mysql-error1.log log-queries-not-using-indexes = 1 slow-query-log = 1 slow-query-log-file = /var/lib/mysql/mysql-slow.log long_query_time = 1 log-queries-not-using-indexes = 1 #PERCONA log_slow_verbosity = microtime,query_plan,innodb </code></pre>
3
Using custom Qt plugin in Android application
<p>In my cross-platform application, I use custom-made qt geoservices plugin, and it works fine in desktop application. But, as soon as I try to use it in Android app, <a href="http://doc.qt.io/qt-5/qml-qtlocation-plugin.html" rel="nofollow">QML PLugin</a> object fails to load my plugin, but still can load qt built-in geoservices plugins like <strong>here</strong> or <strong>osm</strong>. Yet, I can load my plugin manually via <a href="http://doc.qt.io/qt-5/qpluginloader.html" rel="nofollow">QPluginLoader</a>:</p> <pre><code>QPluginLoader loader("libplugins_geoservices_libqtgeoservices_empty.so"); if (loader.load()) { qDebug() &lt;&lt; loader.metaData(); loader.unload(); } loader.setFileName("libplugins_geoservices_libqtgeoservices_osm.so"); if (loader.load()) { qDebug() &lt;&lt; loader.metaData(); loader.unload(); } </code></pre> <p>with output:</p> <pre><code>QJsonObject({"IID":"org.qt-project.qt.geoservice.serviceproviderfactory/5.0","MetaData":{"Experimental":false,"Features":["OfflineMappingFeature"],"Keys":["empty"],"Provider":"empty","Version":100},"className":"EmptyGeoServiceProviderFactory","debug":false,"version":328961}) QJsonObject({"IID":"org.qt-project.qt.geoservice.serviceproviderfactory/5.0","MetaData":{"Experimental":false,"Features":["OnlineMappingFeature","OnlineGeocodingFeature","ReverseGeocodingFeature","OnlineRoutingFeature","OnlinePlacesFeature"],"Keys":["osm"],"Provider":"osm","Version":100},"className":"QGeoServiceProviderFactoryOsm","debug":false,"version":328961}) </code></pre> <p>QML code:</p> <pre><code>Plugin { id: mapPlugin // name: "empty" // doesn't work name: "osm" // works fine Component.onCompleted: console.log(availableServiceProviders) // outputs: "here,osm,mapbox" } </code></pre> <p>I use Qt 5.5 for both desktop and android builds. </p>
3
PHP SOAP Server fail to read input values (return empy)?
<p>I have written soap server, soap client and wsdl file. When I call a function soap server cannot identify inputs. can someone please help me to fix this.</p> <p>WSDL file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/accounts/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="accounts" targetNamespace="http://www.example.org/accounts/"&gt; &lt;wsdl:types&gt; &lt;xsd:schema targetNamespace="http://www.example.org/accounts/"&gt; &lt;xsd:element name="addAcount"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="firstName" type="xsd:string" /&gt; &lt;xsd:element name="lastName" type="xsd:string"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="addAcountResponse"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="out" type="xsd:string"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="closeAccount"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="accountNumber" type="xsd:string"&gt;&lt;/xsd:element&gt; &lt;xsd:element name="accountHolder" type="xsd:string"&gt;&lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="closeAccountResponse"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="status" type="xsd:string"&gt;&lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:schema&gt; &lt;/wsdl:types&gt; &lt;wsdl:message name="addAcountRequest"&gt; &lt;wsdl:part element="tns:addAcount" name="parameters"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="addAcountResponse"&gt; &lt;wsdl:part element="tns:addAcountResponse" name="parameters"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="closeAccountRequest"&gt; &lt;wsdl:part name="parameters" element="tns:closeAccount"&gt;&lt;/wsdl:part&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="closeAccountResponse"&gt; &lt;wsdl:part name="parameters" element="tns:closeAccountResponse"&gt;&lt;/wsdl:part&gt; &lt;/wsdl:message&gt; &lt;wsdl:portType name="accounts"&gt; &lt;wsdl:operation name="addAcount"&gt; &lt;wsdl:input message="tns:addAcountRequest"/&gt; &lt;wsdl:output message="tns:addAcountResponse"/&gt; &lt;/wsdl:operation&gt; &lt;wsdl:operation name="closeAccount"&gt; &lt;wsdl:input message="tns:closeAccountRequest"&gt;&lt;/wsdl:input&gt; &lt;wsdl:output message="tns:closeAccountResponse"&gt;&lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:portType&gt; &lt;wsdl:binding name="accountsSOAP" type="tns:accounts"&gt; &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt; &lt;wsdl:operation name="addAcount"&gt; &lt;soap:operation soapAction="http://www.example.org/accounts/addAcount"/&gt; &lt;wsdl:input&gt; &lt;soap:body use="literal"/&gt; &lt;/wsdl:input&gt; &lt;wsdl:output&gt; &lt;soap:body use="literal"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;wsdl:operation name="closeAccount"&gt; &lt;soap:operation soapAction="http://www.example.org/accounts/closeAccount"/&gt; &lt;wsdl:input&gt; &lt;soap:body use="literal"/&gt; &lt;/wsdl:input&gt; &lt;wsdl:output&gt; &lt;soap:body use="literal"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:binding&gt; &lt;wsdl:service name="accounts"&gt; &lt;wsdl:port binding="tns:accountsSOAP" name="accountsSOAP"&gt; &lt;soap:address location="http://localhost:8888/testing/wsdl/service.php"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; &lt;/wsdl:definitions&gt; </code></pre> <p><strong>Soap client</strong>, In soap client I am trying to access close account function. That function has two parameters. </p> <pre><code>$wsdl = 'http://localhost:8888/testing/wsdl/service.php?wsdl'; $options = array('trace' =&gt; TRUE); $client = new SoapClient($wsdl, $options); $values = array( 'accountNumber' =&gt; 'sdfsd', 'accountHolder' =&gt; 'sfsdf' ); $response = $client-&gt;closeAccount($values); echo "&lt;pre&gt;"; print_r($response); echo "&lt;/pre&gt;"; </code></pre> <p><strong>soap server,</strong></p> <pre><code>class Exam { function closeAccount($accountNumber, $accountHolder){ $value = array('status'=&gt;$accountNumber); return $value; } } $server = new SoapServer("http://localhost:8888/testing/wsdl/addAccount.wsdl"); $server-&gt;setClass('Exam'); $server-&gt;handle(); </code></pre> <p>In soap server when I try to return $accountNumber it display value name "object". If I try to access $accountHolder it return blank. </p> <p>Why my soap server fail to read input values. please someone help me.</p>
3
When you declare a pointer, is it NULL?
<p>When you declare a pointer like <code>int* p;</code>. Is <code>p</code> initially <code>NULL</code>?</p>
3
Software located on different server as Database
<p>The question I have, is pretty simple, but though I want to know if someone as a better solution.</p> <p>The problem I have, is putting the MySQL database on a differen Server than the Software itself. I've heard, that there are security issues when declaring a different host than the "localhost" for the database, so I'm asking If any of you know of an answer or has an idea of how to deal with it.</p> <p>The Idea behind this task is the following:</p> <p>If I provide software to a customer, but don't want them to have access to the Source Code (which is pretty simple when the server is in their office), I put it on my own server and give them access to it. Then the customer says that they don't want us to have access to their data, they store in the database.</p> <p>So my question now is, how it's possible to have a solution which fits both needs. Mine, and those of the customer.</p> <p>I hope you can understand what I mean.</p> <p>Thank you for your help!</p>
3
Posting Quickbooks Online invoice without using CustomerRef
<p>How do I create an invoice in QBO without using the CustomerRef field? Every example just shows:</p> <pre><code>&lt;CustomerRef name="ACME Inc"&gt;2&lt;/CustomerRef&gt; </code></pre> <p>Do I ALWAYS have to look up the Id? Can't I just post to "ACME Inc" without finding the ref # (2)? The older QBXML did this no problem.</p> <p>Similarly for items, they all have it like this:</p> <pre><code>&lt;ItemRef name="Hours"&gt;2&lt;/ItemRef&gt; </code></pre> <p>How do I just specify "Hours" and have QB look it up for me?</p>
3
Office365 API access for all network users' calendars using c#
<p>So my main objective is to update network user's outlook calendar from sql server data using office365 api every few minutes. I am stuck at how to get access for other user's outlook calendar? Looked at below link but didnt asnwser much...do i need azure subscription in order to do this? If someone can point me to right direction, that would be great</p> <p><a href="https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks" rel="nofollow">https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks</a></p>
3
Cant access to wp admin appear a dot
<p>I installed WP and now when I try to access to the panel (<code>www.my_domain.com/wp-admin/</code>) I write the user and the password, but then only a dot appears.</p> <p>I installed it by softaculous.</p> <p>This is all I know, if you need more information please let me know.</p>
3
Why doesn't SchemaUpdate create this table?
<p>I am using NHibernate 4 and Fluent NHibernate to map classes to the database. The database is in an SQL Server 2008 Express instance. Why on earth using <code>SchemaUpdate</code> creates all tables expect this one:</p> <pre><code>public class UserMap : ClassMap&lt;UserModel&gt; { public UserMap() { this.Table("User"); this.Id(x =&gt; x.Id) .GeneratedBy.Native(); this.Map(x =&gt; x.Name) .Length(int.MaxValue) .Not.Nullable(); } } </code></pre>
3
Infragistics ultragrid cells not being selected
<p>When i press <code>ctrl</code> and hold <code>left button</code> on mouse and drag it across the grid.</p> <p>Cells are not being selected. What am i lagging? Please help.</p>
3
How to get values of array by powershell from Visual Studio
<p>Defined double array:</p> <pre><code>double[] doubleArray = {0.0, 1.0, 2.0}; </code></pre> <p>During debugging (VS2013) in "Package Manager Console" created varaible $doubleArray:</p> <pre><code>$doubleArray = $dte.Debugger.CurrentStackFrame.Locals | Where-Object {$_.name -Match "doubleArray"} </code></pre> <p>How can I get all <strong>values</strong> of the array via powershell?</p>
3
Ajax appended content selectors not responding
<p>I have a very peculiar problem where i'm get loading some content through ajax and then appending some more content to the newly added content</p> <p>I'm going to try an explain the scenario.</p> <p>First Ajax call</p> <pre><code> $.ajax({ url: href , dataType: 'html', success: function(data) { var response = $(data).find('#content').html(); $('#content').append(response) } }); </code></pre> <p>For simplicity sake lets assume that the content appended to the div content is </p> <pre><code> &lt;div id="wrap"&gt;&lt;/wrap&gt; </code></pre> <p>2nd Ajax Call ( some api )</p> <pre><code>$.ajax({ url: "https://api.tumblr.com/v2/blog/sometumblr.tumblr.com/posts?api_key=someapikey", dataType: 'jsonp', success: function(posts) { var postings = posts.response.posts, output = ''; for (var i in postings) { var p = postings[i]; output += '&lt;div class="p"&gt;&lt;div class="photo"&gt;&lt;img src=' + p.photos[0].original_size.url + '/&gt;&lt;/div&gt;&lt;/div&gt;'; } $.when($('#wrap').append(output)).then( masonry()); } }); </code></pre> <p>Masonry is a function that will be called after the output variable has been appended.</p> <p>The issue here is, because the div wrap was appended to the DOM i'm not able to select it and then append the new content in the variable content. I'm aware of event delegation and jquery's .on() function but they all require an event to be passed. Unfortunately .prepend or .html() don't need event handlers so it would not work.</p> <p>I've seen other nifty solutions using jquery's trigger and a custom event however in the masonry() function i need to pass the selector $('#wrap') as well so that solution would not suffice. Is the away to attach newly appended content to the DOM so that they can be used in the normal way.</p> <p>i.e is append</p> <pre><code> &lt;div id="wrap"&gt;&lt;/wrap&gt; </code></pre> <p>and can use </p> <pre><code> $('#wrap).html('some stuff') </code></pre> <p>Any pointers would be deeply appreciated.</p>
3
How do I make all my javascript external with the window onload function?
<p>I am trying to make all my JavaScript external including the onclick for the submit button, I have a commented out <code>window.onload</code> function that I can't get to work. When I remove the <code>onclick="checkInput();"</code> from the submit input and uncomment the <code>window.onload</code> event in the script , my form doesn't work. </p> <p>Can someone explain what I am doing wrong besides being new to JavaScript.I have included a working snippet, just not external, thanks for any guidance.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>/*---------------------------------------------- css settings for HTML div exactCenter ------------------------------------------------*/ @import url(http://fonts.googleapis.com/css?family=Raleway); #main{ width:960px; margin:50px auto; font-family:raleway; } span{ color:black; font-weight:bold; } h2{ background-color: white; text-align:center; border-radius: 10px 10px 0 0; margin: -10px -40px; padding: 30px; } hr{ border:0; border-bottom:1px solid blue; margin: 10px -40px; margin-bottom: 30px; } #form_layout{ width:300px; float: left; border-radius: 10px; font-family:raleway; border: 2px solid #ccc; padding: 10px 40px 25px; margin-top: -2px; } input[type=text],input[type=password]{ width:99.5%; padding: 10px; margin-top: 8px; border: 1px solid #ccc; padding-left: 5px; font-size: 16px; font-family:raleway; } input[type=submit]{ width: 100%; background-color:#0467fc; color: white; border: 2px solid #0467fc; padding: 10px; font-size:20px; cursor:pointer; border-radius: 5px; margin-bottom: 15px; } a{ text-decoration:none; color: cornflowerblue; } i{ color: cornflowerblue; } p{ font-size:16px; font-weight:bold; color:red; } </code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script&gt; //window.on onload functionload = function() { //document.getElementById('submit').onclick = function(evt) { //checkInput(); //}//end onload onclick &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="main"&gt; &lt;div id="form_layout"&gt; &lt;h2&gt;Palindrome Test&lt;/h2&gt; &lt;br&gt;Enter a 10 character Palindrome. &lt;!-- Form starts here--&gt; &lt;form name="pForm" id="pForm" method="post" &gt; &lt;label&gt;Palindrome:&lt;/label&gt;: &lt;input type="text" name="uput" id="uput"/&gt;&lt;br&gt; &lt;!-- ... all the other stuff ... --&gt; &lt;/form&gt;&lt;br&gt; &lt;input type='submit' id="submit" value="Check Palindrome" onclick="checkInput();"/&gt;&lt;br&gt; &lt;p&gt;&lt;span id="eMsg" class="error"&gt;&lt;/span&gt;&lt;p/&gt;&lt;br&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> </div> </div> </p> <pre><code> &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;isPalindrome&lt;/title&gt; &lt;script&gt; //window.on onload functionload = function() { //document.getElementById('submit').onclick = function(evt) { //checkInput(); //}//end window.onload Palindrome(str); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="main"&gt; &lt;div id="form_layout"&gt; &lt;h2&gt;Palindrome Test&lt;/h2&gt; &lt;br&gt;Enter a 10 character Palindrome. &lt;!-- Form starts here--&gt; &lt;form name="pForm" id="pForm" method="post" &gt; &lt;label&gt;Palindrome:&lt;/label&gt;: &lt;input type="text" name="uput" id="uput"/&gt;&lt;br&gt; &lt;!-- ... all the other stuff ... --&gt; &lt;/form&gt;&lt;br&gt; &lt;input type='submit' id="submit" value="Check Palindrome" onclick="checkInput();"/&gt;&lt;br&gt; &lt;p&gt;&lt;span id="eMsg" class="error"&gt;&lt;/span&gt;&lt;p/&gt;&lt;br&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
3
Filter custom post type by taxonomies
<p>I want to filter my custom post type <code>Job</code> by taxonomies. I have two taxonomies, <code>department</code> and <code>location</code>. I post my working code for only my first taxonomy. How can I modify it so that it will work for the second taxonomy too?</p> <pre><code>&lt;?php $term = isset($_GET['department']) ? sanitize_text_field($_GET['department']) : false; $selected = ''; $tax_query = ''; if ($term) { $term = get_term_by('slug', $term, 'department'); if (!empty($term-&gt;name)) { $selected = $term-&gt;name; $tax_query = array( array( 'taxonomy' =&gt; 'department', 'terms' =&gt; $term, ) ); } } ?&gt; &lt;form id="tool-category-select" class="tool-category-select" action="&lt;?php the_permalink(); ?&gt;" method="get"&gt; &lt;?php wp_dropdown_categories( array( 'orderby' =&gt; 'NAME', 'taxonomy' =&gt; 'department', 'name' =&gt; 'department', 'value_field' =&gt; 'slug', 'show_option_all' =&gt; 'Departments', 'selected' =&gt; $selected, ) ); ?&gt; &lt;input type="submit" name="submit" value="view"/&gt; &lt;/form&gt; </code></pre>
3
How to republish messages with pika and RabbitMQ
<p>I need to listen to RabbitMQ messages, process each message just a little bit, and submit it to another exchange. Each example I have seen so far includes either this:</p> <pre><code>reader_connection.ioloop.start() </code></pre> <p>or this:</p> <pre><code>writer_connection.ioloop.start() </code></pre> <p>Because I need to both receive and send messages, I probably need to run both loops at the same time. Is there a way I could accomplish that?</p>
3
How to execute forever command remotely without using full path?
<p>I am trying to execute “forever” command remotely using powershell but I am getting error</p> <blockquote> <p>'forever' is not recognized as an internal or external command</p> </blockquote> <p>Here is what I am doing. I have the node js script "MyNodeScript.js" which executes the forever command. The script is on the WebServer <strong>"MyWebServer1"</strong>. Node.Js and Forever is installed on MyWebServer1 globally.</p> <pre><code> var exec = require('child_process').exec; var _ = require('underscore'); var winston = require('winston'); var async = require('async'); var mycommand = 'forever -p ./logs --sourceDir ../wf_manager --workingDir ../wf_manager start -a --uid "ServiceApp" ServiceApp.js' function start(callback) { async.waterfall([ function (cb) { executeCommand(mycommand, false, cb); } ], function done(err) { if (err) { winston.error('failed to start all instances by forever:' + err); } else { winston.info('successfully started all instances by forever'); } callback(); }); } function executeCommand(command, skip, callback) { async.waterfall([ function (cb) { exec(command, cb); } ], function done(err) { if (err) { if (skip) { // skip the error callback(null); } else { callback(err); } } else { callback(null); } }); } module.exports = { executeCommand: executeCommand, start: start } start(function(){}); </code></pre> <p>On the same <strong>MyWebServer1</strong> under same folder i have a powershell script "MyPowerShellScript.ps1" which call this node script. The powershell script has only one line </p> <pre><code>node D:\myfolder\maintenance\MyNodeScript.js </code></pre> <p>I can run this powershell script locally on MyWebServer1 and it works fine. But when i try to execute this powershell script as below <strong>from remote machine</strong></p> <pre><code> invoke-command -computername MyWebServer1 -filepath \\MyWebServer1\MyFolder\maintenance\MyPowerShellScript.ps1 </code></pre> <p>i am getting error </p> <blockquote> <p>error: failed to start all instances by forever:Error: Command failed: C:\Windows\system32\cmd.exe /s /c "forever -p ./logs --sourceDir ../wf_manager --workingDir ../wf_manager start -a --uid "ServiceApp" ServiceApp.js"<br> + CategoryInfo : NotSpecified: (error: failed t...ServiceApp.js":String) [], RemoteException<br> + FullyQualifiedErrorId : NativeCommandError<br> + PSComputerName : MyWebServer1<br> 'forever' is not recognized as an internal or external command, operable program or batch file.</p> </blockquote> <p><strong>Note that i can execute the script remotely without any error if i update "MyNodeScript.js" and use full physical path for the forever command</strong></p> <pre><code> var mycommand = 'C:\\Users\\admin\\AppData\\Roaming\\npm\\forever -p ./logs --sourceDir ../wf_manager --workingDir ../wf_manager start -a --uid "ServiceApp" ServiceApp.js' </code></pre> <p>However i would like to use just forever command. The path is already added as Environment variable on MyWebServer1</p>
3
Using htonl/ntohl on a 32 bit integer that will be sent over a socket
<p>When I look up examples for htonl, it always returns a <strong>uint32_t</strong>. However, when I call htonl in VS2015 using Winsock2.h, it returns a <strong>u_long</strong>. </p> <p>On my machine, when I compile for 32 bit and for 64 bit, I get that the size of a u_long is 4 bytes. I read online, that in a 64 bit architecture a long should be 8 bytes. Will this ever be the case? I am worried that I will have compatibility issues if a u_long is not the same amount of bytes as uint32_t when the data is to be sent over the socket.</p> <p>TL;DR - Will a u_long always be 4 bytes? If not, how should you reliably send a 32 bit integer over a socket?</p>
3
zeromq 4.0 with openpgm: How can i use "pgm_setsockopt" to change PGM_MULTICAST_LOOP
<p>I try to change a socket option (PGM_MULTICAST_LOOP) in zeromq with openpgm support. There is a dedicated function 'pgm_setsockopt' to do that but its first argument is a pgm_sock_t * and my original socket is a void * obtained by pSubscriber = zsocket_new(_pZmqContext_X, ZMQ_SUB); If I call 'pgm_setsockopt' by casting pSubscriber to (pgm_sock_t *) it does not work. The question is: how do I "transform" a zsocket_new result pointer into a pgm_sock_t socket which can be used to call 'pgm_setsockopt' </p> <p>Thanks</p>
3
Dynamic generation of tests for an ActiveSupport::Concern
<p>I have a Concern defined like this:</p> <pre><code>module Shared::Injectable extend ActiveSupport::Concern module ClassMethods def injectable_attributes(attributes) attributes.each do |atr| define_method "injected_#{atr}" do ... end end end end </code></pre> <p>and a variety of models that use the concern like this:</p> <pre><code>Class MyThing &lt; ActiveRecord::Base include Shared::Injectable ... injectable_attributes [:attr1, :attr2, :attr3, ...] ... end </code></pre> <p>This works as intended, and generates a set of new methods that I can call on an instance of the class:</p> <pre><code>my_thing_instance.injected_attr1 my_thing_instance.injected_attr2 my_thing_instance.injected_attr3 </code></pre> <p>My issue comes when I am trying to test the concern. I want to avoid manually creating the tests for every model that uses the concern, since the generated functions all do the same thing. Instead, I thought I could use rspec's <code>shared_example_for</code> and write the tests once, and then just run the tests in the necessary models using rspec's <code>it_should_behave_like</code>. This works nicely, but I am having issues accessing the parameters that I have passed in to the <code>injectable_attributes</code> function.</p> <p>Currently, I am doing it like this within the shared spec:</p> <pre><code>shared_examples_for "injectable" do |item| ... describe "some tests" do attrs = item.methods.select{|m| m.to_s.include?("injected") and m.to_s.include?("published")} attrs.each do |a| it "should do something with #{a}" do ... end end end end </code></pre> <p>This works, but is obviously a horrible way to do this. Is there an easy way to access only the values passed in to the injectable_attributes function, either through an instance of the class or through the class itself, rather than looking at the methods already defined on the class instance?</p>
3
Image change between view templates stopping onclick dropdown menu?
<p>I placed an onclick dropdown menu in my top navigation bar. In the top navigation bar, I wanted to change this image in my <strong>new.html.erb</strong> view template: </p> <pre><code>&lt;li class="navigation-bar-right"&gt; &lt;span class="create"&gt; &lt;%= link_to image_tag("createpost.svg"),new_post_url, method: :get %&gt; &lt;/span&gt; &lt;/li&gt; </code></pre> <p>I copied the entire navigation bar code from <strong>application.html.erb</strong> &amp; added it to the top of <strong>new.html.erb</strong>, changing <em>createpost.svg</em> to <em>createone.svg</em> :</p> <pre><code>&lt;li class="navigation-bar-right"&gt; &lt;span class="create"&gt; &lt;%= link_to image_tag("createone.svg"),new_post_url, method: :get %&gt; &lt;/span&gt; &lt;/li&gt; </code></pre> <p>However, although the image changed, the onclick dropdown menu is no longer working in my <strong>new.html.erb</strong> view template..</p> <p>Tried many solutions &amp; can't figure this out. Any help would be amazing - thank you!!</p> <p><strong>application.html.erb</strong></p> <pre><code>&lt;% if user_signed_in? %&gt; &lt;ul class="navigation-bar"&gt; &lt;div class="navigation-bar-right-inset"&gt; &lt;li class="navigation-bar-right"&gt; &lt;span class="create"&gt; &lt;%= link_to image_tag("createpost.svg"),new_post_url, method: :get %&gt; &lt;/span&gt; &lt;/li&gt; &lt;li class="navigation-bar-right"&gt; &lt;span class="home"&gt; &lt;%= link_to image_tag("home.svg"), posts_url, data: {no_turbolink: true} %&gt; &lt;/span&gt; &lt;/li&gt; &lt;li class="navigation-bar-right" id="drop"&gt; &lt;span class="settings"&gt; &lt;a href="#"&gt; &lt;img class="#" src="/assets/settings.svg"&gt; &lt;/a&gt; &lt;/span&gt; &lt;ul class="dropdown"&gt; &lt;li&gt; &lt;%= link_to "Profile", edit_user_registration_path, method: :get %&gt; &lt;/li&gt; &lt;li&gt; &lt;%= link_to "Log out", destroy_user_session_url, method: :delete %&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/div&gt; &lt;/ul&gt; </code></pre> <p><strong>new.html.erb</strong></p> <pre><code>&lt;% if user_signed_in? %&gt; &lt;ul class="navigation-bar"&gt; &lt;div class="navigation-bar-right-inset"&gt; &lt;li class="navigation-bar-right"&gt; &lt;span class="create"&gt; &lt;%= link_to image_tag("createone.svg"),new_post_url, method: :get %&gt; &lt;/span&gt; &lt;/li&gt; &lt;li class="navigation-bar-right"&gt; &lt;span class="home"&gt; &lt;%= link_to image_tag("home.svg"), posts_url, data: {no_turbolink: true} %&gt; &lt;/span&gt; &lt;/li&gt; &lt;li class="navigation-bar-right" id="drop"&gt; &lt;span class="settings"&gt; &lt;a href="#"&gt; &lt;img class="#" src="/assets/settings.svg"&gt; &lt;/a&gt; &lt;/span&gt; &lt;ul class="dropdown"&gt; &lt;li&gt; &lt;%= link_to "Profile", edit_user_registration_path, method: :get %&gt; &lt;/li&gt; &lt;li&gt; &lt;%= link_to "Log out", destroy_user_session_url, method: :delete %&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/div&gt; &lt;/ul&gt; </code></pre> <p><strong>posts.js.coffee</strong></p> <pre><code>jQuery -&gt; $("#drop").click (e) -&gt; e.preventDefault() $(this).find(".dropdown").fadeToggle "fast" $(document).on "click", (e) -&gt; $trigger = undefined $trigger = $("#drop") $(".dropdown").fadeOut "fast" if $trigger isnt e.target and not $trigger.has(e.target).length </code></pre> <p><strong>CSS</strong> </p> <pre><code>ul li .dropdown { display: none; position: fixed; z-index:100; margin-top: -8px; } .dropdown li { list-style-type: none; padding: 8px; width: 70px; font-size: 11px; font-family: helvetica; } </code></pre>
3
Unable to delete the file in Linux
<p>I created the directory "science" using mkdir science from /home/anu directory. And typed chmod 664 science.</p> <p>step 2:- /home/abc/science -> created a file chemistry in it using touch chemistry and typed chmod 664 chemistry.</p> <p>Step 3:- Added new user to group anu using "usermod -aG anu user1" .</p> <p>Step4: Went to /home/user1 and typed rm -rf /home/anu/science/chemistry but got access denied even when i am a part of group anu.</p> <p>Please can you advise.</p>
3
How to filter rows based on criteria
<p>Consider this toy example where I have a very simple SQL table containing some partnumbers, prices and currency. I want to find the lowest price for each item. </p> <p>Hers is table <code>PRICELIST</code></p> <pre><code>PartNumber Price Currency 1 19 USD 1 10 CAD 1 18 GBP 2 15 USD 2 14 CAD 2 8 GBP 3 5 USD 3 1 CAD 3 11 GBP </code></pre> <p>I want to show the lowest price with the currency. This is the output I want:</p> <pre><code>PartNumber Price Currency 1 10 CAD 2 8 GBP 3 1 CAD </code></pre> <p>if I say <code>select partnumber, min(price) from pricelist group by partnumber</code></p> <p>the query will execute, but if I specify the currency:</p> <p><code>select partnumber, min(price),currency from pricelist group by partnumber</code></p> <p>Then I get an error saying: </p> <p>An expression starting with "CURRENCY" specified in a SELECT clause, HAVING clause, or ORDER BY clause is not specified in the GROUP BY clause or it is in a SELECT clause, HAVING clause, or ORDER BY clause with a column function and no GROUP BY clause is specified..</p> <p>I want to display the currency value for the row that has the lowest price. What should I do?</p> <p>database is DB2. </p> <p>By the way, this is a highly simplified example, in my actual query I have left joins to create larger sets, if that matters</p>
3
How to integrate CKFinder with CKEditor in xcrud Data management system?
<p>I'm using <code>xcrud</code> library data management system and I could load <code>ckeditor</code> by this code:</p> <pre><code>Xcrud_config::$editor_url = dirname($_SERVER["SCRIPT_NAME"]).'/../ckeditor/ckeditor.js'; </code></pre> <p>Now, how can I load <code>ckfinder</code> for <code>ckeditor</code> in <code>xcrud</code>?</p>
3
Access - If form maximized then allow scrollbars
<p>I have found this API that checks whether form is maximized : <a href="https://support.microsoft.com/en-us/kb/210190" rel="nofollow">ACC2000: How to Determine If a Form Is Maximized or Minimized</a></p> <p>Now I want to use this API to allow Scrollbars on form, If It's maximized. Problem is that when It get's maximized, scrollbars are not visible until I click on some control in detail section. Same way when form is restored - scrollbars don't dissapear until I click on some control. Any way to fix this ?</p> <p>I tried this (I have to click Field1 after this code, focus not working):</p> <pre><code>Private Sub Form_Current() If Maximized = True Then Me.ScrollBars = 2 Else Me.ScrollBars = 0 End If Me.Field1.SetFocus End Sub </code></pre> <p>and this (when seting Me.TimerInterval=0 nothing happens, otherwise It's working but keeps triggering timer event):</p> <pre><code>Private Sub Form_Timer() If Maximized = True Then Me.ScrollBars = 2 Else Me.ScrollBars = 0 End If Me.Field1.SetFocus Me.TimerInterval = 0 End Sub </code></pre>
3
How to alter the visual behavior of a ListViewItem in UWP?
<p>In UWP, every time a <code>ListViewItem</code> is selected, a storyboard is triggered to give the user the feeling the component is reacting to the pressure of a touch. That storyboard also changes the <code>ListViewItem</code>'s background color until it gets released.</p> <p>I have designed a <code>UserControl</code> which uses a <code>ListView</code> internally but would like to override this behavior as it doesn't really fit the application's proposed design.</p> <p>Bellow are the <code>VisualStateGroups</code> I tried to apply both to the <code>ListView</code> through its <code>ControlTemplate</code> and to <code>ListViewItem</code> through its <code>DataTemplate</code> definition as the former attempt failed.</p> <pre><code>&lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="CommonStates"&gt; &lt;VisualState x:Name="Normal" /&gt; &lt;VisualState x:Name="PointerOver" /&gt; &lt;VisualState x:Name="Pressed" /&gt; &lt;VisualState x:Name="PointerOverPressed" /&gt; &lt;VisualState x:Name="Disabled" /&gt; &lt;/VisualStateGroup&gt; &lt;VisualStateGroup x:Name="FocusStates"&gt; &lt;VisualState x:Name="Focused" /&gt; &lt;VisualState x:Name="UnFocused" /&gt; &lt;VisualState x:Name="PointerFocused" /&gt; &lt;/VisualStateGroup&gt; &lt;VisualStateGroup x:Name="SelectionStates"&gt; &lt;VisualState x:Name="Unselecting" /&gt; &lt;VisualState x:Name="Unselected" /&gt; &lt;VisualState x:Name="UnselectedPointerOver" /&gt; &lt;VisualState x:Name="UnselectedSwiping" /&gt; &lt;VisualState x:Name="Selecting" /&gt; &lt;VisualState x:Name="Selected" /&gt; &lt;VisualState x:Name="SelectedSwiping" /&gt; &lt;VisualState x:Name="SelectedUnfocused" /&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; </code></pre> <p>One possibility could be to bind the root grid of the <code>DataTemplate</code> to the <code>ItemsContainer</code> so that I could override the default behavior every time an item was selected. But I am not that versed in XAML and couldn't figure out the proper way of doing this by myself. </p>
3
What's the consequence of not adding "@Override"?
<p>Based off of <a href="https://stackoverflow.com/questions/94361/when-do-you-use-javas-override-annotation-and-why">this well loved question</a> I understand that the @Override annotation is a good coding practice so that we know we are actually Overriding the correct method. But, what's the consequence of not doing it, other than coding practice? Is there some underlying thing in Java that needs that annotation there?</p> <p>I'm asking because I'm generating Java ActiveMQ Message files from XSD files using <a href="https://jaxb.java.net/2.2.4/docs/xjc.html" rel="nofollow noreferrer">XJC</a>. But, in order to add "@Override" without doing hand edits I need to use a separate plug-in from what's available from XJC, which in my case is quite <a href="https://stackoverflow.com/questions/33525642/how-to-use-jaxb2-annotate-plugin-with-xjc-in-command-line">difficult knowing the dependencies</a>. The primary goal is to use XJC and my Ant build.xml to regenerate the Java message files at build time without any hand edits. </p>
3
Dinamic headers in Retrofit (1-2) do not work
<p>I'm trying to make authtoken <strong>GET</strong> request to my server. I'm trying to do in like this:</p> <pre><code>public interface FixedRecApi { public static final String ENDPOINT = "http://******.pythonanywhere.com/"; //@Headers("Authorization: Token ce7950e8d0c266986b7f972407db898810322***") this thing work well!! @GET("/auth/me/") Observable&lt;User&gt; me(@Header("Authorization: Token") String token); //this does not work at all! Observable&lt;User&gt; me(); } </code></pre> <p>So as you see, the line with explicit header: @Headers - works perfect. But when I try to pass it as a parameter - it says "no credentials provided". My application onCreate:</p> <pre><code>@Override public void onCreate() { super.onCreate(); ActiveAndroid.initialize(this); Retrofit retrofit = new Retrofit.Builder() .baseUrl(FixedRecApi.ENDPOINT) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory( GsonConverterFactory.create(new GsonBuilder() .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC) .excludeFieldsWithoutExposeAnnotation() .serializeNulls() .create())) .build(); service = retrofit.create(FixedRecApi.class); } </code></pre> <p>Have no idea what is wrong with this thing. Interceptors don't work either...</p>
3
createElement or appendChild not working
<p>I am trying to put an img element in a span element that I created dynamically with JavaScript. The problem is that the span element isn't showing in the DOM tree. However, the img elements are shown on the page and are nested in the div element (#playfield) that is hard coded in my html code. I really don't know what I'm doing wrong.</p> <pre><code>var playfield = document.getElementById("playfield"); var indexes = [0,1,2,3,4,5,6,7,8,9,10,11]; shuffle(indexes); for (var i = 0; i &lt; 12; i++) { var vak1 = document.createElement("span"); var kaart1 = document.createElement("img"); var path1 = "img/kaart" + indexes[i] + ".png"; var klasse1 = "img" + indexes[i]; kaart1.setAttribute("src", "img/achterkant.png"); kaart1.setAttribute("class", klasse1); kaart1.setAttribute("data-img", path1); kaart1.setAttribute("height", "150"); kaart1.setAttribute("width", "150"); kaart1.setAttribute("data-turned","false"); playfield.appendChild(vak1.appendChild(kaart1)); } </code></pre>
3
How to make has_two relationship in ruby on rails?
<p>I have an <code>employee</code> model and <code>address</code> model. Now employee can have two addresses one is <strong>permanent</strong> and other is <strong>temporary</strong>.</p> <p>I want the relationship that employee has two addresses one is permanent and other is temporary.</p> <p>Also how can I save address for the employee in employee's controller while creating employee?</p>
3
Do certain MSTest DataSource providers perform better than others?
<p>The MSTest <strong>DataSourceAttribute</strong> supports different data providers for data driven tests (<em>CSV, Excel, SQL, XML, MTM</em>, etc). I'm trying to determine if one is markedly faster or if they all have comparable performance. The MS documentation doesn't seem to address this. I suppose I could profile the different providers but thought I would ask first in case someone had experience with this.</p>
3
WordPress wpautop Not Working Inside Wrapper
<h1>Background</h1> <p>I am extending TinyMCE in the WordPress visual editor, and have added a button to wrap selected content in <code>&lt;section&gt;&lt;/section&gt;</code>, which is used on the front-end of my theme for a hero element.</p> <hr /> <h1>Problem</h1> <p>When I wrap text inside <code>&lt;section&gt;</code> tags, wpautop stops running. The <code>&lt;p&gt;</code> tags aren't added at all, which breaks things when the selection is multiple paragraphs worth.</p> <h3>Example:</h3> <p>This text is in the Text editor (not visual editor).</p> <pre><code>&lt;section&gt;This is paragraph one. This is paragraph one. This is paragraph two. This is paragraph two.&lt;/section&gt; </code></pre> <p>On the front end of the site, it should become:</p> <pre><code>&lt;section&gt;&lt;p&gt;This is paragraph one. This is paragraph one.&lt;/p&gt; &lt;p&gt;This is paragraph two. This is paragraph two.&lt;/p&gt;&lt;/section&gt; </code></pre> <p>No <code>&lt;p&gt;</code> tags are added though.</p> <h1>What I've Tried:</h1> <p>I've tried forcing the issue by putting in breaks myself, but they all just get removed.</p> <pre><code>var output = '&lt;section&gt;&lt;article&gt;' + text + '&lt;/article&gt;&lt;/section&gt;'; var output = '&lt;section&gt;&lt;article&gt;&lt;p&gt;' + text + '&lt;/p&gt;&lt;/article&gt;&lt;/section&gt;'; var output = '&lt;section&gt;&lt;article&gt;&lt;br&gt;' + text + '&lt;/br&gt;&lt;/article&gt;&lt;/section&gt;'; var output = '&lt;section&gt;&lt;article&gt;\n' + text + '\n&lt;/article&gt;&lt;/section&gt;'; var output = '&lt;section&gt;&lt;article&gt;\n\n' + text + '\n\n&lt;/article&gt;&lt;/section&gt;'; </code></pre> <p>No matter what I try, the new lines are slowly destroyed.</p> <h2><a href="https://i.stack.imgur.com/pShxZ.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pShxZ.gif" alt="enter image description here" /></a></h2> <h1>Question</h1> <p>Is there a way to force <code>wpautop</code> to run on content that already has another wrapper?</p>
3
Action script 3 walking animation
<p>i need some help. im trying to make my character walk both direction(left and right) and an idle animation when standing still. i manage to make the character walk to the right and make the idle animation work. now if I copy the code from the right button to the left button, the walking animation gets stuck in the first frame on both direction. I tried to experiment with it but with no luck. im sorry if i sounded noob. i just started with studying programming. </p> <p>here are the code that i used</p> <pre><code>RightBtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown); function mouseDown(e:MouseEvent): void { if(RightBtn){ isRight = true; } } RightBtn.addEventListener(MouseEvent.MOUSE_UP, mouseUp); function mouseUp(e:MouseEvent): void { if(RightBtn){ isRight = false; } } stage.addEventListener(Event.ENTER_FRAME, loop); function loop(Event){ if(isRight==true &amp;&amp; mcPlayer.x &lt; 750){ mcPlayer.x += 7; mcPlayer.gotoAndStop (2); mcPlayer.walkR.play (); } else{ mcPlayer.gotoAndStop (1) mcPlayer.Idle.play (); } } LeftBtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown2); function mouseDown2(e:MouseEvent): void { if(LeftBtn){ isLeft = true; } } LeftBtn.addEventListener(MouseEvent.MOUSE_UP, mouseUp2); function mouseUp2(e:MouseEvent): void { if(LeftBtn){ isLeft = false; } } stage.addEventListener(Event.ENTER_FRAME, loop2); function loop2(Event){ if(isLeft==true &amp;&amp; mcPlayer.x &gt; 65){ mcPlayer.x -= 7; mcPlayer.gotoAndStop (3); mcPlayer.walkL.play (); } else{ mcPlayer.gotoAndStop (1) mcPlayer.Idle.play (); } } </code></pre>
3
Move Node and NPM packages to offline environment
<p>I have a node installation and many node modules installed and working on my internet machine. I need to move this to a non-internet machine.</p> <p>I installed Node on the non-internet machine with no problems, but simply copy-pasting my project containing my node modules clearly was not enough. For example, I am using Gulp, and when I try to run Gulp I get <code>gulp is not recognized as an internal or external command</code>. However I can start node server itself just fine.</p> <p>How do I successfully move a project with tons of npm modules from one machine to another?</p>
3
How to instantiate a Java generic inner class in Scala?
<pre><code>// Parent.java public class Parent { public class Tuple3&lt;X, Y, Z&gt; { public final X x; public final Y y; public final Z z; public Tuple3(X x, Y y, Z z) { this.x = x; this.y = y; this.z = z; } public X _1() { return x; } public Y _2() { return y; } public Z _3() { return z; } } .... } </code></pre> <p>Then if I want to instantiate a <code>Tuple3&lt;String,String,Boolean&gt;</code> object in scala how do I write?</p>
3
Issue trying to access Date Picker on field in table using name
<p>In my project I have to convert all of my tables into Bootstrap dynatable format. I am working on the page where I have a table and the user will be able to modify the status and Status date depending on check box. For some reason I can not get the date picker to work on one of the columns in the table. Here is a partial set up of the table:</p> <pre><code>&lt;div class="panel-body"&gt; &lt;div class="flextable" id="updateResults"&gt; &lt;table id="checkedTable" class="tablesaw tablesaw-stack table-responsive" data-tablesaw-mode="stack"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt; SEL&lt;/th&gt; &lt;th&gt;Schedule Number&lt;/th&gt; &lt;th&gt;Contract Year&lt;/th&gt; &lt;th&gt;Status&lt;/th&gt; &lt;th&gt;Status Date&lt;/th&gt; &lt;th&gt;Approval ID&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;c:forEach var="row" items="${Updresults}"&gt; &lt;c:set var="sched" value="${row.getSCHEDULE_NUMBER()}" /&gt; &lt;c:set var="eftyear" value="${row.getEFT_CONTRACT_YEAR()}" /&gt; &lt;c:set var="EFTstatus" value="${row.getSTATUS()}" /&gt; &lt;c:set var="schedcombo" value="${sched}${eftyear}" /&gt; &lt;fmt:formatNumber var="schedTotl" value="${row.getTOTAL_AMOUNT()}" pattern="$##,###,##0.00" /&gt; &lt;tr&gt; &lt;td&gt; &lt;input style="width:50px;" type="checkbox" id="holdselectedSched" name="selectedSched" class="pullchecked" value="&lt;c:out value=" ${schedcombo} "/&gt;"/&gt; &lt;/td&gt; &lt;td id="ModifyScheduleNumber"&gt; &lt;c:out value="${row.getSCHEDULE_NUMBER()}" /&gt; &lt;/td&gt; &lt;td&gt; &lt;c:out value="${row.getEFT_CONTRACT_YEAR()}" /&gt; &lt;/td&gt; &lt;td&gt; &lt;select style="width:80px" id="ModifyStatus" name="ModifyStatus_&lt;c:out value=" ${schedcombo} "/&gt;" class="form-control"&gt; &lt;c:forEach items="${ModifyList}" var="statusValue"&gt; &lt;option value="${statusValue}" &lt;c:if test="${statusValue == UpdCMDStatus}"&gt; selected="selected"&lt;/c:if&gt; &gt;${statusValue}&lt;/option&gt; &lt;/c:forEach&gt; &lt;/select&gt; &lt;/td&gt; &lt;td&gt; &lt;input class="form-control" name="ModifyStatusDate_&lt;c:out value=" ${schedcombo} "/&gt;" type="text" value="${row.getSTATUS_DATE()}" /&gt; &lt;/td&gt; &lt;td&gt; &lt;c:out value="${row.getAPPR_HUD_EMPLOYEE()}" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>Here is my function to access the datepicker:</p> <pre><code>$(function() { $("input[name^='ModifyStatusDate_']").datepicker({ dateFormat: "yy-mm-dd" }); }); </code></pre> <p>Is the problem trying to use the wild card in the <code>&lt;input&gt;</code> in the function or an issue with the dynatable set up?</p>
3
Disabling Table of Contents links in Qualtrics
<p>I'm trying to customize a survey I'm building on Qualtrics so that certain items in the Table of Contents are disabled. Basically I want you to be able to use the TOC to navigate to previous pages, but not to be able to click on subsequent pages. This is not something I can customize just using the Qualtrics menu.</p> <p>I'm trying to add Javascript to each block to enable this feature, but can't get it to work. I looked into the html elements on my page and under a div labeled "ToC Sidebar", each element of my ToC is there with a unique id (e.g. "FL_34"), and there's an 'onclick' function under this element to go to link's page. I just want to set this to false. Apologies if this is obvious, I'm new to Qualtrics and Javascript.</p> <p>Here's what I have right now, any thoughts?</p> <pre><code>Qualtrics.SurveyEngine.addOnload(function() { $("FL_34").onclick = false; }); </code></pre>
3
linux - create a folder shortcut
<p>in html directory i have 2 domains,</p> <pre><code>example1.com example2.com </code></pre> <p>in both of them there is a folder called files</p> <pre><code>example1.com/files example2.com/files </code></pre> <p>I add in those folders same video files and my disk is full (coz i add same videos twice)</p> <p>so is there a way to create a shortcat example i to add files to<br> html/example1.com/files and html/example2.com/files will use those files from example1</p> <p>i tried this command</p> <pre><code>ln -s /html/example1.com/files /html/example2.com/files </code></pre> <p>but i get this error if i visit example2.com/files/video.mp4 </p> <pre><code>Forbidden You don't have permission to access /services/tmp/1.html on this server. Apache/2.2.15 (CentOS) Server at example2.com Port 80 </code></pre> <p>is there any other command that can do this</p>
3
SSIS steps executing before predecessor has completed
<p>I have a SSIS package that has just recently started running weirdly.</p> <p>The image below illustrates what I am saying. A number of steps are being executed before there predecessor has completed. </p> <p><a href="https://i.stack.imgur.com/R44MO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R44MO.png" alt="SSIS Package Example"></a></p>
3
TFSBuild Powershell step turning script arguments into strings. How to avoid this?
<p>I've configured the following arguments in a Powershell build step: <code>-protocol:http -portsToOpen 9512,9513,9512</code>.</p> <p>Once TFSBuild runs the whole script, it throws the following error:</p> <blockquote> <p>"System.Int32[]". Error: "Cannot convert "9512,9513,9515" to "System.Int32"</p> </blockquote> <p>The problem is TFSBuild is running the script sorrounding 9512,9513,9515 with quots (i.e. <code>'9512,9513,9515'</code>).</p> <p>Is there any solution for this? One possible workaround would be running <code>powershell.exe</code> from a Command build step... But I'd like to know if there's some direct solution to this issue.</p>
3
ActorRefs.Nobody being translated by remoting
<p>I'm using Akka.Remote to call from an ASP.NET web application to an actor in my back end (hosted as a Windows Service). As part of the code I'm looking up an actor on the remote system which may or may not exist.</p> <p>On the client the call is as follows...</p> <pre><code>var profileActor = await someRemoteActor.Ask&lt;IActorRef&gt;(new LoadProfile("[email protected]")); if (profileActor != ActorRefs.Nobody) { // Now do stuff with the profile ... } </code></pre> <p>On the remote side of things the code is doing this...</p> <pre><code>Receive&lt;LoadProfile&gt;(rq =&gt; { IActorRef child = ActorRefs.Nobody; if (ProfileExistsInTheDatabase(rq.Username)) { child = Context.ActorOf&lt;Profile&gt;(rq.Username); child.Tell(rq); } Sender.Tell(child); }; </code></pre> <p>This isn't the exact code, but shows the idea that if something is not found on the server side then ActorRefs.Nobody is returned.</p> <p>Now, the problem is that when ActorRefs.Nobody gets back to the client, it's been converted into a remote actor reference, which I wasn't expecting. I was expecting ActorRefs.Nobody to traverse the remoting layer and turn up as the same thing on the client. </p> <p>Am I wrong to expect this to work this way? I guess so, given that it doesn't work the way I expected, but some clarification would be nice.</p> <p>For now I've altered the code to return a message class that includes a flag to indicate whether the remote actor exists, but I'd rather be able to use ActorRefs.Nobody.</p> <p>Thanks in advance for your assistance. </p>
3
Affdex iOS SDK "set the licensePath property with a valid file path" error
<p>Using the iOS SDK, I tried to set the license token like this:</p> <pre><code>#ifndef YOUR_AFFDEX_LICENSE_STRING_GOES_HERE #define YOUR_AFFDEX_LICENSE_STRING_GOES_HERE @"090b118356d7c6afc08b6b58763...snip...56ade05a27c71c80f221" #endif </code></pre> <p>but when I tried to run your AffdexMe demo, it says</p> <pre><code>Detector Error. No license provided. </code></pre>
3
ZF2 placeholder does not appear in html code
<p>I am trying to make a simple login form. The username element</p> <pre><code> $this-&gt;add(array( 'name' =&gt; 'username', 'type' =&gt; 'Text', 'options' =&gt; array( 'label' =&gt; 'Username', 'placeholder' =&gt; '[email protected]' ), )); </code></pre> <p>The placeholder does not appear in the created form. Note that the 'label' appears correctly...</p> <p>If I set it in controller code, it appears</p> <p>$form->get('username')->setAttribute('placeholder',"[email protected]");</p> <p>Same problem for the button, I have to set</p> <p>$form->get('submit')->setValue('Signin');</p> <p>otherwise it just shows 'Add' for some reason...</p> <p>Any ideas on what may be the problem?</p>
3
"Can't write unknown attribute" to HABTM join table when using custom foreign key
<p>A User can HABTM Games and a Game can HABTM Users as Storytellers, to differentiate them from a later relationship where a Game will have many Users as Participants.</p> <p>Rails throws the error "can't write unknown attribute `user_id'" when I attempt to add the user-input User objects to @game.storytellers via the create method in the Games controller.</p> <p>I'm pretty sure the problem lies in my last migration (at the bottom of this post).</p> <p>models/user.rb </p> <pre><code>class User &lt; ActiveRecord::Base has_and_belongs_to_many :games, association_foreign_key: "storyteller_id" end </code></pre> <p>models/game.rb</p> <pre><code>class Game &lt; ActiveRecord::Base has_and_belongs_to_many :storytellers, class_name: "User", foreign_key: "storyteller_id" attr_accessor :storyteller_group end </code></pre> <p>controllers/games.rb</p> <pre><code> def create @game = Game.new(game_params) @game.storytellers &lt;&lt; params[:game][:storyteller_group].split(",").collect { |n| User.find_by(name: n) } respond_to do |format| if @game.save format.html { redirect_to @game, notice: 'Game was successfully created.' } format.json { render :show, status: :created, location: @game } else format.html { render :new } format.json { render json: @game.errors, status: :unprocessable_entity } end end end </code></pre> <p>views/games/_form.html.erb</p> <pre><code>&lt;%= form_for(@game) do |f| %&gt; [snip] &lt;!-- Additional storytellers--&gt; &lt;div class="field"&gt; &lt;%= f.label :storyteller_group, id: "create-game" %&gt; &lt;div class="input"&gt; &lt;%= f.text_field :storyteller_group, value: current_user.name %&gt; &lt;/div&gt; &lt;/div&gt; [snip] &lt;% end %&gt; </code></pre> <p>db/migrations/create_users.rb</p> <pre><code>class CreateUsers &lt; ActiveRecord::Migration def change create_table :users do |t| t.string :name t.index :name t.string :email t.index :email [snip] t.timestamps end end end </code></pre> <p>db/migrations/create_games.rb</p> <pre><code>Class CreateGames &lt; ActiveRecord::Migration def change create_table :games do |t| t.string :name t.text :description t.string :source t.timestamps end end end </code></pre> <p>db/migrations/games_users.rb</p> <pre><code>class GamesUsers &lt; ActiveRecord::Migration def change create_table :games_users, id: false do |t| t.belongs_to :game, index: true t.integer :storyteller_id, index: true end end end </code></pre>
3
How to pass object into function in JavaScript
<p>I am doing my assignment about ASP.NET MVC and ASP.NET WEB API I have database like:</p> <pre><code>ID, FirstName, Middle, LastName, DoB, Gender. </code></pre> <p>And I am using EF and ADO.NET to make connection from database to ASP.NET. I write a function <em>DoubleClickRow</em> like:</p> <pre><code>&lt;script language="JavaScript"&gt; function *DoubleClickRow*(thisRow) { var id = thisRow.ID //Get ID from a row with double click event but it does not shown on table. location.href="~/Employees/Details/ + "id" //Open a new page to display employee detail with id above. } &lt;/script&gt; </code></pre> <p>And a table like:</p> <pre><code> &lt;table class="table"&gt; &lt;tr&gt; &lt;th&gt; &lt;p&gt;Select&lt;/p&gt; &lt;/th&gt; &lt;th&gt; @Html.DisplayNameFor(model =&gt; model.FirstName) &lt;/th&gt; &lt;th&gt; @Html.DisplayNameFor(model =&gt; model.Middle) &lt;/th&gt; &lt;th&gt; @Html.DisplayNameFor(model =&gt; model.LastName) &lt;/th&gt; &lt;th&gt; @Html.DisplayNameFor(model =&gt; model.DoB) &lt;/th&gt; &lt;th&gt; @Html.DisplayNameFor(model =&gt; model.Gender) &lt;/th&gt; &lt;th&gt; @Html.DisplayNameFor(model =&gt; model.StartDate) &lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; @foreach (var item in Model) { //Data &lt;tr ondblclick="*DoubleClickRow*(this)"&gt; &lt;td&gt; &lt;input type="checkbox" /&gt; &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.FirstName) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.Middle) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.LastName) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.DoB) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.Gender) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; item.StartDate) &lt;/td&gt; &lt;td&gt; @Html.ActionLink("Details", "Details", new { id=item.EmployeeId }) &lt;/td&gt; &lt;/tr&gt; } &lt;/table&gt; </code></pre> <p>But It does not work. Please show my mistake, and help me to fix it.</p>
3
The django-markdown-bootstrap-widget is not showing properly
<p>I am django beginner and I have the following Problem. I want to define a model and us this model to generate a form with the markdown-widget. <a href="https://github.com/MSA-Argentina/django-bootstrap-markdown" rel="nofollow">https://github.com/MSA-Argentina/django-bootstrap-markdown</a></p> <p><strong>Model</strong></p> <pre><code>class ThesisAnmeldung(models.Model): forschungsfrage = models.CharField(max_length=500) def __str__(self): return self.forschungsfrage </code></pre> <p><strong>Form</strong></p> <pre><code>class Thesis(ModelForm): name = forms.CharField(widget= MarkdownEditor(attrs={'id': 'content','height': 150, } )) name2 = forms.CharField(widget= MarkdownEditor(attrs={'id': 'content2','height': 150, } ))# class Meta: model = ThesisAnmeldung fields = ('forschungsfrage',) widgets = {'name': MarkdownEditor(attrs={'id': 'content3','height': 150, } ) , } </code></pre> <p><strong>Problem</strong> <code>name</code> and <code>name2</code> are displayed correctly with the markdown-editor. Only the third field <code>forschungsfrage</code> shows the problem. i can only see a small standard textbox. It seems like the markdown-widget is not used. Is there any solution for this problem?</p> <p><a href="https://cloud.githubusercontent.com/assets/17302959/14015343/80e9e708-f1b8-11e5-9a7f-300440461452.PNG" rel="nofollow"><strong>Picture</strong></a></p>
3
C# Unload temp Appdomain while main Appdomain uses MethodInfo from temp
<p>I want to make a reloadable assembly function for scripting.(So i can debug scripts quicker)</p> <p>The dll generation works and loading too. The main problem is, that I`m using the functions of my temporary AppDomain in my main AppDomain. The dll seems to be linked to my main AppDomain too, because I cant delete it while the program is running. If I remove all MethodInfo references from my main AppDomain "context" then I have no problems deleting it.</p> <p>Here you can see how the program works:</p> <ul> <li>Generate DLL from external process</li> <li>Load DLL by (temp AppDomain).DoCallBack(...)</li> <li>Get Type &amp; MethodInfo and call it.</li> <li>AppDomain.Unload(temp AppDomain)</li> </ul> <p>So if I skip step 3, I have no problems deleten the dll. But I cant check if the return of the Function really shows the updated value (which i edit inside the script). </p> <p>I have posted the source code for each step here: 1.</p> <pre><code>//This actually isn`t as important for you Process assemblyGeneration = new Process(); assemblyGeneration.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + @"lib\AssemblyCompiler.exe"; assemblyGeneration.StartInfo.Arguments = "\"" + AppDomain.CurrentDomain.BaseDirectory + "script.dll\" \"" + source + "\" \"System.dll\""; assemblyGeneration.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; assemblyGeneration.StartInfo.UseShellExecute = true; assemblyGeneration.Start(); assemblyGeneration.WaitForExit(); assemblyGeneration.Dispose(); </code></pre> <p>2.</p> <pre><code> _appDomain.DoCallBack(() =&gt; { byte[] fileContent = File.ReadAllBytes(AppDomain.CurrentDomain.BaseDirectory + "script.dll"); AppDomain.CurrentDomain.Load(fileContent); }); </code></pre> <p>3.</p> <pre><code>MethodInfo info = _compiledScript.GetTypeFrom("LSCT.ScriptClass").GetMethod("DefineX"); var func = (Func&lt;double&gt;) Delegate.CreateDelegate(typeof(Func&lt;double&gt;), info); double x = func(); Console.WriteLine("Output was : " + x); </code></pre> <p>4.</p> <pre><code>AppDomain.Unload(_appDomain); </code></pre> <p>So is there a way to work around the issue, that I cant reload the DLL?</p>
3
Delete from a file
<p>If i have a customer record in a file how do i delete a customer record from that file if i have two customer name john doe but they have different phone numbers.Basically I want to know how to use the name and phone number to delete customer record from the file. Here is my code.</p> <pre><code>void deleteCustomerData() { string name, customerInfo, customerData; string email; string phoneNumber; string address; string deleteCustomer; int skip = 0; cout &lt;&lt; "Enter the name of the Customer record you want to delete: " &lt;&lt; endl; getline(cin, name); cout &lt;&lt; "Enter the phone number of the Customer record you want to delete: " &lt;&lt; endl; getline(cin, customerData); ifstream customerFile; ofstream tempFile; int tracker = 0; customerFile.open("customer.txt"); tempFile.open("tempCustomer.txt"); while (getline(customerFile, customerInfo)) { if ((customerInfo != name) &amp;&amp; !(skip &gt; 0)) { if ((customerInfo != "{" &amp;&amp; customerInfo != "}")) { if (tracker == 0) { tempFile &lt;&lt; "{" &lt;&lt; endl &lt;&lt; "{" &lt;&lt; endl; } tempFile &lt;&lt; customerInfo &lt;&lt; endl; tracker++; if (tracker == 4) { tempFile &lt;&lt; "}" &lt;&lt; endl &lt;&lt; "}" &lt;&lt; endl; tracker = 0; } } } else { if (skip == 0) skip = 3; else --skip; } } cout &lt;&lt; "The record with the name " &lt;&lt; name &lt;&lt; " has been deleted " &lt;&lt; endl; customerFile.close(); tempFile.close(); remove("customer.txt"); rename("tempCustomer.txt", "customer.txt"); } </code></pre>
3
How do EGit versions map to Git versions
<p>The Git Source Code Mirror on GitHub (<a href="https://github.com/git/git" rel="nofollow">https://github.com/git/git</a>) says that the most recent version of Git is 2.7.4. I'm using EGit 3.5.2 on Spring Tool Suite (Eclipse Luna SR1), so that version number obviously doesn't correspond to a Git version. Is there any way to trace back what version of Git this version of EGit is based off of? </p> <p>I checked here, but it only maps versions of EGit to versions of Eclipse...</p> <p><a href="https://wiki.eclipse.org/EGit/FAQ#What_is_Git.3F" rel="nofollow">https://wiki.eclipse.org/EGit/FAQ#What_is_Git.3F</a></p>
3
What is the easiest way to check if the two CRgn intersects?
<p>I use VS2010 and have:</p> <pre><code>CRgn rRgn1, rRgn2; </code></pre> <p>I'd expected a function like:</p> <pre><code>BOOL CRgn::Intersect(CRgn rRgn); </code></pre> <p>or</p> <pre><code>BOOL Intersect(CRgn rRgn1, CRgn rRgn2); </code></pre> <p>Already had search <a href="https://msdn.microsoft.com/ru-ru/library/077zk1zy(v=vs.100).aspx" rel="nofollow noreferrer">the official documentation</a> and <a href="https://stackoverflow.com/search?q=CRgn+%5Bmfc%5D+intersect">the SO</a> with no results.</p>
3
Django query on child records without getting duplicate rows
<p>I'm trying to write a Django query to find a set of parent records with certain kinds of child records. The problem is that a parent record with two children that match the search will included twice in the results.</p> <p>How can I get each parent once, even when it has more than one matching child?</p> <p>I've included a simple example below that demonstrates the problem. <code>Blog</code> is the parent, and <code>Entry</code> is the child. When I search for blogs that contain an entry with "Hello" in the title, I get two copies of Jimmy's blog.</p> <p>Here are the records I created and the query I tried:</p> <pre><code> b = Blog(name="Jimmy's Jottings") b.save() Entry(blog=b, headline='Hello, World!').save() Entry(blog=b, headline='Hello Kitty').save() blog_count = Blog.objects.filter(entries__headline__contains='Hello').count() assert blog_count == 1, blog_count </code></pre> <p>You can see there's only one blog, but the assert fails with a count of two.</p> <p>Here's the full example:</p> <pre><code># Tested with Django 1.9.2 import sys import django from django.apps import apps from django.apps.config import AppConfig from django.conf import settings from django.db import connections, models, DEFAULT_DB_ALIAS from django.db.models.base import ModelBase NAME = 'udjango' def main(): setup() class Blog(models.Model): name = models.CharField(max_length=100) tagline = models.TextField() def __str__(self): # __unicode__ on Python 2 return self.name class Entry(models.Model): blog = models.ForeignKey(Blog, related_name='entries') headline = models.CharField(max_length=255) body_text = models.TextField() def __str__(self): # __unicode__ on Python 2 return self.headline syncdb(Blog) syncdb(Entry) b = Blog(name="Jimmy's Jottings") b.save() Entry(blog=b, headline='Hello, World!').save() Entry(blog=b, headline='Hello Kitty').save() blog_count = Blog.objects.filter(entries__headline__contains='Hello').count() assert blog_count == 1, blog_count print('Done.') def setup(): DB_FILE = NAME + '.db' with open(DB_FILE, 'w'): pass # wipe the database settings.configure( DEBUG=True, DATABASES={ DEFAULT_DB_ALIAS: { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': DB_FILE}}, LOGGING={'version': 1, 'disable_existing_loggers': False, 'formatters': { 'debug': { 'format': '%(asctime)s[%(levelname)s]' '%(name)s.%(funcName)s(): %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'}}, 'handlers': { 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'debug'}}, 'root': { 'handlers': ['console'], 'level': 'WARN'}, 'loggers': { "django.db": {"level": "WARN"}}}) app_config = AppConfig(NAME, sys.modules['__main__']) apps.populate([app_config]) django.setup() original_new_func = ModelBase.__new__ @staticmethod def patched_new(cls, name, bases, attrs): if 'Meta' not in attrs: class Meta: app_label = NAME attrs['Meta'] = Meta return original_new_func(cls, name, bases, attrs) ModelBase.__new__ = patched_new def syncdb(model): """ Standard syncdb expects models to be in reliable locations. Based on https://github.com/django/django/blob/1.9.3 /django/core/management/commands/migrate.py#L285 """ connection = connections[DEFAULT_DB_ALIAS] with connection.schema_editor() as editor: editor.create_model(model) main() </code></pre>
3
libGDX Import Error , Guess -Cannot Be Resolved-
<p>I have a problem right here. I started a libgdx project, but I cannot run for test cause of this error. </p> <blockquote> <p>AccessibilityDelegate cannot be resolved.</p> </blockquote> <p>I guess it's a problem of importing because I had other errors like it, but it got fixed after importing <code>android.jar</code> but there is not import <code>android.view.View. AccessibilityDelegate</code> section in that jar. </p> <p>How can I import it and fix the problem? Thanks</p>
3
Cairo: grabbing the whole drawing as a pattern
<p>I am probably missing something conceptual about <code>cairo</code>. I draw using the following helper class:</p> <pre><code>struct GroupLock { GroupLock(Graphics &amp;g) : g_(g) { cairo_push_group(g_.cr); } ~GroupLock() { cairo_pop_group_to_source(g_.cr); cairo_paint(g_.cr); cairo_surface_flush(g_.surface); XFlush(g_.display); } private: Graphics &amp;g_; }; </code></pre> <p>All my drawing functions are of the form:</p> <pre><code>void drawSomething(Graphics &amp;g) { GroupLock lock{g}; (void)lock; ... // some drawing } </code></pre> <p>Each call to such a drawing function sets the <em>source</em> (by virtue of using <code>GroupLock</code>) and makes the previous <em>source</em> unreachable. How can I modify this code to "concatenate" the <em>source</em>s instead? I would like be able to grab the whole drawing as a pattern by doing:</p> <pre><code>cairo_pattern_t *p_ = cairo_get_source(g_.cr); cairo_pattern_reference(p_); </code></pre>
3
Is specifying a column from a named range more efficient than calculating over a complete column?
<p>Under the hood of <code>Excel</code> do you think if I use named ranges, for say <code>MAX</code> calculations, it will be more efficient e.g. </p> <p>I have a named range <code>myNmdRang</code> that is <code>A1:Z20000</code> with no data in the remainder of the sheet. Column A contains some numeric values. The named range might get adjusted in length tomorrow to 500k rows or just 100rows.</p> <p>Taditionally I do this to find the <code>MAX</code> in column 1:</p> <p><code>Max("A:A")</code> </p> <p>Is the following more efficient and/or takes up less storage? (can this be proved)</p> <p><code>Max(index(myNmdRang,0,1))</code></p>
3
How would one go about politely crawling a single website?
<p>I have recently taken an interest in web crawling and am aware of robots.txt guidelines, but I was interested in the specifics of what is considered "polite" in terms of pages processed per second and the number of threads that should be set crawling a single website at any given time. Any general guidelines are greatly appreciated as I don't want to be impolite, destructive, or risk getting blocked by a website.</p> <p>Also, I realize different websites will experience different amounts of strain based on my crawling, so any advice on how I can properly gauge this and account for it is welcome.</p>
3
merge flask_socketio into my own flask project
<p>I developed my restful api flask project (let's call it 'MYOWN').</p> <p>And then, because of some needs to implement functions like 'notification', 'chat', and so on, I tried to merge my project with simple <a href="https://github.com/miguelgrinberg/Flask-SocketIO/tree/master/example" rel="nofollow">socketIO example project</a>.</p> <p>I want to run my project with only one command below</p> <pre><code>&gt; ./manage.py runserver </code></pre> <p>In 'MYOWN's manage.py script, there exist </p> <pre><code>if __name__=='__main__': manager.run() </code></pre> <p>and it made me confused with "where do I insert script below to 'MYOWN'?".</p> <pre><code>socketio.run(app) </code></pre> <p>Is there any way to run 'MYOWN' and <a href="https://github.com/miguelgrinberg/Flask-SocketIO/tree/master/example" rel="nofollow">socketIO example project</a> same time?</p>
3
Shell command to open other shells and run commands
<p>I'm attempting to script a process to open two additional shell windows and send commands to them to run some node modules I have installed. This is my first time doing bash scripting so if I'm screwing something up please feel free to let me know.</p> <p>I have this script</p> <pre><code>#!/bin/bash # [-g] # [-h] # [-l &lt;location to start the http-server on --default ./&gt;] # [-p &lt;port to start the http-server on --default "8111"&gt;] run_gulp=false run_http=false run_http_port=8111 run_http_location=./ while getopts ghl:p: opt; do case $opt in g) run_gulp=true ;; h) run_http=true ;; l) run_http_location=$OPTARG ;; p) run_http_port=$OPTARG ;; \?) echo "Invalid option: -$OPTARG" &gt;&amp;2 ;; esac done if [ $run_gulp == true ] then start mintty "gulp" # this works fi if [ $run_http == true ] then start mintty "http-server $run_http_location -p $run_http_port" fi </code></pre> <p>I have it in a file called startdev in a folder that is on my PATH variable (I'm on Windows 10), so I can open up a shell from anywhere and type in <code>startdev -g</code> or <code>startdev -g -h</code> to run this.</p> <p>This all works, wonderfully I might add, when it opens the shell and sends the gulp command, it detects my gulpfile and is able to run the default task on it like I want it to. However, the http-server isn't doing the same thing, it just tells me <code>http-server ./ -p 8111: No such file or directory</code>.</p>
3
Is it possible to use Unsafe.CompareAndSwap with a memory position rather an offset with an object?
<p>Most of the Unsafe operations accept a memory position in order to perform the operation - for example:</p> <pre><code> Unsafe unsafe = Context.unsafe; long position = unsafe.allocateMemory(8); unsafe.putLong(position, 0); </code></pre> <p>However, the CAS operations as far a I can see do not offer this - they instead take an Object as one of the arguments:</p> <pre><code> unsafe.compareAndSwapLong(this, offset, expected, newvalue) </code></pre> <p>However, given the long which is at the position "position", how can I perform a CAS operation without it being a field within an object?</p>
3
Protractor with resolution based tests
<p>I'm just getting into testing my node app with Protractor. Running into an issue with various resolutions, sometimes buttons are hidden/show depending on the screen size &amp; making tests fail occasionally that shouldn't.</p> <p>Is there a way to set up my tests so that certain tests run with certain resolutions &amp; others are excluded?</p> <p>Can someone point me to some resources they've found?</p>
3
JasperSoft Server export to network drive
<p>As seen on the image below, I am trying to schedule PDF export <strong>on a network drive</strong> with JasperSoft Server, but the button is grey ("sortie vers le système de fichiers hôte"). Does anybody know the reason, or how to change it?</p> <p><a href="https://i.stack.imgur.com/Pp1RY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pp1RY.png" alt="JasperSoft Server Export"></a></p> <p>I am working locally on my machine with the newest community versions of "JasperSoft Server" and "JasperSoft Studio". </p>
3
How are do you handle dependencies for nested components in Angular2?
<h1>I'm running into this error:</h1> <pre><code>browser_adapter.js:76 Error: Cannot resolve all parameters for NestedComponent(undefined). Make sure they all have valid type or annotations. at NoAnnotationError.BaseException [as constructor] </code></pre> <h1>Here's the breakdown:</h1> <p>I have a service</p> <pre><code>@Injectable() export class MyService { doSomething() { console.log("This is a service, and it's doing stuff"); } } </code></pre> <p>That can be injected into components, like this, without issue:</p> <pre><code>@Component({ selector: 'parent-component', template: '&lt;p&gt;This works great!&lt;/p&gt;', providers: [MyService] }) export class ParentComponent { constructor(private _myService: MyService) {} ngOnInit() { this._myService.doSomething(); } } </code></pre> <p>I have problems, however, when I try to inject the service into nested components, like this:</p> <pre><code>@Component({ selector: 'nested-component', template: "&lt;p&gt;This doesn't work. :(&lt;/p&gt;", providers: [MyService] }) export class NestedComponent { constructor(private _myService: MyService) {} ngOnInit() { this._myService.doSomething(); } } </code></pre> <p>When I try to plug the nested component into the parent component, I get the error up there ^. How can I achieve this.</p> <pre><code>@Component({ selector: 'parent-component', template: '&lt;nested-component&gt;&lt;/nested-component&gt;', directives: [NestedComponent] }) export class ParentComponent { } </code></pre> <p>For what it's worth, I still run into that error, even when I include MyService in the bootstrap function of my app:</p> <pre><code>function main() { return bootstrap(App, [ // These are dependencies of our App HTTP_PROVIDERS, ROUTER_PROVIDERS, MyService, ELEMENT_PROBE_PROVIDERS // remove in production ]) .catch(err =&gt; console.error(err)); } document.addEventListener('DOMContentLoaded', main); </code></pre>
3
Azure: Could not contact CDS load balancer
<p>After running this scripts</p> <p>!/bin/bash</p> <pre><code>iptables -F iptables -X </code></pre> <p>set default policy to drop</p> <pre><code>iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -P FORWARD DROP </code></pre> <p>accept everything no matter port on localhost</p> <pre><code>iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT </code></pre> <p>allow input on port 22 (established connections auto accepted</p> <pre><code>iptables -A INPUT -p tcp --dport 22 -j ACCEPT </code></pre> <p>allow traffic going to specified outbound ports</p> <pre><code>iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT iptables -A INPUT -p tcp --dport 53 -j ACCEPT iptables -A OUTPUT -p tcp --dport 6667 -j ACCEPT iptables -A OUTPUT -p tcp --dport 6697 -j ACCEPT </code></pre> <p>drop anything that doesn't match the rules above</p> <pre><code>iptables -A INPUT -j DROP iptables -A OUTPUT -j DROP </code></pre> <p>then when I typed on terminal <code>yum -y update</code> or anything when I using yum I got this messages</p> <pre><code>Loaded plugins: langpacks, product-id, rhui-lb, search-disabled-repos Could not contact CDS load balancer southeastasia-cds2.cloudapp.net, tring others. Could not contact CDS load balancer southeastasia-cds3.cloudapp.net, tring others. Could not contact CDS load balancer southeastasia-cds1.cloudapp.net, tring others. Could not contact any CDS load balancers: southeastasia-cds2.cloudapp.net, southeastasia-cds3.cloudapp.net, southeastasi a-cds1.cloudapp.net, eastasia-cds4.cloudapp.net. </code></pre> <p>what are the ports for these load balancers for me to allow this in my firewall on redhat??</p>
3
Find which file declares bash environment
<p>Use case: adding <a href="https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion" rel="nofollow noreferrer">bash-completion</a> to dev-environment playbook.</p> <p>In OSX, I need to write to either <code>.profile</code> or <code>.bash_profile</code> via Ansible. I need to add some config lines to one of those files and would like to do so to whichever one exists. I need to add those lines to the first of those files that exists since <a href="https://stackoverflow.com/questions/18773051/how-to-make-os-x-to-read-bash-profile-not-profile-file">OSX looks for <code>.bash_profile</code>, <code>.bash_login</code>, then <code>.profile</code> and stops looking when it finds one of them</a>.</p> <p>Is there an environment variable I can use to determine which file was used to load the bash config?</p> <p>Is there a way to create a variable in Ansible that tells Ansible which of those files to write to, depending on the first one in the list (<code>.bash_profile</code>, <code>.bash_login</code>, <code>.profile</code>) that exists?</p> <p>I've tried this in my existing <code>playbook.yml</code>, which does not overwrite my initially stated var of "bash_config":</p> <pre><code> - hosts: localhost connection: local vars: bash_config: "{{ ansible_user_dir }}/.profile" tasks: - stat: path="{{ ansible_user_dir }}/.profile" register: bash_config when: bash_config.exists = true - stat: path="{{ ansible_user_dir }}/.bash_login" register: bash_config when: bash_config.exists = true - stat: path="{{ ansible_user_dir }}/.bash_profile" register: bash_config when: bash_config.exists = true </code></pre>
3
Share websocket data with multiple components in Angular 2
<p>I have 1 main component. Inside of this component i use WebSockets to receive data from the server. I receive an object with a range of fields inside it. The number of fileds can be from 0 till 10, for example. Each time i receive an object i use <code>forEach()</code> to take all fields. For each field i need to init a component, like this:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>self.dcl.loadIntoLocation(StreamComponent, self.elementRef, 'stream');</code></pre> </div> </div> </p> <p>If a copy of a component for current field of an object already exists, i need to update it with new received data within the view. The main my problem is i don't know how to pass the data from WebSockets to created component. I can create and init it, but i never mind how to pass data to it. Any ideas ?</p>
3
Animate markers
<p>I'm trying to understand how to animate markers when using <code>mapbox-gl</code>. I'm actually using the <code>Xamarin</code> binding of the 3.2.0.3 java library, so the problem might be there.</p> <p>I'm using the examples that we can find on the GitHub page, and mainly <a href="https://github.com/mapbox/mapbox-gl-native/blob/12fa5679ac5c735d315660fb93a632c53c81b32f/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/AnimatedMarkerActivity.java" rel="nofollow">this</a> example. This example shows that a simple <code>ValueAnimator</code> modifying the Position of the MarkerOptions object is enough to achieve a movement.</p> <p>All my attempts to move a marker failed: applying SetPosition on a MarkerOptions object has no effect.</p> <p>I've tried temporary solutions, like removing all the markers and re-add them. Either in an animator or by making my own logic in the Update event. But of course, markers are flickering because modifications to the map are not perfectly sync'ed with the thread UI.</p> <p>When reading the <code>mapbox-gl</code> source-code samples on the project page, it seems clear to me that using <code>Animator</code> on MarkerOptions is a good practice, but it just seems to fail no matter what I'm trying to do.</p> <p>Summary: Invoking <code>_myMarkerOptions.SetPosition(new LatLng(10, 10));</code> on an existing marker just has no effect.</p>
3
Standard .ocamlinit configuration
<p>I thought I set this up correctly, like explained on realworldocaml, but when I try to do</p> <pre><code>open Core;; </code></pre> <p>I get </p> <blockquote> <p>Unbound module Core</p> </blockquote> <p>I think this is related to .ocamlinit, but I don't know what else should I add / remove from it. </p> <pre><code>#use "topfind";; #thread;; #camlp4o;; #require "core.top";; #require "core.syntax";; #require "ppx_jane";; (* Added by OPAM. *) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -&gt; () ;; </code></pre> <p>I don't really understand if that try should be the first thing in the file (but I tried both version and I have the same result). What am I missing here?</p> <p>I looked over <a href="https://stackoverflow.com/questions/29225200/ocaml-unbound-module-core-with-ocamlinit-setup">this question</a>, but my situation isn't like that (I don't get all those errors, only the Unbound module one). </p>
3
How to get Monitoring data of Azure ARM Virtual Machine using .Net SDK
<p>How to get Monitoring data of Azure ARM Virtual Machine using .Net SDK.</p> <p>I tried using Microsoft.Azure.Insights and I am getting following error</p> <p><H1>Server Error in '/' Application.</H1></p> <pre><code> &lt;h2&gt; &lt;i&gt;Runtime Error&lt;/i&gt; &lt;/h2&gt;&lt;/span&gt; &lt;font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt; &lt;b&gt; Description: &lt;/b&gt;An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. &lt;br&gt;&lt;br&gt; &lt;b&gt;Details:&lt;/b&gt; To enable the details of this specific error message to be viewable on remote machines, please create a &amp;lt;customErrors&amp;gt; tag within a &amp;quot;web.config&amp;quot; configuration file located in the root directory of the current web application. This &amp;lt;customErrors&amp;gt; tag should then have its &amp;quot;mode&amp;quot; attribute set to &amp;quot;Off&amp;quot;.&lt;br&gt;&lt;br&gt; </code></pre>
3
TCL; saving multiple list with foreach command
<p>I do the following :</p> <pre><code>set q [list Phi1 Phi2 Phi3 Phi4 Phi5 Phi6 Phi7 Phi8 Phi9 Phi10 Phi11 Phi12 Phi13 Phi14 Phi15 Phi16 Phi17 Phi18 Phi19 Phi20 Phi21 Phi22 Phi23 Phi24 Phi25 Phi26 Phi27] </code></pre> <p>then I define my lists (from Phi1 to Phi27)</p> <pre><code>foreach l $q { for {set i 5} {$i&lt;17} {incr i 1} { set fx1 [nodeEigenvector $i 1 1] set fy1 [nodeEigenvector $i 1 2] set frot1 [nodeEigenvector $i 1 3] lappend $l [list $fx1] lappend $l [list $fy1] lappend $l [list $frot1] } } </code></pre> <p>Then I want to save those vector into a single file :</p> <pre><code>foreach aer $q { for {set re 1} {$re&lt;27} {incr re 1} { set Mode $aer set fo [open Modd.out a] puts $fo [list get $Mode] puts [list get $aer] close $fo } } </code></pre> <p>This doesn't work. I get a file with a list of "get Phi1" (27 times...) to Phi27... funny fact, when I type the command <code>puts [list get $Phi1]</code> I do obtain my data as expected at screen. Anyone could help me? If there is a simpler way to do it I'd like to know too ! (I am simply trying to build, populate, then save a matrix (27 vector)).</p>
3
Django - Show foreign key value infront of form selection value in filter_horizontal selection
<p>Noob here. In my "Student" model admin I have a filter_horizontal selection form that filters a field lessons_enrolled_in. </p> <p>Lessons_enrolled_in is a many to many to Lessons model which has a many to many Courses model.</p> <p>In my model admin filter-horizontal I want it to select the lesson (which it does) but I want the selections to simply list "Course name - Lesson name" instead of just "Lesson name". </p> <p>Do I need a custom form for this?</p>
3
R extracting numbers from a series .out files
<p>I have 35 files that are error output from another program. I can read them into R but I'm not sure how to extract a single value from all files. </p> <pre><code>ldf &lt;- list() # creates a list listcsv &lt;- dir(pattern = "error*") # creates the list of all the csv files in the directory for (k in 1:length(listcsv)){ ldf[[k]] &lt;- read.csv(listcsv[k],header=FALSE,fill=TRUE,skip=4) } </code></pre> <p>This code gives me the last line of each file but still has text and I just want the numbers added into a list that I can plot.</p> <p>Image of one output file, they are all the same: <a href="https://i.stack.imgur.com/FU2Il.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FU2Il.png" alt="Image of one output file, they are all the same."></a></p>
3
How to display more than one item retrieving data MySQL and Android
<p>I am currently following a tutorial on retrieving data utilizing an online sql database, volley and android. How ever i am having real trouble making it so that more than one item is displayed. It only displays 1 row of the table even if 5 records match. Any help on this would be much appreciated</p> <p>I added a loop to the php, which does work if i go through the url. exampleurl/id="1" displays all correct records in the browser. but im stuck on the java side as it only displays one item</p> <pre><code>while($res = mysqli_fetch_array($r)){ $result = array(); </code></pre>
3
What determines the Maven plugins versions in the <build> section of pom.xml?
<p>I'm using Eclipse Kepler with M2E. I've created an empty Eclipse project, directly converted to a Maven project. The pom.xml is cleaned: no dependency or build section, no parent POM. The Maven settings.xml is the default one: no info included. </p> <p>When consulting the <em>Effective POM</em> thanks to M2E, lots of plugins are present:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;testTCO&lt;/groupId&gt; &lt;artifactId&gt;testTCO&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;repositories&gt; &lt;repository&gt; &lt;snapshots&gt; &lt;enabled&gt;false&lt;/enabled&gt; &lt;/snapshots&gt; &lt;id&gt;central&lt;/id&gt; &lt;name&gt;Central Repository&lt;/name&gt; &lt;url&gt;http://repo.maven.apache.org/maven2&lt;/url&gt; &lt;/repository&gt; &lt;/repositories&gt; &lt;pluginRepositories&gt; &lt;pluginRepository&gt; &lt;releases&gt; &lt;updatePolicy&gt;never&lt;/updatePolicy&gt; &lt;/releases&gt; &lt;snapshots&gt; &lt;enabled&gt;false&lt;/enabled&gt; &lt;/snapshots&gt; &lt;id&gt;central&lt;/id&gt; &lt;name&gt;Central Repository&lt;/name&gt; &lt;url&gt;http://repo.maven.apache.org/maven2&lt;/url&gt; &lt;/pluginRepository&gt; &lt;/pluginRepositories&gt; &lt;build&gt; &lt;sourceDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\src\main\java&lt;/sourceDirectory&gt; &lt;scriptSourceDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\src\main\scripts&lt;/scriptSourceDirectory&gt; &lt;testSourceDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\src\test\java&lt;/testSourceDirectory&gt; &lt;outputDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\target\classes&lt;/outputDirectory&gt; &lt;testOutputDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\target\test-classes&lt;/testOutputDirectory&gt; &lt;resources&gt; &lt;resource&gt; &lt;directory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\src\main\resources&lt;/directory&gt; &lt;/resource&gt; &lt;/resources&gt; &lt;testResources&gt; &lt;testResource&gt; &lt;directory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\src\test\resources&lt;/directory&gt; &lt;/testResource&gt; &lt;/testResources&gt; &lt;directory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\target&lt;/directory&gt; &lt;finalName&gt;testTCO-0.0.1-SNAPSHOT&lt;/finalName&gt; &lt;pluginManagement&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt; &lt;version&gt;1.3&lt;/version&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt; &lt;version&gt;2.2-beta-5&lt;/version&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt; &lt;version&gt;2.1&lt;/version&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-release-plugin&lt;/artifactId&gt; &lt;version&gt;2.0&lt;/version&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/pluginManagement&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-clean-plugin&lt;/artifactId&gt; &lt;version&gt;2.4.1&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-clean&lt;/id&gt; &lt;phase&gt;clean&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;clean&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt; &lt;version&gt;2.5&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-testResources&lt;/id&gt; &lt;phase&gt;process-test-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;testResources&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;default-resources&lt;/id&gt; &lt;phase&gt;process-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;resources&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-jar&lt;/id&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;jar&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-compile&lt;/id&gt; &lt;phase&gt;compile&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;compile&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;default-testCompile&lt;/id&gt; &lt;phase&gt;test-compile&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;testCompile&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;version&gt;2.10&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-test&lt;/id&gt; &lt;phase&gt;test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;test&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-install-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.1&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-install&lt;/id&gt; &lt;phase&gt;install&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;install&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt; &lt;version&gt;2.7&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-deploy&lt;/id&gt; &lt;phase&gt;deploy&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;deploy&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt; &lt;version&gt;3.0&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-site&lt;/id&gt; &lt;phase&gt;site&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;site&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;outputDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\target\site&lt;/outputDirectory&gt; &lt;reportPlugins&gt; &lt;reportPlugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt; &lt;/reportPlugin&gt; &lt;/reportPlugins&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;default-deploy&lt;/id&gt; &lt;phase&gt;site-deploy&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;deploy&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;outputDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\target\site&lt;/outputDirectory&gt; &lt;reportPlugins&gt; &lt;reportPlugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt; &lt;/reportPlugin&gt; &lt;/reportPlugins&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;outputDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\target\site&lt;/outputDirectory&gt; &lt;reportPlugins&gt; &lt;reportPlugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt; &lt;/reportPlugin&gt; &lt;/reportPlugins&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;reporting&gt; &lt;outputDirectory&gt;C:\stuff\eclipse-jee-kepler_64\workspace\wosp\testTCO\target\site&lt;/outputDirectory&gt; &lt;/reporting&gt; &lt;/project&gt; </code></pre> <p>For example the version 2.5 of the plugin <em>maven-resources-plugin</em> is loaded. Why this version and not a more recent one?</p> <p>I know that I can overwrite this by specifying the plugin and the required version in the pom.xml, but I would like to know how these default version values are loaded.</p> <p>The super POM includes a part of the content of the effective POM but most of the plugins seem to come from nowhere.</p>
3
301 redirect for all pages with specific url pattern
<p>Want to redirect all the pages with specific url pattern to my new homepage</p> <p>Redirect all request with below pattern</p> <hr> <pre><code> http://somesite.com/pages/homepage/&lt;Anything&gt; </code></pre> <p>Sample URL TO BE REDIRECTED</p> <hr> <pre><code> http://somesite.com/pages/homepage/?pn=1&amp;cat=71 </code></pre> <p>New page to be redirected</p> <hr> <pre><code> http://somesite.com </code></pre>
3
Convert SYSDATETIMEOFFSET ( ) to HH:MM AM/PM
<p>I am using the query: </p> <pre><code>select LTRIM(RIGHT(CONVERT(CHAR(20), SYSDATETIMEOFFSET ( ), 22), 12)) as RecvdTime </code></pre> <p>It gives me: <code>6:27:16 PM</code></p> <p>I need to remove second part &amp; print it as <code>6:27 PM</code> (with one space between <code>27</code> &amp; <code>PM</code>)</p> <p>I tried to change the query but was not successful.</p> <p>I would appreciate any help.</p> <p>Thanks in Advance!</p>
3
ServiceStack "Customizable Fields"
<p>We've been using SS Customizable Fields ("fields=" on the query string) and I think we may be missing a configuration somewhere. For us, it seems that the field names are case-sensitive - if they don't match the DTO, they're not returned. However, this is not true for the example that's linked from the AutoQuery GitHub page (changing the casing still results in the correct fields coming back):</p> <p><a href="http://github.servicestack.net/repos.json?fields=Name,Homepage,Language,Updated_At" rel="nofollow">github.servicestack.net/repos.json?fields=Name,Homepage,Language,Updated_At</a></p> <p>What are we missing?</p> <p>Thanks!</p> <p>Here's a sample that exhibits the behavior we're seeing:</p> <p>AppHost:</p> <pre><code>using System.Configuration; using ServiceStack; using ServiceStack.Data; using ServiceStack.OrmLite; using ServiceStack.Text; namespace TestSS.Service { public class AppHost : AppHostBase { public AppHost() : base("TestSS Service", typeof(AppHost).Assembly) { } public override void Configure(Funq.Container container) { Plugins.Add(new AutoQueryFeature { EnableUntypedQueries = false }); Plugins.Add(new CorsFeature()); PreRequestFilters.Add((httpReq, httpRes) =&gt; { if (httpReq.Verb == "OPTIONS") httpRes.EndRequest(); }); container.Register&lt;IDbConnectionFactory&gt;( new OrmLiteConnectionFactory(ConfigurationManager.ConnectionStrings["TestSS"].ConnectionString, SqlServerDialect.Provider)); JsConfig.DateHandler = DateHandler.ISO8601; JsConfig.IncludeNullValues = true; JsConfig.EmitCamelCaseNames = true; } } } </code></pre> <p>DTOs:</p> <pre><code>using ServiceStack.DataAnnotations; namespace TestSS.DTO { public class Employee { [PrimaryKey] public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } [References(typeof(Department))] public int DepartmentId { get; set; } [Ignore] public Department Department { get; set; } } public class Department { [PrimaryKey] public int Id { get; set; } public string Name { get; set; } } } </code></pre> <p>Service:</p> <pre><code>using ServiceStack; using TestSS.DTO; namespace TestSS.Service.Services { [Route("/employees/{Id}", "GET")] public class SingleEmployeeRequest : QueryBase&lt;Employee&gt; { public string Id { get; set; } } [Route("/employees", "GET")] public class FindEmployeesRequest : QueryBase&lt;Employee&gt;, IJoin&lt;Employee, Department&gt; { } } </code></pre> <p>Try the following routes:</p> <pre><code>/employees?fields=FirstName,LastName &lt;-- works /employees?fields=firstname,LastName &lt;-- Only LastName returned /employees?fields=firstname,lastname &lt;-- All properties returned ? </code></pre> <p>Now, remove the <strong>IJoin</strong> from the FindEmployeesRequest in the Employee service and try the routes again.</p> <pre><code>/employees?fields=FirstName,LastName &lt;-- works /employees?fields=firstname,LastName &lt;-- works /employees?fields=firstname,lastname &lt;-- works </code></pre> <p>UPDATE:</p> <p>The casing issue is fixed with 4.0.55 but there seems to be one more odd behavior with this route:</p> <pre><code>/employees?fields=departmentid </code></pre> <p>The response contains both the DepartmentId <strong>AND</strong> Id properties and the ID values are actually the <strong>DepartmentId</strong> values. The same is true for this route:</p> <pre><code>/employees?fields=id,departmentid </code></pre>
3
Carousel bootstrap slide images using JQuery
<p>Guys I am using bootstrap to create an image slider and here is the code :</p> <pre><code>&lt;!-- my carousel START --&gt; &lt;div id="myCarousel" class="container carousel slide" data-ride="carousel"&gt; &lt;!-- Indicators --&gt; &lt;ol class="carousel-indicators"&gt; &lt;li data-target="#myCarousel" data-slide-to="0" class="active"&gt;&lt;/li&gt; &lt;li data-target="#myCarousel" data-slide-to="1"&gt;&lt;/li&gt; &lt;li data-target="#myCarousel" data-slide-to="2"&gt;&lt;/li&gt; &lt;li data-target="#myCarousel" data-slide-to="3"&gt;&lt;/li&gt; &lt;/ol&gt; &lt;!-- Wrapper for slides --&gt; &lt;div class="carousel-inner" role="listbox"&gt; &lt;div class="item active"&gt; &lt;!-- inside my carousel --&gt; &lt;div class="rows"&gt; &lt;!-- first HALF --&gt; &lt;div class="col-md-1"&gt;&lt;/div&gt; &lt;div id="firstHalfCarousel" class="col-md-4"&gt; &lt;/div&gt; &lt;div class="col-md-1"&gt;&lt;br&gt;&lt;br&gt;&lt;img id="scrollImage" style="margin-top : 0px; margin-top: 30px; margin-left : -50px;" src="images/scroll.png"/&gt;&lt;/div&gt; &lt;!-- second HALF --&gt; &lt;div id="secondHalfCarousel" class="col-md-6"&gt; &lt;p&gt; TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT &lt;/p&gt; &lt;br&gt; &lt;div style="float : right;"&gt; &lt;img id="leftArrow" class="arrowIcon" src="images/left.png"/&gt; &lt;img id="rightArrow" class="arrowIcon" src="images/right.png"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-2"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="item"&gt; &lt;!-- inside my carousel --&gt; &lt;div class="rows"&gt; &lt;!-- first HALF --&gt; &lt;div class="col-md-1"&gt;&lt;/div&gt; &lt;div id="firstHalfCarousel" class="col-md-4"&gt; &lt;/div&gt; &lt;div class="col-md-1"&gt;&lt;br&gt;&lt;br&gt;&lt;img id="scrollImage" style="margin-top : 0px; margin-top: 30px; margin-left : -50px;" src="images/scroll.png"/&gt;&lt;/div&gt; &lt;!-- second HALF --&gt; &lt;div id="secondHalfCarousel" class="col-md-6"&gt; &lt;p&gt; TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT &lt;/p&gt; &lt;/div&gt; &lt;div class="col-md-2"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="item"&gt; &lt;!-- inside my carousel --&gt; &lt;div class="rows"&gt; &lt;!-- first HALF --&gt; &lt;div class="col-md-1"&gt;&lt;/div&gt; &lt;div id="firstHalfCarousel" class="col-md-4"&gt; &lt;/div&gt; &lt;div class="col-md-1"&gt;&lt;br&gt;&lt;br&gt;&lt;img id="scrollImage" style="margin-top : 0px; margin-top: 30px; margin-left : -50px;" src="images/scroll.png"/&gt;&lt;/div&gt; &lt;!-- second HALF --&gt; &lt;div id="secondHalfCarousel" class="col-md-6"&gt; &lt;p&gt; TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT &lt;/p&gt; &lt;/div&gt; &lt;div class="col-md-2"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="item"&gt; &lt;!-- inside my carousel --&gt; &lt;div class="rows"&gt; &lt;!-- first HALF --&gt; &lt;div class="col-md-1"&gt;&lt;/div&gt; &lt;div id="firstHalfCarousel" class="col-md-4"&gt; &lt;/div&gt; &lt;div class="col-md-1"&gt;&lt;br&gt;&lt;br&gt;&lt;img id="scrollImage" style="margin-top : 0px; margin-top: 30px; margin-left : -50px;" src="images/scroll.png"/&gt;&lt;/div&gt; &lt;!-- second HALF --&gt; &lt;div id="secondHalfCarousel" class="col-md-6"&gt; &lt;p&gt; TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT &lt;/p&gt; &lt;/div&gt; &lt;div class="col-md-2"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- my carousel END --&gt; </code></pre> <p>Everything works perfectly but I am using my own icons and I gave them id <strong>leftIcon</strong> and <strong>rightIcon</strong>.</p> <p>The question is , how I could use jQuery or bootstrap classes to swap images using my own icons not bootstrap icons.</p> <p>Thanks</p>
3
Pegex grammar design
<p>Need parse text like the following:</p> <pre><code>optional free text @somemacro1( optional free text @somemacro2(SOME TEXT)@ or other optional free text )@ another free text </code></pre> <p>e.g. it is basically very simple:</p> <ul> <li>the source is an free text</li> <li>which could contain some macros in a form <code>@MACRONAME(</code> <em>some content</em> <code>)@</code></li> <li>the <em>some content</em> is again an free text which could contain some macro - e.g. the macros could be nested (see the above example)</li> <li>the result of the parsed macro is some string (based on the macro name)</li> </ul> <p>I want learn <a href="https://metacpan.org/pod/distribution/Pegex/lib/Pegex.pod" rel="nofollow">Pegex</a> so decided to use it for this task.</p> <p><strong>The question is: could someone help me with the Pegex-grammar for the above?</strong></p> <p>Is someone wondering what i already tried, here is my test source - isn't working. :(</p> <pre><code>package Rec { use 5.014; use warnings; use base 'Pegex::Receiver'; use Data::Dumper; sub gotrule { my($self, $got) = @_; say "Got rule:", $self-&gt;{rule}; return "GOT" . $self-&gt;{rule} . "RULE"; } } use 5.014; use warnings; use Data::Dumper; use Pegex::Parser; use Pegex::Grammar; my $source = &lt;&lt;'EOF'; free text @somemacro1( optional free text @somemacro2(SOME TEXT)@ or other optional free text )@ another free text EOF my $grammar_text = do {local $/; &lt;DATA&gt;}; my $grammar = Pegex::Grammar-&gt;new(text =&gt; $grammar_text); my $receiver = Rec-&gt;new; my $parser = Pegex::Parser-&gt;new( grammar =&gt; $grammar, receiver =&gt; $receiver); my $input = Pegex::Input-&gt;new(string =&gt; $source); my $ret = $parser-&gt;parse($input); __DATA__ %grammar test %version 0.0.1 start: seq* seq: | macro | text macro: / AT macro-name LPAREN content RPAREN AT / macro-name: / WORD+ / text: / ALL* / content: / ALL* / </code></pre>
3
When I refresh page, you can see a transition action?
<p>I have a little dilemma here. When I refresh the page in chrome I can see a transition action made by transition-duration on images and on the button on the bottom of the web page. The weird thing is that it does not happening on Firefox.On Mozilla it works without transition when you refresh the page. It works well only when you hover it. How can I fix it for chrome???</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } /* Ending of resets */ .container { width:1200px; height:1630px; background-color:grey; margin-left:auto; margin-right:auto; margin-bottom:10px; } .topmenu { width:1200px; height:30px; background-color:skyblue; margin-left:auto; margin-right:auto; } .topmenu ul { margin-left:100px; } .topmenu li { float:left; margin-left:30px; margin-top:4px; font-size:17px; color:black; } .topmenu a { color:black; } .logo2 { position:relative; font-size:35px; margin-top:20px; margin-left:150px; } .logo2 a { text-decoration:none; color:black; } .content { width:950px; height:350px; margin:30px auto; } .square1 { float:left; width:300px; height:300px; border-bottom:40px solid darkgrey; } .square1 img { -webkit-filter:blur(5px); filter:blur(5px); transition-duration:1s; cursor:pointer; } .square1 img:hover { -webkit-filter:blur(0); filter:blur(0); } .square2 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .square2 img { -webkit-filter:brightness(200%); filter:brightness(200%); transition-duration:1s; cursor:pointer; } .square2 img:hover { -webkit-filter:brightness(100%); filter:brightness(100%); } .square3 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .square3 img { -webkit-filter:contrast(200%); filter:contrast(200%); transition-duration:1s; cursor:pointer; } .square3 img:hover { -webkit-filter:contrast(100%); filter:contrast(100%); } .square4 { float:left; width:300px; height:300px; border-bottom:40px solid darkgrey; } .square4 img { -webkit-filter:drop-shadow(8px 8px 10px orange); filter:drop-shadow(8px 8px 10px orange); transition-duration:1s; cursor:pointer; } .square4 img:hover { -webkit-filter:drop-shadow(12px 12px 14px green); filter:drop-shadow(12px 12px 14px green); } .square5 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .square5 img { -webkit-filter:grayscale(100%); filter:grayscale(100%); transition-duration:1s; cursor:pointer; } .square5 img:hover { -webkit-filter:grayscale(0); filter:grayscale(0); } .square6 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .square6 img { -webkit-filter:hue-rotate(90deg); filter:hue-rotate(90deg); transition-duration:1s; cursor:pointer; } .square6 img:hover { -webkit-filter:hue-rotate(360deg); filter:hue-rotate(360deg); } .square7 { float:left; width:300px; height:300px; border-bottom:40px solid darkgrey; } .square7 img { -webkit-filter:invert(100%); filter:invert(100%); transition-duration:1s; cursor:pointer; } .square7 img:hover { -webkit-filter:invert(0); filter:invert(0); } .square8 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .square8 img { -webkit-filter:saturate(8); filter:saturate(8); transition-duration:1s; cursor:pointer; } .square8 img:hover { -webkit-filter:saturate(2); filter:saturate(2); } .square9 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .square9 img { -webkit-filter:sepia(100%); filter:sepia(100%); transition-duration:1s; cursor:pointer; } .square9 img:hover { -webkit-filter:sepia(0); filter:sepia(0); } .square10 { float:left; width:300px; height:300px; border-bottom:40px solid darkgrey; } .square10 img { -webkit-filter:opacity(30%); filter:opacity(30%); transition-duration:1s; cursor:pointer; } .square10 img:hover { -webkit-filter:opacity(100%); filter:opacity(100%); } .square11 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .square11 img { -webkit-filter:contrast(150%) brightness(200%); filter:contrast(150%) brightness(200%); transition-duration:1s; cursor:pointer; } .square11 img:hover { -webkit-filter:contrast(100%) brightness(100%); filter:contrast(100%) brightness(100%); } .square12 { float:left; width:300px; height:300px; margin-left:25px; border-bottom:40px solid darkgrey; } .loadmore { position:relative; margin:50px auto; width:100px; height:100px; border-radius:30px; background-color:orange; text-align:center; transition-duration:1s; } .loadmore:hover { background-color:skyblue; } .loadmore a { color:black; text-decoration:none; } .loadmore h1 { padding-top:37px; font-size:20px; font-weight:bold; } .footermenu { width:600px; height:30px; background-color:yellow; margin:10px auto; } .footermenu li { width:150px; height:30px; float:left; text-align:center; margin-top:5px; font-size:18px; } .footermenu a { color:black; text-decoration:none; } form { float:right; margin-right:140px; margin-top:-25px; z-index:999; } label { z-index:999; } input { width:150px; z-index:999; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Just Web&lt;/title&gt; &lt;meta name="description" content="" /&gt; &lt;meta name="keywords" content="" /&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt; &lt;meta name="viewport" content="width=device-width; scale=1" /&gt; &lt;link href="tristastyle.css" rel="stylesheet" type="text/css" /&gt; &lt;link rel="icon" href="images/favicon.ico"&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;div class="header"&gt; &lt;div class="topmenu"&gt; &lt;nav&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Project&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;menu&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;/div&gt; &lt;div class="logo2"&gt;&lt;a href="index.html"&gt;protosite&lt;/a&gt;&lt;/div&gt; &lt;form&gt; &lt;label for="fname"&gt;search&lt;/label&gt; &lt;input type="text" id="fname" name="fname"&gt; &lt;/form&gt; &lt;/div&gt; &lt;div class="content"&gt; &lt;div class="square1"&gt;&lt;img src="images/girls/image1.png"&gt;&lt;/div&gt; &lt;div class="square2"&gt;&lt;img src="images/girls/image2.png"&gt;&lt;/div&gt; &lt;div class="square3"&gt;&lt;img src="images/girls/image3.png"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="content"&gt; &lt;div class="square4"&gt;&lt;img src="images/girls/image4.png"&gt;&lt;/div&gt; &lt;div class="square5"&gt;&lt;img src="images/girls/image5.png"&gt;&lt;/div&gt; &lt;div class="square6"&gt;&lt;img src="images/girls/image6.png"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="content"&gt; &lt;div class="square7"&gt;&lt;img src="images/girls/image7.png"&gt;&lt;/div&gt; &lt;div class="square8"&gt;&lt;img src="images/girls/image8.png"&gt;&lt;/div&gt; &lt;div class="square9"&gt;&lt;img src="images/girls/image9.png"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="content"&gt; &lt;div class="square10"&gt;&lt;img src="images/girls/image1.png"&gt;&lt;/div&gt; &lt;div class="square11"&gt;&lt;img src="images/girls/image2.png"&gt;&lt;/div&gt; &lt;div class="square12"&gt;&lt;img src="images/girls/image3.png"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="loadmore"&gt; &lt;a href="#"&gt;&lt;h1&gt;Load more&lt;/h1&gt;&lt;/a&gt; &lt;/div&gt; &lt;div class="footermenu"&gt; &lt;nav class="navig"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Policy&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;FAQ&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
3
Blank page when served from subfolder in production
<p>after creating the project successfully in local i run </p> <pre><code>ember build --environment=production </code></pre> <p>it shows the following message</p> <pre><code>Build successful - 1766ms. </code></pre> <p>I copied all the files inside dist folder to a sub folder in my server the default route index.php works but no other routes are working. Do i need to copy any other folder to server ?</p>
3
addressing `data` in `geom_line` of ggplot
<p>I am building a barplot with a line connecting two bars in order to show that asterisk refers to the difference between them:</p> <p><a href="https://i.stack.imgur.com/WSNbf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WSNbf.png" alt="sample plot"></a></p> <p>Most of the plot is built correctly with the following code:</p> <pre><code>mytbl &lt;- data.frame( "var" =c("test", "control"), "mean1" =c(0.019, 0.022), "sderr"= c(0.001, 0.002) ); mytbl$var &lt;- relevel(mytbl$var, "test"); # without this will be sorted alphabetically (i.e. 'control', then 'test') p &lt;- ggplot(mytbl, aes(x=var, y=mean1)) + geom_bar(position=position_dodge(), stat="identity") + geom_errorbar(aes(ymin=mean1-sderr, ymax=mean1+sderr), width=.2)+ scale_y_continuous(labels=percent, expand=c(0,0), limits=c(NA, 1.3*max(mytbl$mean1+mytbl$sderr))) + geom_text(mapping=aes(x=1.5, y= max(mean1+sderr)+0.005), label='*', size=10) p </code></pre> <p>The only thing missing is the line itself. In my very old code, it was supposedly working with the following:</p> <pre><code>p + geom_line( mapping=aes(x=c(1,1,2,2), y=c(mean1[1]+sderr[1]+0.001, max(mean1+sderr) +0.004, max(mean1+sderr) +0.004, mean1[2]+sderr[2]+0.001) ) ) </code></pre> <p>But when I run this code now, I get an error: <code>Error: Aesthetics must be either length 1 or the same as the data (2): x, y</code>. By trying different things, I came to an awkward workaround: I add <code>data=rbind(mytbl,mytbl),</code> before <code>mapping</code> but I don't understand what really happens here.</p> <p>P.S. additional little question (I know, I should ask in a separate SO post, sorry for that) - why in <code>scale_y_continuous(..., limits())</code> I can't address data by columns and have to call <code>mytbl$</code> explicitly?</p>
3