Posts

javascript - Module pattern callback implementation -

I am re-writing a simple app using HTML / CSS / JavaScript which can be used for images using intervals Creates animations with, and there is a bunch of buttons that control these animations. It is scaling and really messing up, with a logic mixed with DOM manipulations via javascript via javascript script file. So I design module patterns Based on your app's description, is there a problem with this callback implementation for the module? Or with module implementation? In this example, what is the best way to declare private variables and access them through public APIs? Gates and Setters? Are they really necessary? I want to write a readable code but I do not want to do super-architect things. (function ($) {$ .module = function (options) {var module = {options: $. (): (Callback: {start: false}}, options), start : Function (callback) {//console.log ('personal start method'); if (callback === "type of function") {callback ();}}} // public API ret...

c# - What triggers change notification in DependencyProperties? -

I am looking for a database in C # and want to understand what types of changes in a property (supported by dependence assets) actually trigger the update notification to trigger targets. I use simple setup of classes where I can test change in nested properties (sub-properties): // person name With a public class person {public string name {get; Set; }} // Class is giving dependency property as a public class to the best friend Friends: dependencyobject {public stable dependencyprofitprofitproperty = dependencyability Registration ("BestFreend", Typef (Person), Typef (Friend)); Get Public Insurance BestFriend {Return (Person). Gate value (bestfried property); } Set {this.SetValue (BestFriendProperty, value); }}} Now I attach the property of any other class to BestFriendProperty (as a source). I expected that the update notifications only work through this binding if I use the set of bestfriends: myBoundFriends.BestFriend = new person (); // myBoundFriends is a kin...

javascript - Using twitter bootstrap modal to create a gallery with images/content -

This is what I am trying to do, but I do not know how I have seen the gallery plugins and the module Has merged with the carousel, but no one can do what I want to do. I have a grid of thumbnails on my site which, at the click, I want to open a standard bootstrap model. Once the modal is open, I want the ability to link to the content from the next item, so that you can round through the items in the gallery / grid by clicking Next / previous to close / reopen the modes without re-opening. I do not have the code to show you at this point but this plugin is close to what I want to do: Except I do not want it to open the full browser width / height , And it will behave more like standard bootstrap modal. Also, the bootstrap model separates me all and instead of keeping the image in the form of content, gives a little more control over the content of the model. Any thoughts? HELP appreciated. You can: Thumbnail: & lt; Div id = "thumbHolder" & gt; ...

ios - Logical AND with Swift Optional in IF statement -

I have two properties, one of them is optional, these are defined below: Var advertiseCompleteBlock: (() - & gt; ())! Var is Advertiser: Boole = Wrong; Now, if I try to use it in my code like this below, the compiler throws an error when the error code 254 is created and failed. (self advertiser and self replaceable comp block) {self.advertiseCompleteBlock (); } But if I change it like this then it works fine: if (self.isAdvertiser & self.advertiseCompleteBlock) {If (Self.advertiseCompleteBlock) {self.advertiseCompleteBlock (); }} Can someone explain how these two blocks of code are different and what is wrong here? If advertise is really optional, then maybe it should be declared with someone? Instead ! Who says that it will always come into being. I put my original code in a test file as a simple function and removed the references of my own and compiled it properly. I do not know what will be the 254 error. What exactly do you want this code? ...

Add a second Wordpress Loop that displays latest posts in single.php -

I am creating my own theme, but only basic knowledge of PHP is searching for a way to do it online Yes, but it can not seem to be across. This is my development server's URL: I have a secondary loop in each page on the sidebar, which displays all the late posts. This is straightforward on the main index.php file. I'm not sure where it starts working on the Single.php file. I understand that he understands the concept of wordpress loop, and why it will not work within the category of post page, but there is no way around it? Thanks Add it to your sidebar: $ today = getdate (); $ Sidebarquery = New WP_Query ('year ='. $ Today ["year"]. Amp; monthnum = '. $ Today ["Som"].' & Amp; day = '. $ Today ["mday"]) ; While ($ sidebarquery- & gt; is_pos ()) {$ sidebarquery- & gt; The_post (); Echo & lt; Li & gt; '. The_permalink (); . '& Lt; / Li & gt; '; }

android swipe to dismiss listview won't remove item -

Text after " . I am using an ArrayAdapter and use this code to create a swipe to dismiss the listener to dismiss the feature. SwipeSystemSystem LIST We Touch Listener Touch Listener = New SwipDescription ListWeight Touch Listener (See list, new swipiodisme list live touch listener. Desississ callback () {@ Override public boolean candis (status of int) {delete} N true;} @ Override public Whoid OnDismiss (ListView ListView Int [] reverseSortedPositions) {(int position: reverseSortedPositions) of {mAdapter.remove (mAdapter.getItem (status));} mAdapter.notifyDataSetChanged (for);}}); ListView.setOnTouchListener (touchListener); // Setting this scroll listener is essential to ensure that during the catalog view scrolling, // we do not search for swipe. ListView.setOnScrollListener (touchListener.makeScrollListener ()); But to swipe every time it looks like it did the work but trying to get the item back. The log cat does not have any exceptions to me. Did anyone have thi...

gradle - Solved: AppCompat / Chromecast in Android-L Preview -

status: I'm currently building my new version I am also in the process of app and chromecast integration for Android L The app works fine, as long as I enhance the theme. Content with my custom style, but does not show the cast button. Problem: As soon as I change to theme. AppCompat, it gives me an error: Error: Error retrieving parent for item: No resource found which gave the name '@android: style / Theme.AppCompat.Light DarkActionBar 'matches. And this also goes for the Holo theme too. This is my build.gradle (the Libs folder is empty btw): The applicable plugin: 'com.android.application' android { CompileSdkVersion 'android-L' buildToolsVersion "20.0.0" defaultConfig {applicationId "com.myapp.myapp" minSdkVersion 'android-L' targetSdkVersion 'android-L'versionCode 1 versionName "1.0"} {buildTypes release {runProguard false proguardFiles getDefaultProguardFile ( 'ProGuard-androi...

objective c - Unable to Press Buttons in a subView -

I have a subview of the rootViewController and when the call is done, the button can be pressed without error: Thread 1: EXC_BAD_ACCESS This is important code: AppDelegate: Main View Controller * MainVC = [[Main View Controller alloc] init]; Self.window.rootViewController = mainVC; and in the MainViewController class: Other ViewController * SomeView = [[OtherViewController alloc] init]; [Self.view addSubview: SomeView.view]; Loads OtherViewController xib as it executes the viewDidLoad stuff. However, when I try to push one of the buttons on the simulator (on OtherViewController ), I get the error above. More button code: IBOutlet UIImageView * image; // Other ViewController.m in other ViewController.h: (IBAction) button: (ID) Sender {Image.center = CGPointMake (Image.center.x + 1, Image.center.y); } There are breakpoints in Other ViewController.h and .m (everywhere with the button). No introduction has occurred in the program Adeliget: error UIAppli...

How to import local Python package in Amazon Elastic MapReduce (EMR)? -

I have two Python scripts that are targeted to run on the Amazon Lösich Map - as a Mapper and one of the reducers in the form of. I have recently expanded the mapper script, which requires some more local models which I have created so that they both live in a package called SentimentAnalysis. What is the correct way to import a Python script from the local Python package on S3? I tried to create the S3 keys that try to copy my file system, hoping that the relative path will work, but do not regret. What I am looking for in the log files after step 1: traceback (most recent call final): file "/ mnt / var / lib / hasoop / mapred / tasktracker / hadoop / Job Cache / Job_01407250000_0001 / try_201407250000_0001_m_000000_0 / work /./ sa_mapper.py ", in line 15, & lt; Module & gt; SentimentAnalysis Import NB, Error From LR Import: No SentimentAnalysis Name Module The related file structure is like this: sa_mapper.py sa_reducer.py SentimentAnalysis / NB Sentime...

java - Not printing out all of the statements written -

नमूना चलाने: लाइसेंस मान्यकर्ता एक अंतिम नाम दर्ज करें: ab bA एक अंतिम नाम दर्ज करें : एबीए बीए दर्ज करें जन्म के वर्ष: ए 12 वी दर्ज करें जन्म के वर्ष: 1 9 7 ड्रायवर का लाइसेंस संख्या दर्ज करें: ए 123-4567-9801-23 निरंतर मेरा कोड है: import java.util.Scanner; सार्वजनिक वर्ग पांच { निजी स्थिर स्ट्रिंग मिलनाललाइट (स्कैनर स्क) {System.out.println ("लाइसेंस सत्यापनकर्ता"); System.out.print ("अंतिम नाम दर्ज करें: अब बीए"); स्ट्रिंग लास्टनाम = स्क। एनएक्सटाइन ()। ट्रिम (); अगर (lastname.length () == 0) lastname = getLastName (sc); Int numspaces = 0; के लिए (int i = 0; i & lt; lastname.length (); i ++) {if (Character.isSpace (lastname.charAt (i))) {numspaces ++; } और अगर (! वर्ण। लिटटर (lastname.charAt (i))) {lastname = getLastName (sc); } यदि (numspaces & gt; 2) {lastname = getLastName (sc); }} वापस अंतिम नाम; } प्राइवेट स्टैटिक बूलियन कैरेक्टर (चार चारएट) {वापसी झूठी; } सार्वजनिक स्थैतिक स्ट्रिंग लेयर आइफबर्थ (स्कैनर स्क) {System.out.print ("जन्...

microdata - Local Business Locality and Region in rich snippet -

I am trying to markup my site with local business microdata. But the problem is that I am in Vietnam and what is the standard area and area in Vietnam do not know. Can anyone give me some guidance? thank you in advanced! and there are optional fields inside it. area refers to city, city, village etc. The area refers to those areas which are divided into a country which is probably either for Vietnam or it is a complete one.

apache - Static text on rewriterule -

I am trying different ways to create URLs like this: I have tried: RewriteRule ^ Postal-zip / ([0-9] +) $ code.php? Thecode = $ 1 [L] and RewriteRule ^ Postal-zip / ([0-9] +) $ post-zip / code. Php? Thecode = $ 1 [L] There are some more things but I have not got the result, do anyone have any ideas about this? Your rules look good. It looks like mod-rewrite is not turned on. First, before your rules, make sure that you have: option + follow link - to work for it, , set both to and If you are not sure if the mod_rewrite is also installed, phpinfo (); if you are unsure of .htaccess files; Look at the list of modules installed in the output of , by default, mod_rewrite is not enabled for .htaccess files If you are managing your own server, then Open httpd.conf and make sure that there is one of these lines in the WebRot directory block: Allow Override File InfoSo or Allow All Code>

What's the difference between rand() and mt_rand(), as of PHP 5.4? -

आधिकारिक दस्तावेज के अनुसार, mt_rand () रैंड () से चार गुना तेज होनी चाहिए। लेकिन मैंने जो दावों को पढ़ा है, उसके बाद दो के बीच कोई अंतर नहीं है, मैं (जो PHP 5.4 है)। परिणाम लगभग समान है। तो, PHP 5.4 और उसके बाद के लिए रैंड () और mt_rand () के बीच अंतर क्या है? मैं किसको उपयोग करने के लिए निर्धारित करता हूं? एक झपकी से चार गुना तेज अभी भी एक झपकी है विशेष रूप से इसे एक अंतर्निहित समारोह में एक व्याख्याकृत भाषा में माना जाता है, प्रदर्शन को यह सबसे विशिष्ट विशेषता नहीं होना चाहिए। के अनुसार: डिफ़ॉल्ट रूप से, PHP रैंड () फ़ंक्शन के साथ libc यादृच्छिक संख्या जनरेटर का उपयोग करता है। Mt_rand () फ़ंक्शन इस के लिए एक ड्रॉप-इन प्रतिस्थापन है। इसका इस्तेमाल करते हुए ज्ञात विशेषताओं के साथ एक यादृच्छिक संख्या जनरेटर का उपयोग करता है, जो कि औसत लिबसी रेंड () प्रदान करता है, की तुलना में चार गुणा तेजी से यादृच्छिक संख्या का उत्पादन करेगा।

php - Force login after ajax request -

KP php 2.4 via IP. My problem sometimes after the session is inactive or logout in another tab The request does not work because the user has already been logged out. My question is how can I verify the user to redirect to the login page. My function, which is used to filter my requests, is used on my user control class // class UsersController public function beforefilter () {parent: beforeFilter (); // Allow user to log out $ this- & gt; Auth-> Allow ('logout'); } thanks if (! $ - & gt; Session-> Read ('Auth.User')) {// Redirect Here}

c# - jquery Ajax responsetext "There was an error processing the request" -

I am getting this error "There was an error processing the request" In my local environment, the code starts working properly This line Utility. WrightLogEvent ("TestService", strmessage); Anyway, if this line has failed or not, I should still be able to receive messages coming from the server because it is handled properly. But since I did not get any feedback from the server, it means that my webmath is not accessible. Given that the code below works, do I need to set something in the Web to do such a thing? Config? Or can I start inspecting the IIS, which can give me some clues? Thank you. $ ('# lnkTest'). Click (function ('click event firing!'); $ .ajax ({type: "post", url: "/_layouts/ServiceForm.aspx/TestService", data: "{}", Datatype: "Jason", Content Type: "Application / Jason; Charset = UTF-8", Success: Work (Response) {If (reaction D & amp; Response D. Lang and gt; 0)...

ios - if delete first section - app crash -

If I delete the last cell in my sections, then I have to delete the section to start - This work is right, but if I delete my first section - app crash and delete my last sections - Add button What happens? My code - (minus) deleteExerciseFromCustomTable: (NSIndexPath *) indexPath {[[_exercises objectAtIndex: indexPath.section] removeObjectAtIndex: indexPath .row]; [_previewTable start update]; [_Remove Removal Delete RAATI and XEpath: @ [IndexPath] with RA-Animation: UITTViewerAnonymous Right]; [_previewTable End and Update]; If ([[object Otandaksaksaksaks: Indekspethksekshn] count] == ​​0) {[_group removeObjectAtIndex: indexPath.section]; [_previewTable start update]; [_praviawtable Deletesekshns [Nsindeksset Indekssetvithindeks: Indekspatksekshn] Vithrovnimsn: Uitblaviawrovnimsnrigt]; [_previewTable End and Update]; }} - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section {if (section == [separate group count]) {return 1; } An...

python - Index syntax in Java equivalent to [1:] -

In a dragon, you can do arr [1:] , which means the index ends with 1 has gone. Is there an equivalent in java? The closest I can think for (int i: arr.length) {...} Post text "itemprop =" text "> Assume that arr [1 :] returns a copy of the array arr where you get all the elements from index 1 end, use Arrays.copyOfRange (arr, 1 , Arr.length);

go - Whats the correct golang way to do this: -

It seems a bit stupid, definitely a better way? err = SendMessageAndWait DB, "This is an exam") If mistake! = Zero {fmt.Println ("Error sending message", mistake) returns} err = DoSomething (DB, "this is an exam") If mistake! = Zero {FMT. Error = SendMessageAndWait (db), "This is a third test") If mistake! = Errl = (any exam is "), if mistake! = Zero {fmt.Println (" error in sending message ", err) Zero {fmt.Println ("Error sending message", error) Returns} ... x10 ... Sadly, this is in go, but in a way you can make it cleaner: func isError (mistake error, pre string) error {if Mistake! = Zero} log. Printers ("% v:% v", formerly, fault)} returned Error} func check some () error (error), error (pre-string) {B Errul} {Err! = Nil {log.Printf ("% v:% v", prior, err) b = true} {Return noil} func main (if error: = is error (check some (), "some fail"); Err! = Nil {return / * err * /...

android - Get Data to Static From NonStatic Java -

सार्वजनिक वर्ग पुनःप्राप्त गतिविधि गतिविधि को बढ़ाता है {स्थिर स्ट्रिंग dateData; स्थिर इंट पसंद; @ ओवरराइड संरक्षित शून्य को क्रिएट (बंडल सहेजा गया इन्स्टैंसस्टेट) {सुपर.नक्रेट (सहेजे गए इन्स्टेंसस्टेट); setContentView (R.layout.activity_retrieve); } सार्वजनिक शून्य शो डेटपेकरडायलोगफॉम (देखें वी) {पसंद = 1; DialogFragment newFragment = नया DatePickerFragment (); NewFragment.show (getFragmentManager (), "डेट पिक्चर"); } सार्वजनिक शून्य शो डेट पिक्चर डाइलागटो (देखें वी) {पसंद = 2; स्ट्रिंग दिनांक चयनित; DialogFragment newFragment = नया DatePickerFragment (); NewFragment.show (getFragmentManager (), "डेट पिक्चर"); } सार्वजनिक स्थैतिक शून्य पॉप्युलेटसैटडेट (इंट साल, इंट महीने, इंट डे) {dateData = "+ + + +" / "+ महीने +" / "+ वर्ष; यदि (पसंद == 1) {संपादन टेक्स्ट की तारीख से = (संपादन टेक्स्ट) खोजव्यूबीआईआईडी (आर.आईड.डेटटेटो); & Lt; ------ त्रुटि स्थिर स्थिर सामग्री पर यहां पर है dateFrom.setText (dateData); } अन्य {संपादन टेस्ट तिथि} =...

onmouseover,onmouseout javascript not working in google chrome -

onmouseover, onmouseout Javascript is not working in google chrome. The project is working in Mozilla. & lt; Script type = "text / javascript" & gt; Function toolmaid (id) {var image = document.getElementById (ID); If (id.style.display == "block") {id.style.display = "none"; } Else {id.style.display = "block"; }} & Lt; / Script & gt; & Lt; Div onmouseover = "Toggle Me ( Two problems in the call on your function, unquoted strings Fix this way ... & lt; Div onmouseover = "toggleMe ('I & lt;? = $ Id? & Gt;')" ... & lt ;! - Note the quotation ^ ^ - & gt; Second, you are using the wrong reference in your function to access the property style it should be the image i.e. if (image.style.display == "block") {image.style.display = "none"; } And {image.style.display = "block"; } All being said, I use data attributes instead of wire inj...